Build MCP servers from natural language prompts โ local-first, privacy-focused
Project description
MCP Factory ๐ญ
Build MCP servers from natural language prompts โ local-first, privacy-focused
What is MCP Factory?
MCP Factory is a CLI tool that generates fully functional Model Context Protocol servers from plain English descriptions. Describe what you want, get production-ready TypeScript or Python code โ complete with tool annotations, auth setup, and MCP best practices.
Installation
pip install prompt2mcp
Or install from source:
git clone https://github.com/JatinTaori1904/mcp-factory.git
cd mcp-factory
pip install -e ".[dev]"
Quick Start
# Create your first MCP server
mcpfactory create "Read my CSV files and answer questions about the data"
# Generate a GitHub API server (auto-detects API, generates auth + SETUP.md)
mcpfactory create "Create tools for the GitHub API" --name github-tools
# Python server with interactive refinement
mcpfactory create "Build a Slack bot" --lang python --interactive
# List your servers
mcpfactory list-servers
# See available templates
mcpfactory templates
# See supported APIs with auto-setup
mcpfactory supported-apis
Features
๐ฏ Prompt-to-Server
Describe what you want โ get a working MCP server with tools, schemas, and error handling.
๐ฆ 8 Built-in Templates
| Template | Description | Example Prompt |
|---|---|---|
| File Reader | Read, search, list local files | "Read and search through my project files" |
| Database Connector | Query SQL/NoSQL databases | "Connect to PostgreSQL and run queries" |
| API Wrapper | Wrap any REST API with tools | "Create tools for the GitHub API" |
| Web Scraper | Extract data from websites | "Scrape product prices from websites" |
| Document Processor | Parse PDFs, DOCX, Markdown | "Extract text from PDF documents" |
| Auth Server | JWT auth, user management, RBAC | "Build an authentication server with JWT" |
| Data Pipeline | ETL, transform, aggregate data | "ETL pipeline to ingest CSV and transform" |
| Notification Hub | Email, webhook, multi-channel alerts | "Send notifications via email and webhooks" |
๐ค LLM-Powered Intelligence
MCP Factory uses a multi-tier generation pipeline:
- LLM Prompt Analysis โ Understands your intent using Ollama (local) or OpenAI/Claude (cloud)
- API-Specific Tool Generation โ Pre-built tool implementations for 5 APIs (GitHub, Slack, Stripe, Notion, Discord)
- LLM Code Review โ Auto-reviews generated code for quality, security, and MCP compliance
- Interactive Mode โ Asks follow-up questions for vague prompts to generate better servers
- Keyword Fallback โ Works fully offline without any LLM when needed
๐ 11 APIs with Auto-Setup
When your prompt mentions a supported API, MCP Factory automatically generates:
.env.exampleโ API-specific environment variablesSETUP.mdโ Step-by-step guide to get API keys- Auth validation โ Startup checks with actionable error messages
- Pre-configured headers โ Bearer, Basic, or OAuth2
| API | Auth | Env Variable | Free Tier |
|---|---|---|---|
| GitHub | Bearer | GITHUB_TOKEN |
โ |
| Slack | Bearer | SLACK_BOT_TOKEN |
โ |
| OpenAI | Bearer | OPENAI_API_KEY |
โ |
| Stripe | Bearer | STRIPE_SECRET_KEY |
โ |
| Notion | Bearer | NOTION_API_KEY |
โ |
| Spotify | OAuth2 | SPOTIFY_CLIENT_ID |
โ |
| Bearer | GOOGLE_API_KEY |
โ | |
| Twitter/X | Bearer | TWITTER_BEARER_TOKEN |
โ |
| Discord | Bearer | DISCORD_BOT_TOKEN |
โ |
| Linear | Bearer | LINEAR_API_KEY |
โ |
| Jira | Basic | JIRA_API_TOKEN |
โ |
๐ฌ Interactive Mode
For vague prompts, MCP Factory asks targeted follow-up questions to generate better servers:
mcpfactory create "build something for files" --interactive
# MCP Factory asks:
# 1. What file types? (code, documents, data files, all)
# 2. What operations? (read, write, search, all)
# โ Generates a refined, specific server
โ MCP Best Practices
Generated servers follow MCP best practices:
- Tool annotations โ
readOnlyHint,destructiveHint,idempotentHint,openWorldHint - Prefixed naming โ Consistent tool prefixes (e.g.,
gh_,slack_) - Schema descriptions โ Zod
.describe()/ PydanticField(description=...)on every parameter - Actionable errors โ Errors include what went wrong + what to do next
- Pagination โ List operations support
cursor/maxResultsparameters - Secrets via env vars โ Never hardcoded, always from
.env
๐ TypeScript & Python
Generate servers in your preferred language:
mcpfactory create "..." --lang typescript # default
mcpfactory create "..." --lang python
๐ Privacy First
- All generated code stays on your local filesystem
- Server metadata stored in local SQLite (
~/.mcpfactory/servers.db) - No telemetry, no cloud, no data collection
- LLM calls can use local Ollama models for complete offline privacy
CLI Reference
mcpfactory create <prompt> Create a new MCP server
--name, -n Server name
--lang, -l Language: typescript | python (default: typescript)
--output, -o Output directory (default: ./output)
--provider, -p LLM provider: ollama | openai (default: ollama)
--model, -m Model name (e.g., llama3, gpt-4)
--interactive Enable follow-up questions for vague prompts
--no-interactive Skip interactive refinement
mcpfactory list-servers List all generated servers
mcpfactory templates Show available templates
mcpfactory supported-apis Show APIs with auto-setup
Architecture
User Prompt
โ
โโโบ Interactive Refinement (follow-up questions if vague)
โ
โโโบ LLM Prompt Analyzer (Ollama/OpenAI/Claude)
โ โ
โ โโโบ Keyword Fallback (offline)
โ
โโโบ API Detector (11 APIs with auth info)
โ
โโโบ Template Matcher (8 templates)
โ
โโโบ Code Generator
โ โโโบ Pre-built API tools (GitHub, Slack, Stripe, Notion, Discord)
โ โโโบ LLM tool generation
โ โโโบ Template-based generation
โ
โโโบ Validator (syntax + structure checks)
โ
โโโบ LLM Code Reviewer (quality, security, MCP compliance)
โ
โโโบ Local Storage (SQLite)
Development
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Lint
ruff check .
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prompt2mcp-0.3.1.tar.gz.
File metadata
- Download URL: prompt2mcp-0.3.1.tar.gz
- Upload date:
- Size: 91.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70086a7fb39321a04a226d0c0cab85ed4f67ea3b699531a812bc7adfaad16df5
|
|
| MD5 |
25b6c2f088822936a88d6176e8e57a17
|
|
| BLAKE2b-256 |
8177d5c1d1eb222666c61f5e763d192a1d74d8ac9683f33a4b549acb3de532ba
|
File details
Details for the file prompt2mcp-0.3.1-py3-none-any.whl.
File metadata
- Download URL: prompt2mcp-0.3.1-py3-none-any.whl
- Upload date:
- Size: 95.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a3c4bb545053ac0cd74391d4e178458d3a0961aa1289051c98ec402e789d40d
|
|
| MD5 |
2ce494d280de9941a647d73d8707b094
|
|
| BLAKE2b-256 |
5aad0815e12019025f35635344afa7ece75fd62b2748e00ee819061731f860fb
|