Cover image
Try Now
2025-03-24

通过直接休息端点和模型上下文协议(MCP)集成到工作流引擎的服务器。

3 years

Works with Finder

1

Github Watches

1

Github Forks

0

Github Stars

Workflows MCP Server

This is a Model Context Protocol (MCP) server that provides weather information for cities through a simple API.

Features

  • This server exposes workflows as tools that can be consumed by agents. In this case a weather workflow is exposed as a set of tools:
    • Exposes a get-weather tool that fetches weather data for any city
    • Provides a check-weather prompt template for easy integration with LLMs
    • Uses HTTP/SSE transport for communication with clients

Workflow Architecture

Weather Workflow

When the get-weather tool is called, it triggers a workflow that:

  1. Takes the city name as input
  2. Queries the OpenWeatherMap service for current weather data at that location
  3. Passes the raw weather data to an LLM for interpretation
  4. Returns a friendly, natural language description of the current weather conditions

This architecture allows for both accurate weather data retrieval and intelligent processing to provide weather information in a more conversational and easily understood format.

Note on Current Implementation

Due to some technical challenges with the MCP protocol implementation, we've provided two approaches:

  1. Original MCP Server - The TypeScript implementation in the src directory, which may have some compatibility issues with current SDK versions.

  2. Simplified Direct API - A plain JavaScript implementation in the root directory (direct-server.js and direct-client.js) that provides a simple RESTful endpoint without using the MCP protocol.

For immediate functionality, we recommend using the simplified direct API approach.

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Installation

  1. Clone this repository
  2. Install dependencies:
    npm install
    

Usage - Simplified API Approach

  1. Start the server:

    node direct-server.js
    
  2. The server will start on port 3000 and provide:

    • Weather API: http://localhost:3000/api/weather?city=New%20York
    • Health check: http://localhost:3000/health
  3. Run the client example:

    node direct-client.js
    

Usage - MCP Approach

This approach requires building the TypeScript code and may have some compatibility issues:

  1. Build the project:

    npm run build
    
  2. Start the server:

    npm start
    
  3. The server will start on port 3000:

    • SSE endpoint: http://localhost:3000/sse
    • Messages endpoint: http://localhost:3000/messages?connectionId=YOUR_CONNECTION_ID
    • Health check: http://localhost:3000/health

Understanding the Connection ID

The connection ID is a unique identifier assigned to each client session when connecting to the SSE endpoint. It serves as a crucial mechanism for maintaining bidirectional communication:

  • When a client connects to the /sse endpoint, the server generates a unique connection ID
  • This ID is returned to the client in the initial SSE response
  • The client must include this ID as a query parameter in all subsequent requests to the /messages endpoint
  • This allows the server to route responses back to the correct client's SSE connection

For example, if your connection ID is 1742761520489, you would make tool calls to:

http://localhost:3000/messages?connectionId=1742761520489

API Reference

Direct API

GET /api/weather

Fetches weather information for a specified city.

Parameters:

  • city (string): The name of the city to get weather for.

Returns:

  • JSON response with weather information.

MCP Tools

get-weather

Fetches weather information for a specified city.

Parameters:

  • city (string): The name of the city to get weather for.

Returns:

  • Weather information as text.

MCP Prompts

check-weather

A prompt template for asking an LLM to check and summarize weather information.

Parameters:

  • city (string): The name of the city to check weather for.

License

MIT

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Lists Tailwind CSS classes in monospaced font

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

    Reviews

    3 (1)
    Avatar
    user_r5i1URgb
    2025-04-16

    As a dedicated user of workflows-mcp-server, I am consistently impressed by its robust functionalities and seamless integration capabilities. Developed by popand and available on GitHub, this server solution excels at managing complex workflows efficiently. The clear documentation and active community support make it an invaluable tool for developers seeking streamlined and reliable performance. Highly recommended!