发现优秀的 MCP 服务器

通过 MCP 服务器扩展您的代理能力,拥有 55,083 个能力。

全部55,083
mcp-weather-server

mcp-weather-server

好的,这是提供天气数据给 LLM 的一个示例模型上下文协议服务器: ```python import asyncio import json import os from typing import Any, Dict, List, Optional from fastapi import FastAPI, HTTPException from pydantic import BaseModel # 模拟天气数据 WEATHER_DATA = { "San Francisco": {"temperature": 15, "condition": "Cloudy"}, "New York": {"temperature": 22, "condition": "Sunny"}, "London": {"temperature": 18, "condition": "Rainy"}, "Tokyo": {"temperature": 25, "condition": "Clear"}, } class ContextRequest(BaseModel): """ LLM 请求上下文信息的请求体。 """ query: str location: Optional[str] = None # 可选的位置信息 class ContextResponse(BaseModel): """ 服务器返回给 LLM 的上下文信息。 """ context: Dict[str, Any] app = FastAPI() @app.post("/context") async def get_context(request: ContextRequest) -> ContextResponse: """ 根据 LLM 的查询请求,提供上下文信息。 """ print(f"Received query: {request.query}") print(f"Received location: {request.location}") location = request.location if not location: # 如果没有提供位置,则尝试从查询中提取 # 这是一个非常简单的示例,实际应用中需要更复杂的 NLP 处理 if "San Francisco" in request.query: location = "San Francisco" elif "New York" in request.query: location = "New York" elif "London" in request.query: location = "London" elif "Tokyo" in request.query: location = "Tokyo" else: raise HTTPException(status_code=400, detail="Location not specified and could not be inferred from query.") if location not in WEATHER_DATA: raise HTTPException(status_code=404, detail=f"Weather data not found for location: {location}") weather = WEATHER_DATA[location] context = { "location": location, "temperature": weather["temperature"], "condition": weather["condition"], } print(f"Returning context: {context}") return ContextResponse(context=context) if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8000) ``` **代码解释:** 1. **导入必要的库:** - `asyncio`: 用于异步操作。 - `json`: 用于处理 JSON 数据。 - `os`: 用于操作系统相关的功能。 - `typing`: 用于类型提示。 - `fastapi`: 用于创建 API。 - `pydantic`: 用于数据验证和序列化。 2. **模拟天气数据:** - `WEATHER_DATA`: 一个字典,存储了不同城市的天气数据。 这只是一个模拟数据,实际应用中需要从外部 API 或数据库获取。 3. **定义数据模型:** - `ContextRequest`: 定义了 LLM 请求上下文信息的请求体,包含 `query` (LLM 的查询) 和可选的 `location` (位置信息)。 - `ContextResponse`: 定义了服务器返回给 LLM 的上下文信息,包含一个 `context` 字典。 4. **创建 FastAPI 应用:** - `app = FastAPI()`: 创建一个 FastAPI 应用实例。 5. **定义 `/context` 接口:** - `@app.post("/context")`: 定义一个 POST 请求的接口,路径为 `/context`。 - `async def get_context(request: ContextRequest) -> ContextResponse:`: 定义处理请求的异步函数。 - `request: ContextRequest`: 接收请求体,并将其解析为 `ContextRequest` 对象。 - `-> ContextResponse`: 指定函数返回 `ContextResponse` 对象。 6. **处理请求逻辑:** - **打印接收到的查询和位置信息:** 用于调试和日志记录。 - **获取位置信息:** - 首先尝试从 `request.location` 中获取位置信息。 - 如果 `request.location` 为空,则尝试从 `request.query` 中提取位置信息。 这是一个非常简单的示例,实际应用中需要使用更复杂的 NLP 技术来提取位置信息。 - 如果无法获取位置信息,则返回一个 HTTP 400 错误。 - **获取天气数据:** - 检查 `location` 是否在 `WEATHER_DATA` 中。 - 如果 `location` 不在 `WEATHER_DATA` 中,则返回一个 HTTP 404 错误。 - 从 `WEATHER_DATA` 中获取天气数据。 - **构建上下文信息:** - 创建一个 `context` 字典,包含 `location`、`temperature` 和 `condition`。 - **返回上下文信息:** - 创建一个 `ContextResponse` 对象,并将 `context` 字典赋值给它。 - 返回 `ContextResponse` 对象。 7. **运行 FastAPI 应用:** - `if __name__ == "__main__":`: 确保代码只在直接运行脚本时执行,而不是在被导入为模块时执行。 - `uvicorn.run(app, host="0.0.0.0", port=8000)`: 使用 Uvicorn 运行 FastAPI 应用。 - `host="0.0.0.0"`: 允许从任何 IP 地址访问应用。 - `port=8000`: 指定应用监听的端口为 8000。 **如何运行:** 1. **安装依赖:** ```bash pip install fastapi uvicorn pydantic ``` 2. **运行脚本:** ```bash python your_script_name.py ``` 3. **测试接口:** 可以使用 `curl` 或其他 HTTP 客户端来测试接口。 例如: ```bash curl -X POST -H "Content-Type: application/json" -d '{"query": "What is the weather in San Francisco?", "location": "San Francisco"}' http://localhost:8000/context ``` 或者,如果省略 `location`,服务器会尝试从 `query` 中推断: ```bash curl -X POST -H "Content-Type: application/json" -d '{"query": "What is the weather in San Francisco?"}' http://localhost:8000/context ``` **重要说明:** * **真实数据源:** 这个示例使用模拟的天气数据。 在实际应用中,你需要使用真实的天气 API (例如 OpenWeatherMap, AccuWeather) 或数据库来获取数据。 * **NLP 处理:** 从查询中提取位置信息的部分非常简单。 在实际应用中,你需要使用更复杂的 NLP 技术 (例如命名实体识别) 来准确地提取位置信息。 * **错误处理:** 这个示例只包含基本的错误处理。 在实际应用中,你需要添加更完善的错误处理机制,例如日志记录和重试机制。 * **安全性:** 在生产环境中,你需要考虑安全性问题,例如身份验证和授权。 * **可扩展性:** 如果需要处理大量的请求,你需要考虑使用负载均衡和缓存等技术来提高可扩展性。 * **模型上下文协议:** 这个示例符合模型上下文协议的基本要求,即接收 LLM 的查询请求,并返回相关的上下文信息。 你需要根据 LLM 的具体要求来调整请求和响应的格式。 这个示例提供了一个基本的框架,你可以根据自己的需求进行修改和扩展。 希望这个示例对你有所帮助!

fpgaZeroMCP

fpgaZeroMCP

An MCP server for FPGA toolchain operations including linting, simulation, synthesis, place-and-route, bitstream programming, and IP core registry via GitHub.

mcp-flux-schnell

mcp-flux-schnell

一个基于 TypeScript 的 MCP 服务器,它使用 Cloudflare 的 Flux Schnell 模型 API 来实现文本到图像的生成。

Beeper MCP Note Server

Beeper MCP Note Server

一个简单的 MCP 服务器,用于创建和管理笔记,并支持总结功能。 (Alternatively, if you want to emphasize the "for" part:) 一个简单的 MCP 服务器,**旨在**创建和管理笔记,并支持总结功能。

Drone Airspace Governance MCP

Drone Airspace Governance MCP

Drone Airspace Governance - MCP server providing AI-powered tools and automation by MEOK AI Labs

CookUnity MCP

CookUnity MCP

MCP server for CookUnity meal delivery service. Browse menus, manage carts, confirm orders, skip/unskip deliveries, and view order history.

decoupler-MCP

decoupler-MCP

Provides a natural language interface for single-cell RNA-Seq analysis using the decoupleR framework. It enables users to perform biological pathway inference, data clustering, and visualization through MCP-compatible AI clients.

WeChat MCP Server

WeChat MCP Server

Enables automation of WeChat on macOS through the Accessibility API, allowing LLMs to fetch recent messages from contacts and send replies based on conversation history.

Anki MCP Server

Anki MCP Server

一个模型上下文协议服务器,允许大型语言模型(LLM)与 Anki 抽认卡软件进行交互,从而实现诸如创建牌组、添加笔记、搜索卡片以及通过自然语言管理抽认卡内容等功能。

outris-mcp

outris-mcp

Enables querying any API with natural language via Claude Desktop by connecting to the Outris API Orchestrator.

database-mcp

database-mcp

Automatically discovers database schema, performs data quality checks on tables and columns, and generates natural-language root cause analysis reports using Ollama LLM.

Streamable HTTP Python MCP Server Template

Streamable HTTP Python MCP Server Template

A starter template for building MCP servers in Python using the streamable HTTP transport protocol. Provides a foundation with the MCP Python SDK and example configuration to quickly develop custom MCP servers.

Remote MCP Server on Cloudflare

Remote MCP Server on Cloudflare

Bauplan MCP Server

Bauplan MCP Server

Enables AI assistants to interact with Bauplan lakehouse operations, including querying tables, schema inspection, branch management, and pipeline execution.

revolut-merchant-mcp

revolut-merchant-mcp

MCP server for the Revolut Merchant API, enabling AI assistants to read and manage customers, orders, subscriptions, and plans. Supports sandbox and production with safe defaults.

d20-mcp

d20-mcp

Enables dice rolling for RPG games using standard dice notation, supporting complex expressions like keep/drop, reroll, exploding dice, and batch rolls.

tabular-mcp

tabular-mcp

tabular-mcp

PromptThrift MCP

PromptThrift MCP

Enables 70-90% LLM API cost reduction by compressing conversation history via local Gemma 4 models or heuristics, featuring token counting, model routing, and pinned facts for preserving critical context.

Ableton Live MCP

Ableton Live MCP

Enables AI agents to control and inspect Ableton Live by executing Python code directly against the Live Object Model. It allows for automated track management, MIDI note creation, and real-time session manipulation through a natural language interface.

mcp-svd

mcp-svd

An MCP server that provides AI coding assistants with access to official ARM CMSIS SVD hardware register definitions for microcontrollers. It enables precise querying of register names, bit positions, and addresses to prevent hallucinations during embedded systems development.

CloudPulse MCP Server

CloudPulse MCP Server

Cross-cloud observability for AI agents. Discover resources, correlate logs, and diagnose infrastructure issues across AWS, GCP, Vercel, and Cloudflare — without leaving your editor.

ariadne

ariadne

Ariadne's thread — a way out of the microservice maze. Local cross-service semantic chain hinter for microservices (GraphQL/HTTP/Kafka/frontend)

Khan Academy MCP Server

Khan Academy MCP Server

Enables AI assistants to search, browse, and read Khan Academy's educational content, including courses, articles, and video transcripts. It provides tools to navigate the subject hierarchy and retrieve detailed metadata without requiring an API key.

Awesome MCP Server CN

Awesome MCP Server CN

That's a good translation! It's accurate and concise.

简介

简介

sn-mcp-bridge

sn-mcp-bridge

A lightweight MCP server that gives AI coding assistants full development capability on ServiceNow through the Table API, enabling CRUD and script execution without local installation.

Magic MCP

Magic MCP

A template for deploying remote Model Context Protocol servers to Cloudflare Workers with built-in OAuth authentication. It enables hosting secure, serverless MCP tools accessible via SSE transport for clients like Claude Desktop.

Getting Started with Remote MCP Servers using Azure Functions (Overview)

Getting Started with Remote MCP Servers using Azure Functions (Overview)

以下是一个着陆页的中文翻译,用于介绍在 Azure Functions 上运行远程 MCP 服务器的工作,并提供指向各种语言堆栈特定代码仓库的链接: **标题:在 Azure Functions 上运行远程 MCP 服务器** **简介:** 欢迎来到在 Azure Functions 上运行远程 MCP (Minecraft Protocol) 服务器的资源中心! Azure Functions 提供了一种经济高效且可扩展的方式来托管您的 Minecraft 服务器后端逻辑。 本项目旨在提供各种语言堆栈的示例和工具,帮助您轻松地在 Azure Functions 上部署和管理您的远程 MCP 服务器。 **优势:** * **经济高效:** 按需付费,仅在服务器运行时才产生费用。 * **可扩展性:** Azure Functions 可以根据玩家数量自动扩展,确保流畅的游戏体验。 * **易于部署:** 使用我们提供的示例和工具,您可以快速轻松地部署您的远程 MCP 服务器。 * **语言灵活性:** 我们支持多种编程语言,您可以选择最适合您的语言。 **支持的语言堆栈:** 以下是支持的语言堆栈及其对应代码仓库的链接: * **[语言名称 1]:** [代码仓库链接 1] (例如:Python: [GitHub 链接]) * **[语言名称 2]:** [代码仓库链接 2] (例如:Java: [GitHub 链接]) * **[语言名称 3]:** [代码仓库链接 3] (例如:C#: [GitHub 链接]) * **[语言名称 4]:** [代码仓库链接 4] (例如:Node.js: [GitHub 链接]) **入门指南:** 1. 选择您喜欢的语言堆栈。 2. 访问相应的代码仓库。 3. 按照仓库中的说明进行操作,设置您的 Azure Functions 项目。 4. 部署您的 Azure Functions 到 Azure。 5. 配置您的 Minecraft 客户端以连接到您的远程 MCP 服务器。 **资源:** * [Azure Functions 文档](链接到 Azure Functions 文档) * [Minecraft 协议文档](链接到 Minecraft 协议文档) * [社区论坛](链接到社区论坛) **贡献:** 我们欢迎您的贡献! 如果您想添加对其他语言堆栈的支持,改进现有示例,或修复错误,请提交 Pull Request。 **联系方式:** 如果您有任何问题或建议,请通过 [联系方式] 与我们联系。 **英文原文参考:** **Title: Running Remote MCP Server on Azure Functions** **Introduction:** Welcome to the resource hub for running a remote MCP (Minecraft Protocol) server on Azure Functions! Azure Functions provide a cost-effective and scalable way to host your Minecraft server backend logic. This project aims to provide examples and tools for various language stacks to help you easily deploy and manage your remote MCP server on Azure Functions. **Benefits:** * **Cost-Effective:** Pay-as-you-go pricing, only incurring costs when the server is running. * **Scalable:** Azure Functions can automatically scale based on player count, ensuring a smooth gaming experience. * **Easy Deployment:** With our provided examples and tools, you can quickly and easily deploy your remote MCP server. * **Language Flexibility:** We support multiple programming languages, allowing you to choose the one that best suits your needs. **Supported Language Stacks:** Below are the supported language stacks and links to their respective repositories: * **[Language Name 1]:** [Repository Link 1] (e.g., Python: [GitHub Link]) * **[Language Name 2]:** [Repository Link 2] (e.g., Java: [GitHub Link]) * **[Language Name 3]:** [Repository Link 3] (e.g., C#: [GitHub Link]) * **[Language Name 4]:** [Repository Link 4] (e.g., Node.js: [GitHub Link]) **Getting Started:** 1. Choose your preferred language stack. 2. Visit the corresponding repository. 3. Follow the instructions in the repository to set up your Azure Functions project. 4. Deploy your Azure Functions to Azure. 5. Configure your Minecraft client to connect to your remote MCP server. **Resources:** * [Azure Functions Documentation](Link to Azure Functions Documentation) * [Minecraft Protocol Documentation](Link to Minecraft Protocol Documentation) * [Community Forum](Link to Community Forum) **Contributing:** We welcome your contributions! If you would like to add support for other language stacks, improve existing examples, or fix bugs, please submit a Pull Request. **Contact:** If you have any questions or suggestions, please contact us at [Contact Information].

Weather MCP Server

Weather MCP Server

A Model Context Protocol server that retrieves current weather information for any city using the OpenWeatherMap API, designed for integration with Claude Code.

MCP Weather Server

MCP Weather Server

Provides weather alerts and forecasts for US locations using the National Weather Service API.