Skip to main content

Build MCP servers from natural language prompts โ€” local-first, privacy-focused

Project description

MCP Factory ๐Ÿญ

PyPI version Python 3.10+ License: MIT

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:

  1. LLM Prompt Analysis โ€” Understands your intent using Ollama (local) or OpenAI/Claude (cloud)
  2. API-Specific Tool Generation โ€” Pre-built tool implementations for 5 APIs (GitHub, Slack, Stripe, Notion, Discord)
  3. LLM Code Review โ€” Auto-reviews generated code for quality, security, and MCP compliance
  4. Interactive Mode โ€” Asks follow-up questions for vague prompts to generate better servers
  5. 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 variables
  • SETUP.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 โœ…
Google 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() / Pydantic Field(description=...) on every parameter
  • Actionable errors โ€” Errors include what went wrong + what to do next
  • Pagination โ€” List operations support cursor/maxResults parameters
  • 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

MIT

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

prompt2mcp-0.3.1.tar.gz (91.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prompt2mcp-0.3.1-py3-none-any.whl (95.6 kB view details)

Uploaded Python 3

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

Hashes for prompt2mcp-0.3.1.tar.gz
Algorithm Hash digest
SHA256 70086a7fb39321a04a226d0c0cab85ed4f67ea3b699531a812bc7adfaad16df5
MD5 25b6c2f088822936a88d6176e8e57a17
BLAKE2b-256 8177d5c1d1eb222666c61f5e763d192a1d74d8ac9683f33a4b549acb3de532ba

See more details on using hashes here.

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

Hashes for prompt2mcp-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a3c4bb545053ac0cd74391d4e178458d3a0961aa1289051c98ec402e789d40d
MD5 2ce494d280de9941a647d73d8707b094
BLAKE2b-256 5aad0815e12019025f35635344afa7ece75fd62b2748e00ee819061731f860fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page