Enhancement Request
The current MCP server template only includes a basic "hello" tool example. Adding more comprehensive examples would help users understand MCP patterns better.
Suggested Examples to Add
1. File Handling Tool
@mcp.tool()
async def read_file(path: str) -> str:
"""Read contents of a file with proper error handling."""
# Example implementation
2. API Integration Tool
@mcp.tool()
async def fetch_data(url: str, headers: Optional[Dict] = None) -> Dict:
"""Fetch data from an API endpoint."""
# Example with aiohttp or httpx
3. Authentication Management
@mcp.tool()
async def verify_token(token: str) -> bool:
"""Verify authentication token."""
# Example token validation
4. Database Operations
@mcp.tool()
async def query_database(query: str, params: Optional[List] = None) -> List[Dict]:
"""Execute database query with parameterized inputs."""
# Example with SQLAlchemy or asyncpg
5. Data Processing
@mcp.tool()
async def process_json(data: Dict, schema: Optional[Dict] = None) -> Dict:
"""Process and validate JSON data."""
# Example with pydantic or marshmallow
Benefits
- Faster onboarding for new users
- Best practices demonstration
- Common patterns readily available
- Reduced development time
Implementation Suggestions
- Create a
tools/examples/ directory in the template
- Include well-commented example files
- Add a README explaining each example
- Include tests for each example tool
Documentation
Each example should include:
- Clear docstrings
- Input/output types
- Error handling
- Usage examples
- Common pitfalls to avoid
Enhancement Request
The current MCP server template only includes a basic "hello" tool example. Adding more comprehensive examples would help users understand MCP patterns better.
Suggested Examples to Add
1. File Handling Tool
2. API Integration Tool
3. Authentication Management
4. Database Operations
5. Data Processing
Benefits
Implementation Suggestions
tools/examples/directory in the templateDocumentation
Each example should include: