
Mcp Tool Factory
io.github.HeshamFS由 GitHub 账号 HeshamFS 发布v0.1.0更新于 Oct 24, 2026
Generate MCP servers from natural language, OpenAPI specs, or database schemas.
概览
根据自然语言描述、OpenAPI 规范、数据库模式、GraphQL 模式或本体生成完整的 MCP 服务器。
- 可以做什么
- MCP Tool Factory 本身就是一个 MCP 服务器,用于生成其他 MCP 服务器。其工具包括用于自然语言描述的 generate_mcp_server,以及 generate_from_openapi、generate_from_database、generate_from_graphql 和 generate_from_ontology,另有 validate_typescript、list_providers 和 get_factory_info。生成的产物包含工具、资源、提示、测试、文档、Dockerfile 和注册表清单,并使用 Streamable HTTP 传输。
- 适用场景
- 适合需要根据现有 API 规范、数据库模式、GraphQL 模式或本体快速搭建新 MCP 服务器的场景,也适合在对话中描述工具并让文件直接写入项目。主要面向构建 MCP 集成的开发者,而非最终用户。
- 运行要求
- 作为本地 Node.js 进程运行,通过 npm 包 @heshamfsalama/mcp-tool-factory 或 npx 安装。生成时需要至少一个 LLM 提供商密钥,例如 ANTHROPIC_API_KEY、CLAUDE_CODE_OAUTH_TOKEN、OPENAI_API_KEY 或 GOOGLE_API_KEY;也支持其他提供商。可选变量包括 MCP_FACTORY_PROVIDER、MCP_FACTORY_MODEL 和 MCP_FACTORY_BUDGET。仅限桌面端。
安装
在 SourceWeft 中
- 打开 控制台中的 Mcp Tool Factory,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
MCP Tool Factory (TypeScript)
Generate production-ready MCP (Model Context Protocol) servers from natural language descriptions, OpenAPI specs, database schemas, GraphQL schemas, or ontologies.
[npm version] [npm downloads] [CI] [License: MIT] [TypeScript] [Node.js] [MCP]
Why MCP?
The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect with external data sources and tools. MCP servers expose tools that can be used by:
- Claude Code and Claude Desktop
- OpenAI Agents SDK
- Google ADK (Agent Development Kit)
- LangChain and CrewAI
- Any MCP-compatible client
MCP Tool Factory lets you generate complete, production-ready MCP servers in seconds.
Features
Use as MCP Server
MCP Tool Factory is itself an MCP server! Add it to Claude Desktop, Claude Code, Cursor, or VS Code to generate MCP servers through conversation.
Tier 1 — Zero Config (Claude Code)
Claude Code auto-injects CLAUDE_CODE_OAUTH_TOKEN — no env vars needed:
Tier 2 — Standard (Pick a Provider)
Set one API key and go. The factory auto-detects the provider:
Claude Desktop / Cursor / VS Code — add to your MCP config (claude_desktop_config.json, .cursor/mcp.json, or .vscode/mcp.json):
Any of these API keys will work: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY, MISTRAL_API_KEY, DEEPSEEK_API_KEY, GROQ_API_KEY, XAI_API_KEY, AZURE_OPENAI_API_KEY, COHERE_API_KEY.
Tier 3 — Full Control (Provider + Model + Budget)
Use MCP_FACTORY_PROVIDER, MCP_FACTORY_MODEL, and MCP_FACTORY_BUDGET to override auto-detection:
Claude Code CLI with full control:
Available Tools
Example Conversation
You: Create an MCP server for the GitHub API with tools to list repos, create issues, and manage pull requests
Claude: Uses
generate_mcp_servertoolI've generated a complete MCP server with the following tools:
list_repositories- List user repositoriescreate_issue- Create a new issuelist_pull_requests- List PRs for a repomerge_pull_request- Merge a PRLet me write these files to your project...
Quick Start
Installation
Set Your API Key
At least one provider API key is required:
Generate Your First Server
Usage
Natural Language Generation
OpenAPI Specification
Database Schema
GraphQL Schema
GraphQL queries are mapped to read-only MCP tools, and mutations are mapped to write tools. GraphQL types are automatically converted to Zod validation schemas.
Ontology
OWL Classes are mapped to MCP Resources, ObjectProperties become Tools, and DataProperties become tool parameters.
Test & Serve
Generated Server Structure
Generated servers export a createServer() factory function for easy testing. The server uses Streamable HTTP transport with a single /mcp POST endpoint and a /health GET endpoint. Tests use InMemoryTransport.createLinkedPair() for fast, reliable in-process testing with vitest.
CLI Reference
Generate Options
Configuration
Environment Variables
LLM Providers
All providers use the Vercel AI SDK via a unified UnifiedLLMProvider class with lazy dynamic imports — only the @ai-sdk/* package for your chosen provider is loaded at runtime.
Programmatic Usage
Basic Usage
From OpenAPI
From Database
From GraphQL
From Ontology
Code Validation
Use with AI Frameworks
Claude Code / Claude Desktop
Add to your MCP settings (claude_desktop_config.json):
OpenAI Agents SDK
Google ADK
LangChain
Production Features
Structured Logging
Generates servers with pino structured JSON logging:
Prometheus Metrics
Generates servers with prom-client metrics:
mcp_tool_calls_total- Counter of tool invocationsmcp_tool_duration_seconds- Histogram of execution times
Rate Limiting
Configurable rate limiting per client with sliding window.
Retry Logic
Exponential backoff retry for transient failures.
Structured Error Codes
Generated servers use structured error codes for consistent error handling:
INVALID_INPUT- Malformed or invalid tool parametersNOT_FOUND- Requested resource does not existAUTH_ERROR- Authentication or authorization failureINTERNAL_ERROR- Unexpected server error
Enhanced Health Check
The /health endpoint returns detailed server status:
MCP Registry Publishing
Publish your generated servers to the MCP Registry for discoverability.
Generate with Registry Support
This generates registry-compliant files:
package.json:
server.json:
Publish Workflow
See Publishing Guide for detailed instructions.
Architecture
Development
Project Structure
Documentation
- Getting Started
- CLI Reference
- API Reference
- Examples
- OpenAPI Guide
- Database Guide
- Providers Guide
- Production Features
- Architecture
- Troubleshooting
- Contributing
Troubleshooting
Common Issues
API Key Not Found
Generated Server Won't Start
TypeScript Errors
See Troubleshooting Guide for more solutions.
Changelog
v0.3.0
- Vercel AI SDK Migration - All LLM providers now use the Vercel AI SDK via a single
UnifiedLLMProviderclass with lazy dynamic imports. Removed ~473 LOC of provider-specific implementations. Only the@ai-sdk/*package for your chosen provider is loaded at runtime. - 10 LLM Providers - Added Mistral, DeepSeek, Groq, xAI, Azure, and Cohere alongside existing Anthropic, OpenAI, Google, and Claude Code providers. All use the same unified interface.
- Cost Tracking - Every LLM call now calculates estimated cost using a built-in pricing table for 50+ models. Shows per-call cost, total generation cost, and per-phase breakdown (tool extraction, implementation, tests, docs). Detailed token breakdowns include cache read/write tokens and reasoning tokens from the AI SDK.
- Budget Limits (
--budget <amount>) - Set a maximum spend in USD. Generation aborts gracefully withBudgetExceededErrorif cumulative cost exceeds the budget. - Provider Cost Comparison (
--compare-costs) - Before generation, estimates cost across all available providers and shows a sorted comparison table. No extra API calls needed — uses the static pricing table. - Per-Phase Cost Breakdown - CLI output and execution logs show which generation steps cost the most (tool extraction, implementation, resource extraction, prompt extraction, test generation, docs generation).
- OpenAI Reasoning Model Support - Temperature parameter is automatically omitted for OpenAI o-series and gpt-5.x models that don't support it.
v0.2.0
- Streamable HTTP Transport - Generated servers use
StreamableHTTPServerTransportwith nativehttpmodule instead of Express/SSE (deprecated June 2025). Single/mcpPOST endpoint with/healthGET endpoint. - MCP SDK v1.26.0 - Updated from
^1.0.0to^1.26.0 - Resources & Prompts - Full support for all three MCP primitives. Resources expose structured data (documents, DB records, file trees). Prompts provide reusable templates for guided LLM workflows. Agent automatically extracts resources and prompts from descriptions via LLM.
- GraphQL Input Source - New
from-graphqlCLI command andgenerate_from_graphqlMCP tool. Queries map to read tools, mutations map to write tools, and GraphQL types are converted to Zod schemas. - Ontology Input Source - New
from-ontologyCLI command andgenerate_from_ontologyMCP tool. Supports RDF/OWL, JSON-LD, and custom YAML formats. OWL Classes map to Resources, ObjectProperties to Tools, DataProperties to tool parameters. - LLM Response Caching - Deduplicates identical LLM calls with configurable TTL. Bypass with
skipCacheoption. - Parallel Generation - Tool implementations generated concurrently by default (
parallel: true,maxConcurrency: 5). Significant speed improvement for multi-tool servers. - InMemoryTransport Testing - Generated tests use
InMemoryTransport.createLinkedPair()instead of subprocess spawning. Servers exportcreateServer()factory function for testability. - Production Enhancements - Rate limiting, structured logging, metrics, and duration tracking wired into tool handlers. Enhanced health check with version, uptime, memory, and transport info. Structured error codes:
INVALID_INPUT,NOT_FOUND,AUTH_ERROR,INTERNAL_ERROR.
v0.1.0
- Initial TypeScript release
- Natural language generation with Claude, Claude Code, OpenAI, Google Gemini
- OpenAPI 3.0+ specification import
- Database CRUD generation (SQLite, PostgreSQL)
- Production features (logging, metrics, rate limiting)
- MCP Registry server.json generation
- TypeScript syntax validation
- Web search for API documentation
- GitHub Actions CI/CD generation
- MCP Server mode for on-the-fly generation with Claude
License
MIT
Links
来源:README.md,提交 7aa12b1
工具
0版本历史
1- v0.1.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分