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 mcp-factory

Or install from source:

git clone https://github.com/jatin/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.1.0.tar.gz (76.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.1.0-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

File details

Details for the file prompt2mcp-0.1.0.tar.gz.

File metadata

  • Download URL: prompt2mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 76.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.1.0.tar.gz
Algorithm Hash digest
SHA256 442d49987e992f200eedcdcd1121b0b4048ccfc7646eb1ea5a0097719c93eeff
MD5 6e8bb67824d85c9e56d03c942efd0d4b
BLAKE2b-256 b370ddab26c04c13edeb7f30414226c9fe9b22ff24ab34a17de769fde8fc716e

See more details on using hashes here.

File details

Details for the file prompt2mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: prompt2mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 75.0 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28b396f2a827e09b77cc5cd2575a9769c16f82ef9bbc23148772c029d50f9288
MD5 e1412c38654e7c4ba8a4cca2273de6b2
BLAKE2b-256 838c690a7e5bd59b7bc777581d713f94ac0288e5eeb3015b6a9c63710767e59b

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