forge MCP server
Commit Nov 13, 2026Transforms REST API specifications into production-ready, type-safe Model Context Protocol servers using TypeScript.
Also known as schwarztim/mcp-forge
- Stars
- 1
- Tools
- 4
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 13, 2026
- License
- MIT
What is forge MCP?
forge transforms REST API specifications into production-ready, type-safe Model Context Protocol servers using TypeScript. It exposes 4 tools, such as groupBy, maxParametersPerTool, excludeOperations.
Summary generated from the project's README
About forge MCP server
Converting REST API specifications into functional Model Context Protocol servers is the primary task for mcp-forge. This tool automates the creation of production-ready TypeScript implementations by introspecting existing OpenAPI, AsyncAPI, or JSON schemas. It is designed for development teams that need to integrate external APIs into MCP clients quickly without writing manual protocol bindings.
Users run this tool locally using Node.js and can generate servers from a local file path or a remote URL. The generator produces a complete project structure including TypeScript source files, tool definitions, resource lists, and an auto-generated HTTP client. It handles complex requirements like input validation, rate limiting, and environment variable-based authentication to ensure the resulting server meets professional standards.
Unlike language model-driven alternatives, this utility follows a schema-first approach. It relies on formal specifications to ensure strict type safety and accurate tool descriptions. The output includes built-in error handling and logging, making it suitable for deployment in real-world environments.
What you can do with it
- 1Automate MCP server creationGenerate a complete TypeScript MCP server implementation directly from an existing OpenAPI specification file.
- 2Organize API endpoints into toolsGroup related API operations into cohesive tools using specific OpenAPI tags or endpoint patterns.
- 3Enforce strict API validationConfigure the generated server to validate all incoming parameters and API responses against the original schema.
Written from the project's README. Every use case is checked against a quote from it.
forge MCP tools 4
Detected from the READMEgroupBymaxParametersPerToolexcludeOperationsincludeOperations
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachableschwarztim/mcp-forge is public and reachablegithub.com/schwarztim/mcp-forge ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-02github.com/schwarztim/mcp-forge ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model4 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubmcp-forge
Autonomous MCP server generator that transforms any REST API into a production-ready Model Context Protocol server.
Overview
mcp-forge automates the conversion of REST API specifications into fully functional MCP (Model Context Protocol) servers. Rather than manual implementation of protocol bindings, mcp-forge introspects API schemas and generates type-safe, documented server implementations in TypeScript.
The tool is designed for teams needing rapid MCP integrations with external APIs while maintaining production quality, security, and maintainability standards.
Key Features
- Automated Server Generation: Converts REST API specs (OpenAPI, AsyncAPI, or custom JSON schemas) into complete MCP server implementations
- Type Safety: Generates TypeScript with strict typing, reducing runtime errors and improving IDE support
- Resource Definition: Automatically creates MCP resource lists, templates, and tool definitions from API endpoints
- Schema Introspection: Analyzes API metadata to infer proper tool descriptions, parameter validation, and response handling
- Production Ready: Generated servers include error handling, input validation, rate limiting, and logging
- Tool Composition: Intelligently groups related API endpoints into cohesive tools with proper parameter mapping
- Documentation Generation: Creates comprehensive README and tool documentation from API schemas
- Configuration Management: Generates environment variable schemas and deployment configurations
Quick Start
Prerequisites
- Node.js 18+
- TypeScript 5+
- npm or yarn
Installation
npm install -g mcp-forge
# or
git clone https://github.com/schwarztim/mcp-forge.git
cd mcp-forge
npm install
Basic Usage
Generate an MCP server from an OpenAPI specification:
mcp-forge generate --api-spec ./api.openapi.json --output ./my-mcp-server
Or from a URL:
mcp-forge generate --api-url https://api.example.com/openapi.json --output ./my-mcp-server
Configuration
Create an mcp-forge.config.json file in your project root:
{
"apiSpec": "./api.openapi.json",
"output": "./dist",
"serverName": "example-api-mcp",
"description": "MCP server for Example API",
"version": "1.0.0",
"tools": {
"groupBy": "tag",
"maxParametersPerTool": 8
},
"security": {
"apiKeyHeader": "X-API-Key",
"rateLimitPerMinute": 60
},
"validation": {
"validateResponses": true,
"strictMode": true
}
}
Then run:
mcp-forge generate
Generated Structure
The output follows standard MCP project layout:
my-mcp-server/
├── src/
│ ├── index.ts # Server entry point
│ ├── tools.ts # Tool implementations
│ ├── resources.ts # Resource definitions
│ ├── types.ts # Generated TypeScript types
│ └── client.ts # API client (auto-generated)
├── package.json
├── tsconfig.json
├── README.md
└── .env.example
Development
Building
npm run build
Testing
npm test
Linting
npm run lint
npm run lint:fix
Architecture
mcp-forge consists of three main components:
- Schema Parser: Reads and normalizes API specifications from multiple formats (OpenAPI 3.0+, AsyncAPI, JSON Schema)
- Code Generator: Produces TypeScript code with proper imports, types, and runtime logic
- Validator: Ensures generated servers conform to MCP protocol and best practices
The generator produces:
- MCP resource and tool definitions with full type safety
- HTTP client code with authentication and error handling
- Input validation middleware
- Comprehensive API documentation
- Docker and deployment configurations
Comparison with thesun
mcp-forge and thesun are both MCP generation tools with different approaches:
- mcp-forge: Schema-first generator optimized for REST APIs with existing specifications. Emphasis on declarative generation from well-defined schemas.
- thesun: Language model-driven generator that can infer API structure from documentation and conversation. More flexible but requires less formal specifications.
Both produce production-ready MCP servers; choice depends on whether your API has formal specifications available.
Configuration Options
Tool Generation
groupBy: How to organize tools -tag(OpenAPI tags),resource(endpoint patterns), oroperation(one tool per endpoint)maxParametersPerTool: Split tools with too many parameters into multiple smaller toolsexcludeOperations: Comma-separated list of operation IDs to skipincludeOperations: Whitelist specific operations (overrides excludeOperations)
Security
apiKeyHeader: Header name for API key authenticationapiKeyEnv: Environment variable name for API keybearerTokenEnv: Environment variable for Bearer tokenoauthConfig: OAuth 2.0 flow configuration
Validation
validateResponses: Validate API responses against schema (slower but safer)strictMode: Fail on schema mismatches instead of warningcoerceTypes: Automatically convert parameter types (loose validation)
Tech Stack
- Language: TypeScript
- MCP SDK: @modelcontextprotocol/sdk
- API Parsing: openapi-types, swagger-parser, ajv (JSON Schema validator)
- Code Generation: TypeScript compiler API, handlebars
- HTTP Client: axios with retry logic
- Testing: Jest
- Build: esbuild
- Linting: ESLint + Prettier
Security Considerations
Generated servers include:
- Input validation on all parameters
- Environment variable-based authentication (no hardcoded secrets)
- Rate limiting and request throttling
- HTTPS enforcement for API calls
- Audit logging for all tool invocations
- Response sanitization to prevent information leakage
Limitations
- Requires API specification in supported format (OpenAPI 3.0+, AsyncAPI 3.0+, or JSON Schema)
- Generated servers assume stateless REST APIs (not ideal for stateful or streaming APIs)
- Complex authentication flows may require manual adjustments
- GraphQL APIs require wrapper layers for OpenAPI compatibility
Contributing
Contributions welcome. Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Add tests for new functionality
- Ensure linting passes (
npm run lint:fix) - Submit a pull request
License
MIT
Support
For issues, feature requests, or questions:
- GitHub Issues: https://github.com/schwarztim/mcp-forge/issues
- Discussions: https://github.com/schwarztim/mcp-forge/discussions
Related Projects
- thesun - Language model-driven MCP generator
- @modelcontextprotocol/sdk - Official MCP TypeScript SDK
- swagger-parser - API specification parser
forge MCP questions
What tools does forge MCP provide?
It exposes 4 tools, including groupBy, maxParametersPerTool, excludeOperations, includeOperations.
What API formats are supported for generation?
The tool supports OpenAPI 3.0+, AsyncAPI, and custom JSON schemas.
How do I generate a server from a remote URL?
You can use the generate command with the --api-url flag followed by the URL of your OpenAPI specification.
Can it generate servers for GraphQL APIs?
No, GraphQL APIs require a wrapper layer to make them compatible with OpenAPI first.