mcpfoundry
A CLI tool that generates production-ready MCP servers from databases or OpenAPI specifications, with optional security shields.
README
mcpfoundry
Forge production-ready MCP (Model Context Protocol) servers from your existing data — a database or an OpenAPI spec — in seconds.
mcpfoundry is a zero-friction CLI that introspects a data source and scaffolds a
clean, self-contained, runnable MCP server. Generated servers always ship with
parameter validation (Zod / Pydantic). An optional zero-trust
ZTAI Security Shield (JWT guard + deception canary) can be layered in with a
single --secure flag — recommended, never forced.
Install
npm install -g mcpfoundry
# or run ad-hoc:
npx mcpfoundry create --help
Usage
From an OpenAPI / Swagger spec
Every endpoint becomes a typed MCP tool:
mcpfoundry create \
--type openapi \
--input ./openapi.json \
--output ./my-mcp-server \
--lang nodejs
From a database
Tables are introspected and turned into CRUD tools:
mcpfoundry create \
--type database \
--provider postgres \
--uri "postgresql://user:pass@localhost:5432/mydb" \
--output ./my-mcp-server \
--lang python
Postgres is fully supported today. MySQL and MongoDB are stubbed and open for contributions.
Flags
| Flag | Description |
|---|---|
--type |
database or openapi (required) |
--provider |
postgres | mysql | mongodb (database mode) |
--uri |
DB connection string (database mode) |
--input |
Path to an OpenAPI spec, JSON or YAML (openapi mode) |
--output |
Output directory (required) |
--lang |
nodejs (default) or python |
--transport |
http (default) or stdio |
--no-http |
Shortcut for --transport stdio |
--port |
Port for the http transport (default 3000) |
--secure |
Embed the optional ZTAI Security Shield |
--force |
Overwrite a non-empty output directory |
--dry-run |
Preview the tools that would be generated, then exit (no files written) |
Transports
By default the server runs over HTTP (Streamable HTTP — Express for Node,
FastMCP for Python), listening on http://localhost:<port>/mcp:
mcpfoundry create --type openapi --input ./openapi.yaml --output ./srv --port 3000
To generate a stdio server instead — the transport clients like Claude Desktop / Claude Code use to launch a local MCP server — disable HTTP:
mcpfoundry create --type openapi --input ./openapi.yaml --output ./srv --no-http
With --secure + --transport http, the JWT guard verifies an
Authorization: Bearer <token> header on every request (returns 401 on
failure); with stdio it verifies ZTAI_AUTH_TOKEN once at startup.
--input accepts a local path or a URL, in JSON or YAML.
Preview before generating
mcpfoundry create --type openapi --input ./openapi.yaml --dry-run
✔ Dry run — 4 tool(s) would be generated:
• list_pets(limit?: integer)
• create_pet(name: string, tag?: string)
• get_pet_by_id(pet_id: integer)
• delete_pet(pet_id: integer)
The optional ZTAI Security Shield (--secure)
When you pass --secure, every generated server additionally enforces:
- JWT Guard — verifies a short-lived HS256 token (
ZTAI_AUTH_TOKENat startup over stdio, or anAuthorization: Bearerheader per request over HTTP) againstJWT_SECRET. Invalid or missing tokens are rejected before any tool runs. - Parameter hardening — strict Zod/Pydantic schemas (this is on even
without
--secure, because it's just good hygiene). - Deception Canary — when
ZTAI_CANARY_IDis set, tool output carries a subtle, traceable marker to help detect adversarial exfiltration.
Without --secure you still get a perfectly good, vendor-neutral MCP server.
Architecture — the Template-Compiler pattern
src/
cli.ts # arg parsing + orchestration
parsers/ # data source -> normalized IR (ToolSpec[])
compiler.ts # IR + Handlebars templates -> generated project
types.ts # the shared IR
templates/
nodejs/ # @modelcontextprotocol/sdk + Zod
python/ # FastMCP + Pydantic
Parsers and templates are decoupled by a normalized intermediate representation,
so adding a new language is just a new templates/<lang>/ folder — no engine
changes. See CONTRIBUTING.md.
Develop
npm install
npm run build
node dist/cli.js create --type openapi --input examples/petstore.openapi.json --output /tmp/petstore-mcp
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。