Mcpgen
MCP server by JnanaSrota Verified · gh:jnanasrota
Generates a Python MCP server from an OpenAPI spec or Postman collection. It writes source code that developers can read, edit and run without depending on mcpgen at runtime.
Install Mcpgen
Built from the published package, never by AI.
claude mcp add mcpgen -- uvx mcpgen-cliRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"mcpgen": {
"args": [
"mcpgen-cli"
],
"command": "uvx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"mcpgen": {
"args": [
"mcpgen-cli"
],
"command": "uvx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"mcpgen": {
"args": [
"mcpgen-cli"
],
"command": "uvx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add mcpgen -- uvx mcpgen-cli{
"mcpServers": {
"mcpgen": {
"args": [
"mcpgen-cli"
],
"command": "uvx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add mcpgen uvx mcpgen-cliGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the mcpgen block.
About
mcpgen is a command line tool that turns an OpenAPI 3.x spec (JSON or YAML, from a file or URL) or a Postman Collection v2.1 into a Python MCP server. It writes a folder with a server.py file and a requirements.txt file that lists httpx and mcp. The generated server creates one function per API endpoint and detects the auth scheme from the spec.
The output is plain source code that the user owns, so it can be edited, committed to a repo and deployed without mcpgen. The project is aimed at developers who want an MCP server for an existing API and prefer code they can review over a runtime proxy. The tool is released under the MIT license.
Written from the project's README and checked against it.
What you need
- Python
- pip, to install mcpgen-cli
- An OpenAPI 3.x spec or Postman Collection v2.1 as input
- An API token for the target API, if it uses auth
Try asking
- Use the generated Stripe MCP server to list my recent customers.
- Call the Petstore MCP server to find pets with a given status.
- Which endpoints does the generated API server expose as tools?
Good to know
- OAuth2 flows are approximated as a bearer token, so the user supplies the token manually.
- Swagger 2.x is not supported yet and is on the roadmap.
- Recursive $ref resolution for deeply nested schemas is on the roadmap.
- TypeScript output is planned but not yet available.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: README.md. This looks for known risky patterns and is not a full audit. How grades work
What you can do with it
- Turn an OpenAPI spec into an MCP server
- Convert a Postman collection into Python code
- Create an editable MCP server for an existing API
Alternatives to Mcpgen
All alternatives →Turns GitHub repositories into architecture diagrams, written explanations, Mermaid source and narrated explainer videos. Built for developers who want to understand a codebase, and for AI agents that need to read one.
Mocks, records, and chaos-tests HTTP(S) dependencies for development and testing. One port serves many protocols, including gRPC, WebSockets, and LLM chat APIs. Built for developers and testers who need stand-in services during tests.
Provides MCP server and CLI tools that let AI coding agents build, test and manage iOS and macOS projects with Xcode and simulators. It is aimed at developers working on Apple platform apps.
Creates editable draw.io diagrams in AI chat from Mermaid, PlantUML, CSV or draw.io XML. Built for people who want diagrams from text prompts that stay editable in draw.io.
Indexes your code, git history, tests and decisions on your machine so AI coding agents can query the index instead of re-reading files. Built for developers who want fewer files opened and clearer answers about change risk and code health.
Gives your AI assistant hosted codebase intelligence for repos indexed on repowise.dev. Use it to ask how code works, what a change may break, and which tests to run.
Compare with GitDiagram, mockserver or XcodeBuildMCP
Mcpgen: common questions
Does mcpgen need to run while the MCP server is used?
No. The README says mcpgen is a build tool used once at generation time, and the generated server.py has no runtime dependency on it.
Which API spec formats can mcpgen read?
It accepts OpenAPI 3.x in JSON or YAML, a URL pointing to an OpenAPI spec, and Postman Collection v2.1 files.
How does mcpgen handle API authentication?
It detects bearer token, API key and basic auth from the spec and generates an environment variable for each. OAuth2 is treated as a bearer token that the user supplies.
How do I install Mcpgen?
In Claude Code run claude mcp add mcpgen -- uvx mcpgen-cli. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is Mcpgen the official server?
Mcpgen is published by gh:jnanasrota from its verified domain in the official MCP Registry.
Is Mcpgen free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is Mcpgen safe to use?
It scores 59 of 100. Grades: maintenance C, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to Mcpgen?
Similar MCP servers: GitDiagram, mockserver, XcodeBuildMCP, draw.io.
Does Mcpgen work with ChatGPT?
Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.
