MCP Server Generator
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server Generator Generate a server with a tool that fetches weather data"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server Generator
A meta-generator for creating dual-mode MCP servers with best practices
Overview
Generate complete, production-ready MCP (Model Context Protocol) servers that work in two modes:
MCP Server Mode: For AI agents (Claude Desktop, etc.)
CLI Mode: For developers
This tool is itself an MCP server, enabling AI agents to generate other MCP servers! It demonstrates the dual-mode architecture pattern it creates and implements progressive disclosure for context-efficient tool discovery.
Related MCP server: Gravitas-Core-MCP
Why Use This?
ā” Fast: Generate a complete MCP server in under 5 minutes
šļø Complete: Includes tests, documentation, packaging, and CI/CD
ā Tested: Generated servers have comprehensive test suites with high coverage
šÆ Best Practices: Follows validated patterns from production MCP servers with built-in guidance
š§ Dual-Mode: Works as both MCP server and CLI tool
š§ Smart Discovery: Progressive disclosure tools for context-efficient AI agent usage
š¦ Ready to Publish: GitHub Actions workflows included for PyPI publishing
Features
ā Dual-mode architecture (MCP + CLI)
ā Progressive disclosure tools (context-efficient tool discovery for AI agents)
ā Built-in guidance (best practices and implementation guides)
ā Claude Code integration (generate slash commands for guided development)
ā Async/await support (async handlers for I/O operations, avoids event loop errors)
ā Package prefix support (avoid PyPI namespace conflicts with AUTO detection)
ā Complete project scaffolding (tests, docs, packaging)
ā GitHub Actions workflows (via pypi-workflow-generator)
ā Comprehensive test suite (92+ tests with high coverage)
ā Type hints and documentation
ā Best practices enforcement
ā Minimal dependencies
Installation
For MCP Server Usage (Recommended)
Using uvx (no installation required):
The easiest way to use this as an MCP server - just configure in Claude Desktop:
{
"mcpServers": {
"mcp-server-generator": {
"command": "uvx",
"args": ["hitoshura25-mcp-server-generator"]
}
}
}Prerequisites: Install uv:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"For CLI Usage (Alternative)
Using pipx (isolated installation):
pipx install hitoshura25-mcp-server-generatorUsing pip:
pip install hitoshura25-mcp-server-generatorFrom Source (Development)
git clone https://github.com/hitoshura25/mcp-server-generator.git
cd mcp-server-generator
pip install -e .Quick Start
Interactive Mode (Recommended)
The easiest way to get started:
hitoshura25-mcp-server-generator-cli --interactiveThis will guide you through:
Project naming
Author information
Tool definitions
Configuration options
Command-Line Mode
For automation or when you have a tool definition file:
hitoshura25-mcp-server-generator-cli \
--project-name my-mcp-tool \
--description "Does something useful" \
--author "Your Name" \
--email "you@example.com" \
--tools-file tools.jsonMCP Server Mode (For AI Agents)
Configure mcp-server-generator as an MCP server in Claude Desktop to let Claude generate MCP servers for you:
Using uvx (recommended):
{
"mcpServers": {
"mcp-server-generator": {
"command": "uvx",
"args": ["hitoshura25-mcp-server-generator"]
}
}
}Using pipx/pip installation:
{
"mcpServers": {
"mcp-server-generator": {
"command": "hitoshura25-mcp-server-generator"
}
}
}For detailed MCP configuration, see MCP-USAGE.md
MCP Server Tools
When used as an MCP server (in Claude Desktop or other MCP clients), mcp-server-generator provides powerful tools with progressive disclosure support - allowing AI agents to discover and use tools efficiently without loading all schemas upfront.
Discovery Tools
search_tools - Find relevant tools by query
Search by keywords, categories, or use cases
Three detail levels for context efficiency:
name: Just tool names (most efficient)summary: Names + descriptions + categoriesfull: Complete information including use cases
Example:
search_tools(query="generate", detail_level="summary")
get_tool_info - Get detailed information about a specific tool
Two detail levels:
summaryorfullProgressive disclosure for context efficiency
Example:
get_tool_info(tool_name="generate_mcp_server", detail_level="full")
Generation Tools
generate_mcp_server - Generate complete MCP server projects
Creates dual-mode architecture (MCP + CLI)
Includes tests, documentation, and CI/CD workflows
Production-ready scaffolding with best practices
Supports async/await patterns
generate_claude_command - Create Claude Code command files
Generates
.claude/commands/directory structureCreates slash commands for guided MCP development
Templates for common workflows:
mcp_generator,best_practices,implementation_helper,customEnables guided development experience
Validation Tools
validate_project_name - Validate project names
Check Python package compatibility
Avoid Python keyword conflicts
Ensure PyPI naming conventions
Guidance Tools
get_best_practices - MCP development best practices
Progressive disclosure strategies
Context-efficient tool design
Control flow optimization
Security and privacy considerations
State management patterns
Testing strategies
get_implementation_guide - Step-by-step implementation guide
Project setup and initialization
Tool implementation patterns
Testing strategies
Deployment and publishing
Claude Desktop integration
Why Progressive Disclosure?
Progressive disclosure allows AI agents to:
Discover tools without loading full schemas upfront
Save context window space for actual work
Scale to hundreds or thousands of tools
Get exactly the level of detail needed
Example workflow (MCP tool invocations):
# 1. Search for relevant tools
search_tools(query="generate", detail_level="name")
# Returns: ["generate_mcp_server", "generate_claude_command"]
# 2. Get summary of specific tool
get_tool_info(tool_name="generate_mcp_server", detail_level="summary")
# Returns: name, description, category
# 3. Get full details when ready to use
get_tool_info(tool_name="generate_mcp_server", detail_level="full")
# Returns: complete information including use cases and parametersPackage Prefix
To avoid namespace conflicts on PyPI, mcp-server-generator supports prefixing package names. This is highly recommended for unique package names.
Prefix Modes
AUTO (Recommended)
Automatically detects your GitHub username from git config
Priority:
github.userā remote URL āuser.name(sanitized)Example:
my-toolāusername-my-tool
Custom Prefix
Use your own prefix (organization name, brand, etc.)
Example:
--prefix acmeāacme-my-tool
NONE
No prefix applied (only if you have a truly unique name)
Example:
unique-server-nameāunique-server-name
Usage Examples
Interactive Mode:
hitoshura25-mcp-server-generator-cli --interactive
# You'll be prompted: "Prefix (default: AUTO): "
# - Press Enter for AUTO detection
# - Type "NONE" for no prefix
# - Type "acme" for custom prefixCommand-Line:
# AUTO mode (default)
hitoshura25-mcp-server-generator-cli --project-name calculator --prefix AUTO ...
# Custom prefix
hitoshura25-mcp-server-generator-cli --project-name calculator --prefix acme ...
# No prefix
hitoshura25-mcp-server-generator-cli --project-name unique-calculator --prefix NONE ...MCP Server Mode:
{
"project_name": "calculator",
"prefix": "AUTO",
...
}Generated Names
With prefix username and project my-tool:
PyPI Package:
username-my-tool(install withpip install username-my-tool)Python Import:
username_my_tool(use in code asimport username_my_tool)CLI Command:
username-my-tool(run asusername-my-tool --help)MCP Command:
mcp-username-my-tool(use in config)
For detailed MCP configuration, see MCP-USAGE.md
What Gets Generated
A complete, production-ready MCP server project:
my-mcp-tool/
āāā .gitignore
āāā README.md
āāā MCP-USAGE.md
āāā LICENSE
āāā setup.py
āāā pyproject.toml
āāā requirements.txt
āāā MANIFEST.in
āāā my_mcp_tool/
ā āāā __init__.py
ā āāā server.py # MCP server implementation
ā āāā cli.py # CLI interface
ā āāā generator.py # Business logic (TODO stubs)
ā āāā tests/
ā āāā __init__.py
ā āāā test_server.py # MCP protocol tests
ā āāā test_generator.py # Core logic tests
āāā .github/
āāā workflows/
āāā pypi-publish.yml # PyPI publishing workflowGenerated Features
ā Working MCP server with proper JSON-RPC over stdio
ā CLI interface with argparse
ā Complete test suite (MCP protocol + business logic)
ā GitHub Actions workflow for PyPI publishing
ā Comprehensive documentation (README, MCP-USAGE)
ā Proper Python packaging (setup.py, pyproject.toml)
ā TODO stubs for easy implementation
Tool Definition Format
Create a tools.json file to define your MCP server's tools:
{
"tools": [
{
"name": "my_function",
"description": "Does something useful",
"parameters": [
{
"name": "input_text",
"type": "string",
"description": "Text to process",
"required": true
},
{
"name": "max_length",
"type": "number",
"description": "Maximum length",
"required": false
}
]
}
]
}Supported Types
string/strnumber/int/integer/floatboolean/boolarray/listobject/dict
For complete examples, see EXAMPLES.md
Documentation
MCP-USAGE.md - Detailed MCP server configuration guide
ASYNC_GUIDE.md - Complete guide for using async/await in generated MCP servers
EXAMPLES.md - Example projects and use cases
SECURITY.md - Security guidelines and best practices
CONTRIBUTING.md - Development and contribution guidelines
Security
š Important: MCP servers can be exploited for malicious purposes if not properly secured. See SECURITY.md for comprehensive security guidelines.
Key Security Features
Generated MCP servers include:
Security utilities module (
security_utils.py) with ready-to-use functions for:Input validation and sanitization
Path traversal protection
Command injection prevention
Rate limiting to prevent high-speed automated attacks
Audit logging for security-relevant operations
Sensitive data redaction (PII, credentials, API keys)
Automated security analysis - The generator analyzes your tool definitions and warns about:
High-risk patterns (command execution, code evaluation)
Medium-risk patterns (file operations, network access, credential handling)
Recommendations for secure implementation
Comprehensive security documentation - Every generated project includes SECURITY.md with:
Threat model based on real-world AI-orchestrated cyber espionage
Secure coding patterns and examples
Security checklist for deployment
Incident response procedures
Best Practices
When creating MCP servers:
Validate all inputs - Use whitelists, not blacklists
Apply principle of least privilege - Tools should do the minimum necessary
Implement rate limiting - Protect against high-speed automated attacks
Add audit logging - Track all security-relevant operations
Redact sensitive data - Don't expose PII, credentials, or secrets
Use security utilities - Leverage the built-in
security_utils.pymodule
Threat Model
MCP servers can be targeted for:
AI-orchestrated cyber espionage campaigns
Jailbreak attempts through task decomposition
High-speed reconnaissance and exploitation
Credential harvesting through tool chaining
Data exfiltration at scale
Reference: Anthropic's research on AI-orchestrated cyber espionage
Testing
The project includes a comprehensive test suite:
# Run all tests
pytest
# Run with coverage report
pytest --cov=hitoshura25_mcp_server_generator --cov-report=term-missing
# Run specific test file
pytest hitoshura25_mcp_server_generator/tests/test_server.py -vTest Statistics:
92+ comprehensive tests covering all functionality
All async MCP protocol tests passing
Progressive disclosure and discovery tools tests passing
Template validation tests passing
Requirements
Python ā„3.8
Jinja2 ā„3.0
hitoshura25-pypi-workflow-generator ==0.6.0
Development
See CONTRIBUTING.md for detailed development instructions.
Quick setup:
# Clone the repository
git clone https://github.com/hitoshura25/mcp-server-generator.git
cd mcp-server-generator
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Install in development mode
pip install -e .
# Run tests
pytestArchitecture
mcp-server-generator follows a dual-mode architecture pattern:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā mcp-server-generator ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā āāāāāāāāāāāā āāāāāāāāāāāā ā
ā ā MCP Mode ā ā CLI Mode ā ā
ā āāāāāā¬āāāāāā āāāāāā¬āāāāāā ā
ā ā ā ā
ā āāāāāāāāāā¬āāāāāāāāā ā
ā ā ā
ā āāāāāāāā¼āāāāāāāā ā
ā ā generator.py ā ā
ā ā (Core Logic) ā ā
ā āāāāāāāāāāāāāāāā ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāBoth modes use the same core generator logic, ensuring consistency.
License
Apache-2.0
Author
Vinayak Menon
Links
PyPI: https://pypi.org/project/hitoshura25-mcp-server-generator/
Issues: https://github.com/hitoshura25/mcp-server-generator/issues
Reference Implementation: pypi-workflow-generator
Acknowledgments
This project is based on patterns validated in pypi-workflow-generator, a production MCP server for generating GitHub Actions workflows.
Progressive disclosure implementation follows best practices from:
Available Tools
7 toolsgenerate_claude_commandA
Generate Claude Code command files for guided MCP development
Creates .claude/commands/ directory with slash command files that guide users through MCP server development using this generator.
Args: command_name: Name for the command (e.g., "mcp-generate", "mcp-help") command_type: Type of command to generate: - "mcp_generator": Guide through MCP server generation workflow - "best_practices": Provide MCP best practices reference - "implementation_helper": Help implement generated MCP server - "custom": Use custom_prompt for fully custom command description: Optional description for the command (auto-generated if not provided) custom_prompt: Required if command_type is "custom" output_dir: Directory to create command file (default: .claude/commands)
Returns: JSON string with generation result
Inputs: command_name (required), command_type, description, custom_prompt, +1 more. Returns: result
generate_mcp_serverA
Generate a complete MCP server project with dual-mode architecture
This is the main generation tool. Consider using search_tools or get_tool_info first to understand the full workflow, or use the generated Claude commands for guided assistance.
Args: project_name: Project name (e.g., 'my-mcp-server') description: Project description author: Author name author_email: Author email tools: List of tools this MCP server will provide. Each tool should have: - name: Tool function name - description: What the tool does - parameters: List of parameter objects with name, type, description, required output_dir: Output directory (default: current directory) python_version: Python version for testing (default: '3.10') prefix: Package prefix - 'AUTO' (detect from git), 'NONE', or custom string (default: 'AUTO')
Returns: JSON string with generation result including success status and project path
Inputs: project_name (required), description (required), author (required), author_email (required), +4 more. Returns: result
get_best_practicesA
Get MCP server development best practices
Args: topic: Optional specific topic (e.g., "progressive_disclosure", "tool_design", "control_flow", "security", "state_management", "testing"). If None, returns all best practices.
Returns: JSON string with best practices information
Inputs: topic. Returns: result
get_implementation_guideA
Get step-by-step guide for implementing MCP servers
Args: step: Optional specific step (e.g., "setup", "implementation", "testing", "deployment", "integration"). If None, returns overview of all steps.
Returns: JSON string with implementation guide
Inputs: step. Returns: result
get_tool_infoA
Get information about a specific tool with progressive disclosure
Args: tool_name: Name of the tool to get information about detail_level: Level of detail: - "summary": Name, description, and category - "full": Complete information including use cases and full description
Returns: JSON string with tool information at requested detail level
Inputs: tool_name (required), detail_level. Returns: result
search_toolsA
Search for relevant tools by query with progressive disclosure
This tool implements the progressive disclosure pattern - allowing you to discover tools without loading full schemas upfront, saving context window space.
Args: query: Search query (matches against name, description, categories, use cases) detail_level: Level of detail to return: - "name": Just tool names (most context-efficient) - "summary": Names + descriptions + categories - "full": Complete information including use cases and detailed descriptions
Returns: JSON string with matching tools at requested detail level
Inputs: query (required), detail_level. Returns: result
validate_project_nameB
Validate a project name for Python package compatibility
Args: name: Project name to validate
Returns: JSON string with validation result
Inputs: name (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 7 tools
Each tool has a distinct purpose: generation of commands vs servers, retrieval of practices/guides, tool discovery via search/info, and project name validation. No overlapping functionality.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., generate_mcp_server, search_tools, validate_project_name), making the API predictable.
Seven tools is well-scoped for a code generator server: core generation, guidance, discovery, and validation. Not too many or too few.
The tool set covers the main workflow: generating servers, providing best practices and implementation guides, tool discovery, and validation. Missing lifecycle management (e.g., update/delete), but not essential for a generator's purpose.
Maintenance
Related MCP Connectors
A full backend your AI coding agent can set up over MCP
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceGenerates production-ready MCP servers from natural language, OpenAPI specs, database schemas, GraphQL schemas, or ontologies.49 npm1MIT
- AlicenseBqualityDmaintenanceProduction-grade, autonomous Model Context Protocol (MCP) server that elevates AI models from stateless code generators into persistent, self-verifying software engineers.211MIT
- AlicenseNot gradedqualityCmaintenanceGenerates complete, runnable MCP server projects from natural-language tool descriptions, including schema, implementation, tests, README, and license. It enables AI agents to scaffold standalone MCP servers ready to install and run.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to generate complete, runnable MCP server projects from natural-language tool descriptions, including schema, implementation, tests, README, and license.MIT