mcpField
M
MCP Servers Template

MCP Servers Template

Local
github.com/gupta-ujjwalDeveloper Tools4Updated 79w ago

About MCP Servers Template

MCP Servers Template is a Python template for developing MCP servers locally, aimed at developers who want concrete implementation examples. It includes weather, calculator, and local-file notes servers as starting points for different tool types.

Key features

  1. 01Weather alerts and forecast tools
  2. 02Basic and advanced math operations
  3. 03Local-file note management
  4. 04Three example server implementations

Use cases

  1. 01Use the weather example for location forecasts
  2. 02Build an MCP server with math operations
  3. 03Create and retrieve notes stored locally

MCP support

The template contains weather, calculator, and notes MCP server implementations, exposing weather queries, mathematical operations, and local note management tools to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

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:

  1. Weather API - Provides weather alerts and forecasts
  2. Calculator - Basic and advanced mathematical operations
  3. 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

  1. Clone the repository:

    git clone <repository-url>
    cd mcp-server-templates
    
  2. Set up a virtual environment (recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install UV package manager (if not already installed):

    pip install uv
    
  4. 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 state
  • get_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 content
  • list_notes: Get all saved notes
  • get_note: Retrieve a specific note by ID
  • delete_note: Remove a note by ID
  • search_notes: Find notes containing a specific keyword
  • update_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+

  1. Check your Python version:

    python --version
    
  2. Install Python 3.10 or higher if needed:

    • macOS (using Homebrew):
      brew install [email protected]
      
    • Linux:
      sudo apt-get update
      sudo apt-get install python3.10
      
    • Windows: Download installer from python.org
  3. 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
    
  4. Using UV with pyenv:

    # After setting up pyenv and activating your environment
    pip install uv
    uv pip install -r requirements.txt
    

References and Further Reading

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.