python-mcp-server-generator

Solid

Generate a complete MCP server project in Python with tools, resources, and proper configuration

AI & Automation 34,233 stars 4188 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Generate Python MCP Server Create a complete Model Context Protocol (MCP) server in Python with the following specifications: ## Requirements 1. **Project Structure**: Create a new Python project with proper structure using uv 2. **Dependencies**: Include mcp[cli] package with uv 3. **Transport Type**: Choose between stdio (for local) or streamable-http (for remote) 4. **Tools**: Create at least one useful tool with proper type hints 5. **Error Handling**: Include comprehensive error handling and validation ## Implementation Details ### Project Setup - Initialize with `uv init project-name` - Add MCP SDK: `uv add "mcp[cli]"` - Create main server file (e.g., `server.py`) - Add `.gitignore` for Python projects - Configure for direct execution with `if __name__ == "__main__"` ### Server Configuration - Use `FastMCP` class from `mcp.server.fastmcp` - Set server name and optional instructions - Choose transport: stdio (default) or streamable-http - For HTTP: optionally configure host, port, and stateless mode ### Tool Implementation - Use `@mcp.tool()` decorator on functions - Always include type hints - they generate schemas automatically - Write clear docstrings - they become tool descriptions - Use Pydantic models or TypedDicts for structured outputs - Support async operations for I/O-bound tasks - Include proper error handling ### Resource/Prompt Setup (Optional) - Add resources with `@mcp.resource()` decorator - Use URI templates for dynamic resources: `"resource://...

Details

Author
github
Repository
github/awesome-copilot
Created
11 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category