Turn existing projects into MCP servers
Project description
MCPify - Export all projects as MCP servers!
MCPify is a powerful tool that automatically detects APIs in existing projects and transforms them into Model Context Protocol (MCP) servers. This enables seamless integration of your existing command-line tools, web APIs, and applications with AI assistants and other MCP-compatible clients.
๐ Features
- Intelligent API Detection: Multiple advanced detection strategies
- ๐ค OpenAI Detection: Use GPT-4 for intelligent API analysis and tool extraction
- ๐ช Camel-AI Detection: Leverage Camel-AI's ChatAgent framework for comprehensive analysis
- ๐ AST Detection: Static code analysis using Abstract Syntax Trees
- ๐ฏ Auto-Selection: Automatically choose the best available detection strategy
- Multiple Project Types: Support for various project architectures
- CLI Tools: Detect argparse, click, typer-based command-line interfaces
- Web APIs: Support for Flask, Django, and FastAPI applications with route detection
- Interactive Commands: Identify command-based interactive applications
- Python Modules: Extract callable functions and methods
- Flexible MCP Server: Multiple ways to start and control MCP servers
- Multiple Backend Support: Works with command-line tools, HTTP APIs, Python modules, and more
- Configuration Validation: Built-in validation system to ensure correct configurations
- Parameter Detection: Automatically extract route parameters, query parameters, and CLI arguments
- Zero Code Changes: Transform existing projects without modifying their source code
- Professional Architecture: Clean separation between detection, configuration, and server execution
๐จ Interactive UI Features
MCPify now includes a powerful Streamlit-based web interface that makes repository analysis and MCP server configuration generation intuitive and interactive!
๐ Launch the UI
# Install UI dependencies
pip install 'mcpify[ui]'
# Start the interactive web interface
python -m mcpify.ui
# Or use the convenience function
python -c "from mcpify.ui import start_ui; start_ui()"
Then navigate to http://localhost:8501 in your browser.
โจ Key UI Features
๐ Repository Analyzer
- GitIngest-style Interface: Clean, intuitive repository input with drag-and-drop support
- Smart Examples: Pre-configured example repositories to try instantly
- Advanced Options: Configurable exclude patterns, file size limits, and detection strategies
- Real-time Progress: Visual progress indicators for each analysis phase
- Multiple Input Types: Support for GitHub URLs, local directories, and Git repositories
๐ค AI-Powered Chat Interface (Coming Soon)
- Conversational API Discovery: Describe what you need in natural language
- Smart Recommendations: AI suggests relevant APIs and tools based on your requirements
- Interactive Configuration: Build MCP configurations through guided conversations
- Context-Aware Suggestions: Leverages repository analysis for targeted recommendations
๐ Intelligent Analysis Workflow
The UI provides a 5-phase intelligent workflow:
- ๐ Input Phase: Repository selection with examples and advanced options
- ๐ Analysis Phase: GitIngest processing with real-time progress tracking
- ๐ฌ Chat Phase: AI-powered conversation to understand your needs
- ๐ฏ Confirmation Phase: Review and confirm detected APIs and tools
- โ Complete Phase: Download configurations and get deployment instructions
๐๏ธ Advanced Features
- Session Management: Save and restore analysis sessions
- Configuration Validation: Real-time validation with detailed error reporting
- Export Options: Download configurations in multiple formats
- Server Testing: Built-in MCP server testing and validation
- History Tracking: Keep track of all your analysis sessions
๐ฅ๏ธ UI Screenshots & Workflow
Repository Input Interface
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โจ MCPify โจ โ
โ Turn repositories into MCP servers โ
โ โ
โ ๐ Repository Input โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ https://github.com/user/repo โ โ ๐ Analyzeโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ โ
โ โ
โ โ๏ธ Advanced Options โ
โ โข Exclude patterns: *.md, __pycache__/, *.pyc โ
โ โข Max file size: 50 KB โ
โ โข Detection strategy: auto โ
โ โ
โ ๐ก Try these examples: โ
โ [FastAPI Todo] [Flask Example] [CLI Tool] [API Client]โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Analysis Progress Tracking
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Analysis Progress โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ 80% โ
โ โ
โ Validating Configuration โ
โ Checking configuration validity... โ
โ โ
โ โ
GitIngest โ
Detect APIs ๐ Validate โณ Complete โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Results Dashboard
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
Analysis Complete โ
โ โ
โ ๐ Repository: my-fastapi-app ๐๏ธ Files: 45 โ
โ ๐ Language: Python โก Framework: FastAPI โ
โ โฑ๏ธ Time: 12.3s ๐ Analyzed: 32 โ
โ โ
โ ๐ Summary | โ๏ธ Configuration | ๐ Validation | ๐ Codeโ
โ โ
โ ๐ Generated 8 API tools with FastAPI backend โ
โ ๐ฅ Download Configuration โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ UI Usage Examples
Quick Repository Analysis
# Start the UI
python -m mcpify.ui
# In the browser:
# 1. Enter: https://github.com/tiangolo/fastapi
# 2. Click "๐ Analyze"
# 3. Wait for analysis completion
# 4. Download the generated configuration
Advanced Configuration
# Start UI with custom settings
python -m mcpify.ui
# Configure advanced options:
# โข Exclude patterns: "*.md, tests/, docs/"
# โข Max file size: 100 KB
# โข Detection strategy: openai
# โข Include private repos: Yes
๐ง UI Configuration
The UI can be customized through environment variables:
# Custom port
export STREAMLIT_SERVER_PORT=8502
python -m mcpify.ui
# Custom host
export STREAMLIT_SERVER_ADDRESS=0.0.0.0
python -m mcpify.ui
# Enable debug mode
export STREAMLIT_LOGGER_LEVEL=debug
python -m mcpify.ui
๐จ UI Architecture
mcpify/ui/
โโโ __init__.py # UI module exports
โโโ main.py # UI entry point
โโโ app.py # Main Streamlit application
โโโ models.py # Data models for UI
โโโ session_manager.py # Session and history management
โโโ components/ # Reusable UI components
โ โโโ __init__.py
โ โโโ chat_interface.py # AI chat components
โ โโโ sidebar.py # Navigation sidebar
โ โโโ detection_results.py # Results display
โโโ pages/ # Individual page implementations
โโโ __init__.py
โโโ repository_analyzer.py # Main analyzer page
๐ UI Development
Want to contribute to the UI? Here's how to get started:
# Install UI development dependencies
pip install 'mcpify[ui,dev]'
# Run the UI in development mode
streamlit run mcpify/ui/app.py --server.runOnSave true
# Run UI tests
python -m pytest tests/test_ui_*.py -v
๐ฆ Installation
Using pip (recommended)
pip install mcpify
From source
git clone https://github.com/your-username/mcpify.git
cd mcpify
pip install -e .
Optional Dependencies
For enhanced detection capabilities:
# For OpenAI-powered detection
pip install openai
export OPENAI_API_KEY="your-api-key"
# For Camel-AI powered detection
pip install camel-ai
๐๏ธ Project Architecture
mcpify/
โโโ mcpify/ # Core package
โ โโโ cli.py # CLI interface with detection commands
โ โโโ __main__.py # Module entry point
โ โโโ wrapper.py # MCP protocol wrapper
โ โโโ backend.py # Backend adapters
โ โโโ detect/ # Detection module
โ โ โโโ __init__.py # Module exports
โ โ โโโ base.py # Base detector class
โ โ โโโ ast.py # AST-based detection
โ โ โโโ openai.py # OpenAI-powered detection
โ โ โโโ camel.py # Camel-AI detection
โ โ โโโ factory.py # Detector factory
โ โ โโโ types.py # Type definitions
โ โโโ validate.py # Configuration validation
โโโ examples/ # Example projects
โโโ docs/ # Documentation
โโโ tests/ # Test suite
๐ ๏ธ Quick Start
1. Intelligent API Detection
MCPify offers multiple detection strategies. Use the best one for your needs:
# Auto-detection (recommended): Automatically selects the best available strategy
mcpify detect /path/to/your/project --output config.json
# OpenAI-powered detection: Most intelligent, requires API key
mcpify openai-detect /path/to/your/project --output config.json
# Camel-AI detection: Advanced agent-based analysis
mcpify camel-detect /path/to/your/project --output config.json
# AST detection: Fast, no API key required
mcpify ast-detect /path/to/your/project --output config.json
2. View and validate the configuration
mcpify view config.json
mcpify validate config.json
3. Start the MCP server
# Method 1: Using mcpify CLI (recommended)
mcpify serve config.json
# Method 2: Direct module invocation
python -m mcpify serve config.json
# HTTP mode for web integration
mcpify serve config.json --mode streamable-http --port 8080
๐ฏ Detection Strategies
Auto-Detection (Recommended)
The auto-detect command intelligently selects the best available strategy:
mcpify detect /path/to/project
Selection Priority:
- Camel-AI (if installed) - Most comprehensive analysis
- OpenAI (if API key available) - Intelligent LLM-based detection
- AST (always available) - Reliable static analysis fallback
OpenAI Detection ๐ค
Uses GPT-4 for intelligent project analysis:
# With API key parameter
mcpify openai-detect /path/to/project --openai-key YOUR_API_KEY
# Using environment variable
export OPENAI_API_KEY="your-api-key"
mcpify openai-detect /path/to/project
Advantages:
- Understands complex code patterns and context
- Generates detailed descriptions and parameter information
- Excellent at identifying non-obvious API endpoints
- Handles multiple programming languages
Camel-AI Detection ๐ช
Uses Camel-AI's ChatAgent framework for comprehensive analysis:
# Install camel-ai first
pip install camel-ai
# Set OpenAI API key (required by Camel-AI)
export OPENAI_API_KEY="your-api-key"
# Run detection
mcpify camel-detect /path/to/project --model-name gpt-4
Advantages:
- Advanced agent-based reasoning
- Deep project structure understanding
- Excellent for complex multi-file projects
- Sophisticated parameter extraction
AST Detection ๐
Fast, reliable static code analysis:
mcpify ast-detect /path/to/project
Advantages:
- No API key required
- Fast execution
- Reliable for standard patterns (argparse, Flask routes)
- Works offline
๐ Usage Scenarios
For Developers (API Detection & Testing)
# Detect and test your APIs with different strategies
mcpify detect my-project --output my-project.json # Auto-select best
mcpify openai-detect my-project --output my-project-ai.json # AI-powered
mcpify ast-detect my-project --output my-project-ast.json # Static analysis
# Compare results
mcpify view my-project.json
mcpify serve my-project.json
For AI-Enhanced Detection
# Use OpenAI for intelligent analysis
export OPENAI_API_KEY="your-key"
mcpify openai-detect complex-project --output smart-config.json
# Use Camel-AI for advanced agent analysis
pip install camel-ai
mcpify camel-detect complex-project --output agent-config.json
For Production Deployment
# Generate configuration with best available strategy
mcpify detect production-app --output prod-config.json
# Deploy as HTTP server
mcpify serve prod-config.json --mode streamable-http --host 0.0.0.0 --port 8080
๐ง Backend Types & Examples
FastAPI/Flask Web Applications
{
"name": "my-web-api",
"description": "Web API server",
"backend": {
"type": "fastapi",
"base_url": "http://localhost:8000"
},
"tools": [
{
"name": "get_user",
"description": "Get user information",
"endpoint": "/users/{user_id}",
"method": "GET",
"parameters": [
{
"name": "user_id",
"type": "string",
"description": "User ID"
}
]
}
]
}
Python Modules
{
"name": "my-python-tools",
"description": "Python module backend",
"backend": {
"type": "python",
"module_path": "./my_module.py"
},
"tools": [
{
"name": "calculate",
"description": "Perform calculation",
"function": "calculate",
"parameters": [
{
"name": "expression",
"type": "string",
"description": "Mathematical expression"
}
]
}
]
}
Command-Line Tools
{
"name": "my-cli-tool",
"description": "Command line tool backend",
"backend": {
"type": "commandline",
"config": {
"command": "python3",
"args": ["./my_script.py"],
"cwd": "."
}
},
"tools": [
{
"name": "process_data",
"description": "Process data with CLI tool",
"args": ["--process", "{input_file}"],
"parameters": [
{
"name": "input_file",
"type": "string",
"description": "Input file path"
}
]
}
]
}
โ๏ธ Detection Configuration
Available Detection Commands
# Auto-detection with strategy selection
mcpify detect <project_path> [--output <file>] [--openai-key <key>]
# Specific detection strategies
mcpify openai-detect <project_path> [--output <file>] [--openai-key <key>]
mcpify camel-detect <project_path> [--output <file>] [--model-name <model>]
mcpify ast-detect <project_path> [--output <file>]
# Configuration management
mcpify view <config_file> [--verbose]
mcpify validate <config_file> [--verbose]
mcpify serve <config_file> [--mode <mode>] [--host <host>] [--port <port>]
Supported Backend Types
fastapi: FastAPI web applicationsflask: Flask web applicationspython: Python modules and functionscommandline: Command-line tools and scriptsexternal: External programs and services
Server Modes
stdio: Standard input/output (default MCP mode)streamable-http: HTTP Server-Sent Events mode
Parameter Types
string,integer,number,boolean,array- Automatic type detection from source code
- Custom validation rules
- Enhanced type inference with AI detection
๐ Server Configuration
Command Line Options
# Basic usage
mcpify serve config.json
# Specify server mode
mcpify serve config.json --mode stdio # Default mode
mcpify serve config.json --mode streamable-http # HTTP mode
# Configure host and port (HTTP mode only)
mcpify serve config.json --mode streamable-http --host localhost --port 8080
mcpify serve config.json --mode streamable-http --host 0.0.0.0 --port 9999
# Real examples with provided configurations
mcpify serve examples/python-server-project/server.json
mcpify serve examples/python-server-project/server.json --mode streamable-http --port 8888
mcpify serve examples/python-cmd-tool/cmd-tool.json --mode stdio
Server Modes Explained
STDIO Mode (Default)
- Uses standard input/output for communication
- Best for local MCP clients and development
- No network configuration needed
mcpify serve config.json
# or explicitly
mcpify serve config.json --mode stdio
Streamable HTTP Mode
- Uses HTTP with Server-Sent Events
- Best for web integration and remote clients
- Requires host and port configuration
# Local development
mcpify serve config.json --mode streamable-http --port 8080
# Production deployment
mcpify serve config.json --mode streamable-http --host 0.0.0.0 --port 8080
๐ Examples
Explore the examples/ directory for ready-to-use configurations:
# Try different detection strategies on examples
mcpify detect examples/python-server-project --output server-auto.json
mcpify openai-detect examples/python-cmd-tool --output cmd-openai.json
mcpify ast-detect examples/python-server-project --output server-ast.json
# View example configurations
mcpify view examples/python-server-project/server.json
mcpify view examples/python-cmd-tool/cmd-tool.json
# Test with examples - STDIO mode (default)
mcpify serve examples/python-server-project/server.json
mcpify serve examples/python-cmd-tool/cmd-tool.json
# Test with examples - HTTP mode
mcpify serve examples/python-server-project/server.json --mode streamable-http --port 8888
mcpify serve examples/python-cmd-tool/cmd-tool.json --mode streamable-http --port 9999
๐งช Development
Running Tests
# Run all tests
python -m pytest tests/ -v
# Run with coverage
python -m pytest tests/ --cov=mcpify --cov-report=html
# Run specific tests
python -m pytest tests/test_detect.py -v
Development Setup
git clone https://github.com/your-username/mcpify.git
cd mcpify
pip install -e ".[dev]"
# Install optional dependencies for full functionality
pip install openai camel-ai
python -m pytest tests/ -v
Available Commands
MCPify CLI Commands
# Detection commands
mcpify detect <project_path> [--output <file>] [--openai-key <key>]
mcpify openai-detect <project_path> [--output <file>] [--openai-key <key>]
mcpify camel-detect <project_path> [--output <file>] [--model-name <model>]
mcpify ast-detect <project_path> [--output <file>]
# Configuration commands
mcpify view <config_file> [--verbose]
mcpify validate <config_file> [--verbose]
# Server commands
mcpify serve <config_file> [--mode <mode>] [--host <host>] [--port <port>]
๐ Deployment Options
1. Package Installation
pip install mcpify
# Use mcpify serve for all scenarios
2. Module Invocation
# Run as Python module
python -m mcpify serve config.json
python -m mcpify serve config.json --mode streamable-http --port 8080
3. Docker Deployment
FROM python:3.10-slim
COPY . /app
WORKDIR /app
RUN pip install .
# Optional: Install AI detection dependencies
# RUN pip install openai camel-ai
CMD ["mcpify", "serve", "config.json", "--mode", "streamable-http", "--host", "0.0.0.0", "--port", "8080"]
4. Production HTTP Server
# Start HTTP server for production
mcpify serve config.json --mode streamable-http --host 0.0.0.0 --port 8080
# With custom configuration
mcpify serve config.json --mode streamable-http --host 127.0.0.1 --port 9999
๐ค Contributing
We welcome contributions! Please see our development setup above and:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
Code Quality
# Linting and formatting
ruff check mcpify/
ruff format mcpify/
# Type checking
mypy mcpify/
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Related Projects
- Model Context Protocol - The protocol specification
- MCP Python SDK - Official Python implementation
- OpenAI API - For AI-powered detection
- Camel-AI - Multi-agent framework for advanced detection
๐ Support
- Documentation: See
docs/usage.mdfor detailed usage instructions - Examples: Check the
examples/directory for configuration templates - Issues: GitHub Issues
- Discussions: GitHub Discussions
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 iflow_mcp_camel_ai_mcpify-0.1.4.tar.gz.
File metadata
- Download URL: iflow_mcp_camel_ai_mcpify-0.1.4.tar.gz
- Upload date:
- Size: 64.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfb1d2a9e9d6a30731525b2256ee3560f28fbcafa3adbcaca9a375531a085bd4
|
|
| MD5 |
fc8796a674bf4feb37dbb77b8db89126
|
|
| BLAKE2b-256 |
49b62ebbbe9993e32ccf0f716340b74fb71511cde81635ce27555d2649620861
|
File details
Details for the file iflow_mcp_camel_ai_mcpify-0.1.4-py3-none-any.whl.
File metadata
- Download URL: iflow_mcp_camel_ai_mcpify-0.1.4-py3-none-any.whl
- Upload date:
- Size: 152.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
958d67abb3694e8ff3ec713629e0cea87494920c7986f7701e40e51a1638a6d1
|
|
| MD5 |
b0f205e7020267f39d6acb81120553e6
|
|
| BLAKE2b-256 |
33fdd4e2ecce50ab7fc715c74a05e2993f0dd726370e31c0b93c9ff17c368a5a
|