AT

aslan11/temporal-durable-mcp-weather-sample

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

10 stars 3 forks 质量 53 趋势 18

The purpose of this repo is to demonstrate how easy it is to leverage workflows as tools for MCP servers by taking modelcontext.

概览

The purpose of this repo is to demonstrate how easy it is to leverage workflows as tools for MCP servers by taking modelcontext.io's weather example and making it durable by implementing the MCP tools as Temporal workflows - Python3+ - uv (curl -LsSf https://astral.sh/uv/install.sh | sh) - Temporal Local Setup Guide - Claude for Desktop 1. First step - clone me 2. cd temporal-durable-mcp-weather-sample 3. uv venv (create virtual env) 4. source .venv/bin/activate 5. uv pip install pyproject.toml 6. Start Temporal Server: temporal server start-dev 7. Start Worker: python worker.py 8. Edit your Claude for Desktop Config: - Open Claude for Desktop - Click Settings in the toolbar - Click Developer - Click Edit Config (this should open up a finder window that points to a file called claude_desktop_config.

README

以下为原文 README 节选,完整内容请查看原文。

Temporal & Durable MCP

The purpose of this repo is to demonstrate how easy it is to leverage workflows as tools for MCP servers by taking modelcontext.io’s weather example and making it durable by implementing the MCP tools as Temporal workflows


Prerequisites:


Getting Started

  1. First step - clone me
  2. cd temporal-durable-mcp-weather-sample
  3. uv venv (create virtual env)
  4. source .venv/bin/activate
  5. uv pip install pyproject.toml
  6. Start Temporal Server: temporal server start-dev
  7. Start Worker: python worker.py
  8. Edit your Claude for Desktop Config:
    • Open Claude for Desktop
    • Click Settings in the toolbar
    • Click Developer
    • Click Edit Config (this should open up a finder window that points to a file called claude_desktop_config.json)
    • Open the file mentioned above in your editor of choice and modify it to look like the following
      • {
          "mcpServers": {
            "weather": {
              "command": "uv",
              "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/FOLDER/temporal-durable-mcp-weather-sample",
                "run",
                "weather.py"
              ]
            }
          }
        }
        
    • Validate that the tools exposed by the server (get_alerts, get_forecast) show up in Search and Tools by clicking the slider icon in the chat box of Claude for Desktop
  9. Ask Claude for any weather alerts and the forecast for a particular city - it should leverage the tools. If it doesn’t, try prompting it again encouraging it to use MCP tools that it has access to.

Results

Here we can see Claude is using the tools intelligently to look for weather alerts while getting me weather information:

What’s Cool About This

This demonstrates how tools in MCP can be implemented as workflows, adding durability. Per Claude:

Traditional MCP tool implementations are like having a single phone conversation - if the line cuts out at any point, you lose everything and have to start over from scratch. When an AI agent is performing complex, multi-step operations (like processing a large dataset, coordinating multiple API calls, or handling a lengthy business process), a single failure anywhere in the chain means complete failure.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "weather": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/PARENT/FOLDER/temporal-durable-mcp-weather-sample", "run", "weather.py" ] } } }