Sponsored by Deepsite.site

MCP Servers Template

Created By
gupta-ujjwal8 months ago
This repository provides a template for setting up Model Context Protocol (MCP) servers for local development.
Content

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 python@3.10
      
    • 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

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Playwright McpPlaywright MCP server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Tavily Mcp
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
DeepChatYour AI Partner on Desktop
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
WindsurfThe new purpose-built IDE to harness magic
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Serper MCP ServerA Serper MCP Server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors