Get the FREE Ultimate OpenClaw Setup Guide →

mcp-weather -example

Claude Model Context Protocol Weather Server Example

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio duan-li-mcp-weather-server-example uv --directory /Users/<you-user-name>/Codes/GitHub/weather_service run weather-service \
  --env UV_DEBUG="optional debugging flag" \
  --env UV_PUBLISH_TOKEN="token for publishing (if needed)"

How to use

This MCP server implements a lightweight weather service that stores simple notes and exposes a custom note:// resource scheme. It provides a single tool named add-note for adding new notes to the server, where each note has a name and textual content. A note resource carries a name, a short description, and a text/plain payload. For querying or summarizing stored notes, there is a prompt named summarize-notes that can generate a summary by combining all current notes, with an optional style parameter to control detail level (brief or detailed). Clients can subscribe to resource changes so they are notified when notes are added or updated. The server is designed to be run in MCP environments via UV/uvx tooling; during development you’ll typically run the server with uv (development) and for deployment you can use uvx to package and run the server.

How to install

Prerequisites:

  • Python environment and the uv tooling (via uvx for publishing or uv for development)
  • Access to the repository containing the weather service MCP server code

Step-by-step:

  1. Install UV tooling (if not already installed):
    • For development Run: install uv (via your preferred package manager) and ensure it is on your PATH.
  2. Clone the weather service repository:
  3. Navigate to the project directory:
    • cd weather_service
  4. Install project dependencies (if any):
    • uv sync
  5. Run in development mode (as shown in the README):
    • uv run weather-service Note: The exact command may vary based on your environment; the README shows using the directory and running the weather-service target.
  6. (Optional) Build and publish (if you are preparing a distribution):
    • uv build
    • uv publish You may need PyPI credentials or UV_PUBLISH_TOKEN depending on your setup.

Additional notes

Tips and notes:

  • The server exposes a note storage mechanism with a custom note:// URI scheme for accessing individual notes. Each note has a name, description, and a text/plain body.
  • The summarize-notes prompt combines all stored notes into a single summary; you can pass a style parameter to influence detail level (brief or detailed).
  • The add-note tool requires name and content arguments and updates the server state, notifying connected clients of changes.
  • Debugging MCP servers over stdio can be challenging; using the MCP Inspector is highly recommended for debugging and inspecting the protocol communication. The README includes a command example to launch the inspector against a development server.
  • If you publish the server, consider using uvx with the published configuration and provide any necessary environment variables (e.g., tokens or credentials) via your deployment environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers