MCP ExplorerExplorer

Modelctx

@ModelContextKiton 11 days ago
4Β MIT
FreeCommunity
AI Systems
A comprehensive CLI tool for rapidly creating, configuring, and deploying Model Context Protocol (MCP) servers

Overview

What is Modelctx

Modelctx is a comprehensive CLI tool designed for rapidly creating, configuring, and deploying Model Context Protocol (MCP) servers, facilitating seamless integration of AI applications with external tools and data sources.

Use cases

Use cases include creating production-ready MCP servers for AI applications, integrating AI with databases and APIs, developing automated workflows, and enhancing data accessibility for AI models.

How to use

To use modelctx, install it via pip and utilize the interactive wizard for guided setup. You can also use command line commands to list available backends and create specific MCP servers.

Key features

Key features include quick setup, support for multiple backends (databases, APIs, filesystems, etc.), an interactive wizard for configuration, comprehensive templates, built-in security, testing readiness, auto documentation generation, and integration with Claude Desktop.

Where to use

Modelctx can be used in various fields such as AI development, data integration, application development, and any scenario requiring standardized connections between AI models and external systems.

Content

ModelContextKit

πŸš€ A comprehensive CLI tool for rapidly creating, configuring, and deploying Model Context Protocol (MCP) servers

Python
License
Website

🌐 Visit our website: modelcontextkit.com

What is MCP?

The Model Context Protocol (MCP) is an open standard developed by Anthropic that enables AI applications (like Claude) to connect with external tools, data sources, and APIs in a standardized way. Think of it as β€œUSB-C for AI applications” - it provides a universal connector between AI models and external systems.

Features

✨ Quick Setup: Generate production-ready MCP servers in minutes, not hours
πŸ”§ Multiple Backends: Support for databases, APIs, filesystems, web scrapers, email, and cloud storage
🎯 Interactive Wizard: Guided setup with intelligent configuration prompts
πŸ“š Comprehensive Templates: Pre-built templates following MCP best practices
πŸ”’ Security First: Built-in security features and input validation
πŸ§ͺ Testing Ready: Generated projects include test suites and examples
πŸ“– Auto Documentation: Comprehensive documentation generation
🎨 Claude Desktop Integration: Automatic configuration for Claude Desktop
βœ… Production Ready: Generates syntactically correct, tested code that works out of the box

Recent Improvements

πŸ”§ Fixed Code Generation: Resolved indentation and syntax issues in generated MCP servers
πŸ“‹ Corrected MCP Schema: Updated to use proper input_schema format
πŸ§ͺ Improved Tests: Updated test templates to use modern MCP patterns
πŸ”— Fixed Resource URIs: Simplified resource implementations to avoid template issues
✨ Enhanced Reliability: All backend types now generate working, compilable code

Installation

# Install base package
pip install modelcontextkit

# Install with specific backend support
pip install modelcontextkit[database]
pip install modelcontextkit[api]
pip install modelcontextkit[filesystem]
pip install modelcontextkit[webscraper]
pip install modelcontextkit[email]
pip install modelcontextkit[cloudstorage]

# Install with all backends
pip install modelcontextkit[all]

Quick Start

Interactive Wizard (Recommended)

modelctx wizard

Command Line Interface

# List available backend types
modelctx list

# Create a database MCP server
modelctx create my-db-server --backend database

# Create an API integration server
modelctx create my-api-server --backend api

# View templates
modelctx templates

Supported Backends

πŸ—„οΈ Database Backend

Connect to SQL databases (PostgreSQL, MySQL, SQLite) with built-in connection pooling and security.

Generated Tools:

  • execute_query(query: str) - Execute SQL queries safely
  • get_table_schema(table_name: str) - Get table structure
  • list_tables() - List all tables

Configuration:

  • Database connection parameters
  • Connection pooling settings
  • Query timeout and limits

🌐 REST API Backend

Integrate with REST APIs with authentication, rate limiting, and error handling.

Generated Tools:

  • api_request(endpoint: str, method: str, data: dict) - Make HTTP requests
  • get_api_status() - Check API health

Authentication Support:

  • Bearer tokens
  • API keys
  • OAuth2 flows

πŸ“ Filesystem Backend

Access and manipulate local files and directories with security controls.

Generated Tools:

  • read_file(file_path: str) - Read file contents
  • write_file(file_path: str, content: str) - Write to files
  • list_directory(dir_path: str) - List directory contents
  • search_files(pattern: str, directory: str) - Search for files

πŸ•·οΈ Web Scraper Backend

Scrape and parse web content with respect for robots.txt and rate limiting.

Generated Tools:

  • scrape_url(url: str) - Extract content from web pages
  • extract_links(url: str) - Get all links from a page
  • take_screenshot(url: str) - Capture page screenshots

πŸ“§ Email Backend

Send and receive emails via SMTP/IMAP with support for attachments.

Generated Tools:

  • send_email(to: str, subject: str, body: str) - Send emails
  • list_emails(folder: str, limit: int) - List emails from folder
  • read_email(email_id: str) - Read specific email

☁️ Cloud Storage Backend

Connect to cloud storage services (AWS S3, Google Cloud Storage, Azure Blob).

Generated Tools:

  • upload_file(local_path: str, remote_key: str) - Upload files
  • download_file(remote_key: str, local_path: str) - Download files
  • list_objects(prefix: str) - List stored objects
  • delete_object(key: str) - Delete objects

Generated Project Structure

my-mcp-server/
β”œβ”€β”€ server.py                 # Main MCP server file
β”œβ”€β”€ requirements.txt          # Python dependencies
β”œβ”€β”€ pyproject.toml           # Python project metadata
β”œβ”€β”€ README.md                # Project documentation
β”œβ”€β”€ .env.template            # Environment variables template
β”œβ”€β”€ .gitignore              # Git ignore rules
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ config.yaml         # Main configuration file
β”‚   β”œβ”€β”€ claude_desktop_config.json  # Claude Desktop integration
β”‚   └── logging.yaml        # Logging configuration
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ models/             # Data models
β”‚   β”œβ”€β”€ services/           # Business logic
β”‚   └── utils/              # Utility functions
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ test_server.py      # Server tests
β”‚   └── test_tools.py       # Tool-specific tests
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ API.md              # API documentation
β”‚   └── DEPLOYMENT.md       # Deployment guide
└── scripts/
    β”œβ”€β”€ setup.sh            # Setup script
    └── deploy.sh           # Deployment script

Configuration

The tool supports flexible configuration through:

  • Interactive prompts during wizard mode
  • Configuration files (YAML/JSON)
  • Environment variables for sensitive data
  • Command-line arguments for automation

Example configuration:

# config/config.yaml
server:
  name: "my-api-server"
  description: "API integration MCP server"
  
backend:
  type: "api"
  base_url: "https://api.example.com"
  auth_type: "bearer"
  rate_limit: 60
  
security:
  validate_inputs: true
  log_requests: true
  timeout: 30

Claude Desktop Integration

Generated servers automatically include configuration for Claude Desktop:

{
  "mcpServers": {
    "my-mcp-server": {
      "command": "python",
      "args": [
        "/path/to/my-mcp-server/server.py"
      ],
      "env": {
        "API_KEY": "your-api-key",
        "DATABASE_URL": "your-db-connection"
      }
    }
  }
}

Development and Testing

Each generated project includes:

  • Unit tests with pytest
  • Syntax validation - all generated code is syntactically correct
  • MCP Inspector integration for testing
  • Comprehensive test suites for all tools and resources
  • Configuration validation and error handling
# Navigate to your generated project
cd my-mcp-server

# Install dependencies (if not done during creation)
pip install -r requirements.txt

# Validate the generated code syntax
python -c "import server; print('Server syntax OK')"

# Run the test suite
python -m pytest tests/ -v

# Test with MCP Inspector
npx @modelcontextprotocol/inspector python server.py

# Run the server directly
python server.py

Security Features

  • πŸ”’ Input validation and sanitization
  • πŸ›‘οΈ Access controls and permission systems
  • πŸ“ Audit logging for all operations
  • πŸ” Secure credential management
  • 🚫 SQL injection prevention
  • 🌐 CORS and rate limiting

Quality Assurance

ModelContextKit generates high-quality, production-ready code:

  • βœ… Syntax Validation: All generated Python code passes syntax validation
  • βœ… MCP Compliance: Generated servers follow MCP protocol specifications
  • βœ… Type Safety: Proper type hints and schema definitions
  • βœ… Error Handling: Comprehensive exception handling and logging
  • βœ… Test Coverage: Generated test suites validate all functionality
  • βœ… Documentation: Auto-generated documentation and examples

CLI Reference

# Create new MCP server
modelctx create <project-name> --backend <type> [options]

# Interactive wizard
modelctx wizard

# List available backends
modelctx list

# Manage templates
modelctx templates [list|add|remove]

# Generate documentation
modelctx docs <project-path>

# Deploy server (if configured)
modelctx deploy <project-name>

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support


Made with ❀️ for the MCP community

Tools

No tools

Comments