- MCP Servers Template
MCP Servers Template
MCP Servers Template
This repository provides a template for setting up Model Context Protocol (MCP) servers for local development. It includes examples of different MCP server implementations:
- Weather API - Provides weather alerts and forecasts
- Calculator - Basic and advanced mathematical operations
- Notes - Simple note-taking functionality with local file storage
Note: This project requires Python 3.10 or higher. See footnotes for instructions on using the correct Python version.
Project Structure
├── servers/ # MCP server implementations
│ ├── calculator.py # Calculator server implementation
│ ├── notes.py # Notes server implementation
│ └── weather.py # Weather API server implementation
├── docs/ # Documentation for the servers
├── requirements.txt # Python dependencies
└── README.md # This file
Requirements
- Python 3.10+
- FastMCP library
- Other dependencies as listed in
requirements.txt - UV package manager (recommended for faster installations)
Setup
-
Clone the repository:
git clone <repository-url> cd mcp-server-templates -
Set up a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install UV package manager (if not already installed):
pip install uv -
Install dependencies with UV:
uv pip install -r requirements.txt
Usage
Running the MCP Servers
Each MCP server can be run using the MCP dev server command:
Weather API Server
mcp dev servers/weather.py
The Weather API provides the following tools:
get_alerts: Get weather alerts for a US stateget_forecast: Get weather forecast for a location based on latitude and longitude
Calculator Server
mcp dev servers/calculator.py
The Calculator provides mathematical operations including:
- Basic operations: add, subtract, multiply, divide
- Advanced operations: power, sqrt, cbrt, factorial, log, etc.
- Trigonometric functions: sin, cos, tan
Notes Server
mcp dev servers/notes.py
The Notes server provides note management functionality including:
add_note: Create a new note with title and contentlist_notes: Get all saved notesget_note: Retrieve a specific note by IDdelete_note: Remove a note by IDsearch_notes: Find notes containing a specific keywordupdate_note: Modify an existing note's title or content
VS Code Integration
These MCP servers can be integrated with Visual Studio Code for use with AI assistants. Configure your settings.json to include:
{
"mcp": {
"servers": {
"weather": {
"command": "bash",
"args": [
"-c",
"source {AbsolutePathToTheFolder}/venv/bin/activate && uv --directory {AbsolutePathToTheFolder} run servers/weather.py"
]
},
"calculator": {
"command": "bash",
"args": [
"-c",
"source {AbsolutePathToTheFolder}/venv/bin/activate && uv --directory {AbsolutePathToTheFolder} run servers/calculator.py"
]
},
"notes": {
"command": "bash",
"args": [
"-c",
"source {AbsolutePathToTheFolder}/venv/bin/activate && uv --directory {AbsolutePathToTheFolder} run servers/notes.py"
]
}
}
}
}
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Footnotes
Using Python 3.10+
-
Check your Python version:
python --version -
Install Python 3.10 or higher if needed:
- macOS (using Homebrew):
brew install python@3.10 - Linux:
sudo apt-get update sudo apt-get install python3.10 - Windows: Download installer from python.org
- macOS (using Homebrew):
-
Use pyenv for managing multiple Python versions (recommended):
# Install pyenv brew install pyenv # macOS # Install Python version pyenv install 3.10.0 # Set local Python version pyenv local 3.10.0 -
Using UV with pyenv:
# After setting up pyenv and activating your environment pip install uv uv pip install -r requirements.txt