{"id":49673312,"url":"https://github.com/christopherdond/mcp-generator","last_synced_at":"2026-05-10T04:01:18.755Z","repository":{"id":355502625,"uuid":"1228322256","full_name":"ChristopherDond/MCP-Generator","owner":"ChristopherDond","description":"Wide MCP generator, easy and fast","archived":false,"fork":false,"pushed_at":"2026-05-07T21:04:44.000Z","size":96,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-08T02:03:23.152Z","etag":null,"topics":["cli","fastmcp","mcp","mcp-server","openapi"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChristopherDond.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-03T22:03:16.000Z","updated_at":"2026-05-07T21:04:48.000Z","dependencies_parsed_at":"2026-05-08T02:03:21.309Z","dependency_job_id":null,"html_url":"https://github.com/ChristopherDond/MCP-Generator","commit_stats":null,"previous_names":["christopherdond/mcp-generator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ChristopherDond/MCP-Generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherDond%2FMCP-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherDond%2FMCP-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherDond%2FMCP-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherDond%2FMCP-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristopherDond","download_url":"https://codeload.github.com/ChristopherDond/MCP-Generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherDond%2FMCP-Generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32805514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","fastmcp","mcp","mcp-server","openapi"],"created_at":"2026-05-07T01:05:43.152Z","updated_at":"2026-05-09T03:01:12.331Z","avatar_url":"https://github.com/ChristopherDond.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openapi-to-mcp\n\n\u003e Turn any OpenAPI spec into a ready-to-run MCP server in seconds.\n\n```bash\nmcp-gen generate --input openapi.yaml --lang typescript --out ./my-server\n```\n\nNo boilerplate. No manual wiring. Just a working [Model Context Protocol](https://modelcontextprotocol.io) server with every endpoint mapped to a tool — in TypeScript or Python.\n\n---\n\n## Why\n\nMCP became the standard way to expose APIs to AI agents in 2025/26. Writing MCP servers by hand means repeating the same scaffolding for every project — parsing specs, registering tools, handling schemas. `openapi-to-mcp` eliminates that entirely.\n\nYou bring the spec. The CLI brings the server.\n\n---\n\n## How it works\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant CLI\n    participant Parser\n    participant Generator\n    participant Output\n\n    User-\u003e\u003eCLI: mcp-gen generate --input api.yaml --lang python\n    CLI-\u003e\u003eParser: validate \u0026 parse OpenAPI v3 (JSON or YAML)\n    Parser-\u003e\u003eGenerator: internal AST (tools, models, examples)\n    Generator-\u003e\u003eOutput: render Handlebars templates\n    Output--\u003e\u003eUser: TypeScript or Python MCP server project\n```\n\nEach `path + method` in your spec becomes an MCP **tool** with:\n- Typed input schema derived from parameters and request body\n- Example response from the spec pre-wired as a stub\n- Incremental markers so re-generation never overwrites your custom logic\n\n---\n\n## Requirements\n\n- Node.js 20+\n- npm 9+\n\n---\n\n## Installation\n\n```bash\ngit clone https://github.com/your-username/openapi-to-mcp.git\ncd openapi-to-mcp\nnpm install\nnpm run build\n```\n\n\u003e npm publish coming soon — `npm install -g mcp-gen` will work once released.\n\n---\n\n## Usage\n\n### Validate a spec\n\nAccepts `.json`, `.yaml`, `.yml`, or a URL.\n\n```bash\nnode dist/cli/index.js validate --input ./api/openapi.yaml\n```\n\n```\n✔ Spec is valid\n\n  Tools: 12  Models: 6  Base URL: https://api.example.com\n```\n\n### Generate a TypeScript server\n\n```bash\nnode dist/cli/index.js generate \\\n  --input ./api/openapi.yaml \\\n  --lang typescript \\\n  --out ./my-server\n```\n\n```\n✔ Generation complete\n\n  ✓ 7 files created\n\n    my-server/src/server.ts\n    my-server/src/models.ts\n    my-server/package.json\n    my-server/tsconfig.json\n    my-server/README.md\n    my-server/Dockerfile\n    my-server/.github/workflows/ci.yml\n```\n\n### Generate a Python server\n\n```bash\nnode dist/cli/index.js generate \\\n  --input ./api/openapi.yaml \\\n  --lang python \\\n  --out ./my-server\n```\n\n```\n✔ Generation complete\n\n  ✓ 6 files created\n\n    my-server/server.py\n    my-server/models.py\n    my-server/requirements.txt\n    my-server/Dockerfile\n    my-server/README.md\n    my-server/.github/workflows/ci.yml\n```\n\n### Re-generate without losing your code (incremental)\n\n```bash\nnode dist/cli/index.js generate \\\n  --input ./api/openapi.yaml \\\n  --out ./my-server \\\n  --incremental\n```\n\n```\n✔ Generation complete\n\n  ✓ 7 files created\n  ↺ 3 handler(s) preserved\n\n    ↺ get_users\n    ↺ post_users\n    ↺ get_users_id\n```\n\nCustom code between `@@mcp-gen` markers is preserved. Generated stubs are refreshed. Your logic is never touched.\n\n### Accepts URLs too\n\n```bash\nnode dist/cli/index.js generate \\\n  --input https://petstore3.swagger.io/api/v3/openapi.json \\\n  --out ./petstore-mcp\n```\n\n---\n\n## CLI Reference\n\n| Flag | Description | Default |\n|------|-------------|---------|\n| `--input`, `-i` | Path or URL to the OpenAPI spec (`.json` \\| `.yaml` \\| `.yml`) | required |\n| `--out`, `-o` | Output directory for the generated project | `./mcp-server` |\n| `--lang`, `-l` | Target language: `typescript` \\| `python` | `typescript` |\n| `--force`, `-f` | Overwrite existing files without prompting | `false` |\n| `--incremental` | Preserve custom handler code on re-generation | `false` |\n| `--name` | Override the server name | derived from spec title |\n| `--server-version` | Override the server version | derived from spec |\n\n---\n\n## Generated project structure\n\n**TypeScript:**\n```\nmy-server/\n├── src/\n│   ├── server.ts        # MCP server — tool definitions + handlers\n│   └── models.ts        # TypeScript interfaces from OpenAPI schemas\n├── .github/\n│   └── workflows/\n│       └── ci.yml\n├── Dockerfile\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\n**Python:**\n```\nmy-server/\n├── server.py            # FastMCP server — tool definitions + handlers\n├── models.py            # Pydantic models from OpenAPI schemas\n├── requirements.txt\n├── .github/\n│   └── workflows/\n│       └── ci.yml\n├── Dockerfile\n└── README.md\n```\n\n---\n\n## Connect to Claude Desktop\n\n**TypeScript:**\n```json\n{\n  \"mcpServers\": {\n    \"my-server\": {\n      \"command\": \"node\",\n      \"args\": [\"/absolute/path/to/my-server/dist/server.js\"]\n    }\n  }\n}\n```\n\n**Python:**\n```json\n{\n  \"mcpServers\": {\n    \"my-server\": {\n      \"command\": \"python\",\n      \"args\": [\"/absolute/path/to/my-server/server.py\"]\n    }\n  }\n}\n```\n\nRestart Claude Desktop. Your API tools appear automatically.\n\n---\n\n## Implement handlers\n\nGenerated files return spec examples by default. Replace stubs with real logic.\n\n**TypeScript** (`src/server.ts`):\n```typescript\ncase \"get_users_id\": {\n  // @@mcp-gen:start:get_users_id\n  const user = await db.users.findById(args.id);\n  return { content: [{ type: \"text\", text: JSON.stringify(user) }] };\n  // @@mcp-gen:end:get_users_id\n}\n```\n\n**Python** (`server.py`):\n```python\n@mcp.tool()\nasync def get_users_id(id: float) -\u003e Any:\n    # @@mcp-gen:start:get_users_id\n    user = await db.users.find_by_id(id)\n    return user\n    # @@mcp-gen:end:get_users_id\n```\n\nCode between `@@mcp-gen:start` and `@@mcp-gen:end` markers is preserved when you re-run `generate --incremental`.\n\n---\n\n## Development\n\n```bash\nnpm test\nnpx tsc --noEmit\n\n# TypeScript example\nnode dist/cli/index.js generate --input examples/petstore.json --out /tmp/ts-test --force\n\n# Python example\nnode dist/cli/index.js generate --input examples/petstore.yaml --lang python --out /tmp/py-test --force\n\n# Incremental example\nnode dist/cli/index.js generate --input examples/petstore.json --out /tmp/ts-test --incremental\n```\n\n---\n\n## Roadmap\n\n| Week | Status | Scope |\n|------|--------|-------|\n| 0–1 | ✅ Done | CLI, OpenAPI v3 parser, TypeScript generator, 7-file scaffold |\n| 2 | ✅ Done | YAML input, Python/FastMCP target, incremental generation |\n| 3 | 🔜 Next | `oneOf`/`anyOf` support, auth stubs, integration tests |\n| 4 | Planned | Interactive CLI mode, npm/pip publish |\n| 5 | Planned | `mcp-gen init --from stripe` — built-in spec registry |\n| 6 | Planned | Release candidate, Product Hunt launch |\n\n---\n\n## Known limitations\n\n- OpenAPI v2 (Swagger) is not supported — v3.x only\n- `oneOf` / `anyOf` / `discriminator` schemas are partially handled\n- `copy-templates` script uses `cp` — on Windows, change to `xcopy` in `package.json`\n\n---\n\n## License\n\nMIT © 2026","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopherdond%2Fmcp-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristopherdond%2Fmcp-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopherdond%2Fmcp-generator/lists"}