
Mcp Tool Factory
io.github.HeshamFSPublished by GitHub account HeshamFSv0.1.0Updated Oct 24, 2026
Generate MCP servers from natural language, OpenAPI specs, or database schemas.
Overview
Generates complete MCP servers from natural language descriptions, OpenAPI specs, database schemas, GraphQL schemas, or ontologies.
- What you can do
- MCP Tool Factory is itself an MCP server that generates other MCP servers. Its tools include generate_mcp_server for plain-English descriptions, generate_from_openapi, generate_from_database, generate_from_graphql, and generate_from_ontology, plus validate_typescript, list_providers, and get_factory_info. Generated output includes tools, resources, prompts, tests, documentation, a Dockerfile, and a registry manifest, using Streamable HTTP transport.
- When to use it
- Useful when you want to scaffold a new MCP server quickly from an existing API spec, database schema, GraphQL schema, or ontology, or when you want to describe tools in conversation and have the files written into your project. It is aimed at developers building MCP integrations rather than end users.
- Requirements
- Runs locally as a Node.js process, installed via npm as @heshamfsalama/mcp-tool-factory or npx. At least one LLM provider key is required for generation, for example ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, OPENAI_API_KEY, or GOOGLE_API_KEY; other providers are also supported. Optional variables include MCP_FACTORY_PROVIDER, MCP_FACTORY_MODEL, and MCP_FACTORY_BUDGET. Desktop only.
Installation
In SourceWeft
- Open Mcp Tool Factory in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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
Source: README.md at commit 7aa12b1
Tools
0Version history
1- v0.1.0LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts