发现优秀的 MCP 服务器

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

全部81,228
MCP Server Trello

MCP Server Trello

Enables AI agents to manage Trello boards, lists, cards, checklists, and workspace navigation through 23 typed MCP tools, with rate limiting and validation.

Resilience Architect MCP

Resilience Architect MCP

Your proactive chaos engineering companion that analyzes infrastructure code and designs targeted resilience experiments before problems occur.

Model Context Protocol Server

Model Context Protocol Server

使用 FastAPI 实现的模型上下文协议服务器: ```python from fastapi import FastAPI, Request, HTTPException from pydantic import BaseModel from typing import Dict, Any, Optional app = FastAPI() # 定义请求和响应模型 class ContextRequest(BaseModel): model_id: str context: Dict[str, Any] request_id: Optional[str] = None # 可选的请求 ID,用于跟踪 class ContextResponse(BaseModel): model_id: str context: Dict[str, Any] request_id: Optional[str] = None # 响应中返回请求 ID # 模拟的模型上下文存储 model_contexts: Dict[str, Dict[str, Any]] = {} @app.post("/context") async def update_context(request: ContextRequest) -> ContextResponse: """ 更新指定模型的上下文。 Args: request: 包含模型 ID 和上下文数据的 ContextRequest 对象。 Returns: 包含更新后的模型 ID 和上下文数据的 ContextResponse 对象。 """ model_id = request.model_id context = request.context request_id = request.request_id # 检查模型 ID 是否存在 if model_id not in model_contexts: model_contexts[model_id] = {} # 更新上下文 model_contexts[model_id].update(context) # 构建响应 response = ContextResponse(model_id=model_id, context=model_contexts[model_id], request_id=request_id) return response @app.get("/context/{model_id}") async def get_context(model_id: str) -> Dict[str, Any]: """ 获取指定模型的上下文。 Args: model_id: 要获取上下文的模型 ID。 Returns: 指定模型的上下文数据。 Raises: HTTPException: 如果模型 ID 不存在。 """ if model_id not in model_contexts: raise HTTPException(status_code=404, detail=f"Model ID '{model_id}' not found") return model_contexts[model_id] @app.delete("/context/{model_id}") async def delete_context(model_id: str) -> Dict[str, str]: """ 删除指定模型的上下文。 Args: model_id: 要删除上下文的模型 ID。 Returns: 一个包含删除结果的消息。 Raises: HTTPException: 如果模型 ID 不存在。 """ if model_id not in model_contexts: raise HTTPException(status_code=404, detail=f"Model ID '{model_id}' not found") del model_contexts[model_id] return {"message": f"Context for model ID '{model_id}' deleted successfully."} if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8000) ``` **代码解释:** * **`from fastapi import FastAPI, Request, HTTPException`**: 导入 FastAPI 及其相关模块。 * **`from pydantic import BaseModel`**: 导入 Pydantic 的 `BaseModel` 用于定义数据模型。 * **`from typing import Dict, Any, Optional`**: 导入类型提示,提高代码可读性。 * **`app = FastAPI()`**: 创建 FastAPI 应用实例。 * **`ContextRequest` 和 `ContextResponse`**: 使用 Pydantic 定义请求和响应的数据模型。 `ContextRequest` 包含 `model_id` (模型 ID), `context` (上下文数据,一个字典), 和可选的 `request_id`。 `ContextResponse` 包含相同的信息,用于返回更新后的上下文。 * **`model_contexts: Dict[str, Dict[str, Any]] = {}`**: 一个字典,用于存储模型上下文。 键是 `model_id` (字符串),值是另一个字典,表示该模型的上下文数据。 这只是一个内存中的存储,在实际应用中,你可能需要使用数据库或其他持久化存储。 * **`@app.post("/context")`**: 定义一个 POST 路由,用于更新模型的上下文。 * `async def update_context(request: ContextRequest) -> ContextResponse:`: 定义异步函数 `update_context`,它接收一个 `ContextRequest` 对象作为参数,并返回一个 `ContextResponse` 对象。 * 函数首先从请求中提取 `model_id` 和 `context`。 * 然后,它检查 `model_id` 是否已经存在于 `model_contexts` 中。如果不存在,则创建一个新的条目。 * 接下来,它使用 `update()` 方法将请求中的 `context` 合并到现有的模型上下文中。 * 最后,它创建一个 `ContextResponse` 对象并返回。 * **`@app.get("/context/{model_id}")`**: 定义一个 GET 路由,用于获取指定模型的上下文。 * `async def get_context(model_id: str) -> Dict[str, Any]:`: 定义异步函数 `get_context`,它接收一个 `model_id` 作为参数,并返回一个字典,表示该模型的上下文数据。 * 函数首先检查 `model_id` 是否存在于 `model_contexts` 中。如果不存在,则抛出一个 `HTTPException`,状态码为 404 (Not Found)。 * 如果 `model_id` 存在,则返回 `model_contexts[model_id]`。 * **`@app.delete("/context/{model_id}")`**: 定义一个 DELETE 路由,用于删除指定模型的上下文。 * `async def delete_context(model_id: str) -> Dict[str, str]:`: 定义异步函数 `delete_context`,它接收一个 `model_id` 作为参数,并返回一个字典,包含删除结果的消息。 * 函数首先检查 `model_id` 是否存在于 `model_contexts` 中。如果不存在,则抛出一个 `HTTPException`,状态码为 404 (Not Found)。 * 如果 `model_id` 存在,则使用 `del model_contexts[model_id]` 删除该模型的上下文。 * 最后,返回一个包含成功消息的字典。 * **`if __name__ == "__main__":`**: 确保代码只在直接运行脚本时执行,而不是作为模块导入时执行。 * **`uvicorn.run(app, host="0.0.0.0", port=8000)`**: 使用 Uvicorn 启动 FastAPI 应用。 `host="0.0.0.0"` 表示监听所有网络接口,`port=8000` 表示监听 8000 端口。 **如何运行:** 1. **安装 FastAPI 和 Uvicorn:** ```bash pip install fastapi uvicorn ``` 2. **保存代码:** 将代码保存为 `main.py` (或其他你喜欢的名字)。 3. **运行应用:** ```bash python main.py ``` 或者,如果你安装了 `uvicorn` 作为全局命令: ```bash uvicorn main:app --reload ``` `--reload` 标志会在代码更改时自动重新加载服务器,方便开发。 **如何使用:** 你可以使用 `curl` 或任何 HTTP 客户端来与服务器交互。 * **更新上下文 (POST):** ```bash curl -X POST -H "Content-Type: application/json" -d '{"model_id": "my_model", "context": {"key1": "value1", "key2": 123}, "request_id": "req123"}' http://localhost:8000/context ``` * **获取上下文 (GET):** ```bash curl http://localhost:8000/context/my_model ``` * **删除上下文 (DELETE):** ```bash curl -X DELETE http://localhost:8000/context/my_model ``` **重要注意事项:** * **错误处理:** 代码包含基本的错误处理 (例如,检查模型 ID 是否存在)。 在实际应用中,你需要更完善的错误处理机制,例如记录错误日志、返回更详细的错误信息等。 * **安全性:** 此代码没有包含任何安全措施。 在生产环境中,你需要添加身份验证、授权、输入验证等安全措施。 * **持久化存储:** 此代码使用内存中的字典来存储模型上下文。 这意味着,当服务器重启时,所有上下文数据都会丢失。 在实际应用中,你需要使用数据库或其他持久化存储来保存上下文数据。 常见的选择包括 Redis、PostgreSQL、MongoDB 等。 * **并发:** FastAPI 是一个异步框架,可以处理并发请求。 但是,如果你的模型上下文存储是线程不安全的,你需要采取措施来保护它,例如使用锁。 * **模型集成:** 此代码只是一个模型上下文协议服务器的框架。 你需要将其与你的实际模型集成。 这可能涉及到加载模型、调用模型进行推理、以及将模型的结果存储到上下文中。 * **数据验证:** 你可以使用 Pydantic 的验证功能来确保上下文数据符合预期的格式和类型。 This provides a basic implementation of a Model Context Protocol server using FastAPI. Remember to adapt it to your specific needs and consider the important notes above for production deployments.

joplin-mcp-server

joplin-mcp-server

Joplin MCP Server

seismo-mcp

seismo-mcp

Bridges AI assistants to seismology software (ObsPy, CWP/SU, SAC, PyGMT), allowing users to process seismic waveforms and perform analysis through natural language instead of writing code.

rugmunch-base

rugmunch-base

33 crypto security tools via x402 micropayments. Auto-refund guarantee. $0.01-$0.15/call.

electron-mcp

electron-mcp

MCP server for interacting with and debugging Electron apps, providing tools for window automation, IPC, logs, and main-process state via CDP and Node inspector.

ollama-fleet-mcp

ollama-fleet-mcp

Exposes a local Ollama fleet as MCP tools for Claude Code, enabling model listing, generation, fleet health checks, parallel comparisons, smart host routing, and model pulling across hosts.

Swiss Hiking Trails MCP

Swiss Hiking Trails MCP

Enables AI agents to explore Swiss hiking routes with real-time closures, weather, public transport, and POIs, including GPX generation.

Utility MCP Server

Utility MCP Server

A TypeScript-based MCP server providing utility tools like arithmetic calculations, random number generation, and math tutoring prompts. It enables users to perform basic computational tasks and access system status resources through JSON-RPC 2.0 protocol.

Electron Stagewright

Electron Stagewright

Drive, inspect, and assert on real Electron desktop apps from an AI agent — agent-native, Playwright-style automation with accessibility refs, stable error codes, and retrying assertions

SearchAPI MCP Agent

SearchAPI MCP Agent

Integrates multiple search APIs (Google Search, Maps, Flights, Hotels) through the Model Context Protocol and Agent-to-Agent protocol, enabling AI assistants to perform diverse searches via natural language queries.

Apple Reminders MCP Server

Apple Reminders MCP Server

Programmatic access to Apple Reminders via SSE, enabling creation, reading, updating, and deletion of reminders and reminder lists.

asana-full-mcp

asana-full-mcp

Exposes the full Asana REST API via an MCP server, enabling operations like task management and workspace queries, with configurable safety guardrails.

Stock Data MCP Server

Stock Data MCP Server

Provides comprehensive data for A-shares, Hong Kong, and US stocks alongside cryptocurrency markets, supporting technical indicators, news, and financial statements. It features automatic failover across multiple data sources to ensure reliable access to real-time and historical market information.

Calliope MCP Server

Calliope MCP Server

Provides MCP tools to read, write, append, and edit prose sections of nodes, backed by an in-memory or substrate-direct (Urania) backend.

SentinelMCP

SentinelMCP

Stateless enterprise policy firewall & token-cost proxy for MCP. It enforces identity, policy, and budget on every tool call.

GitLab MCP Server

GitLab MCP Server

Connects AI assistants to GitLab to interact with merge requests, reviews, discussions, pipelines, and test results through natural language queries. Supports viewing MR details, responding to comments, checking test summaries, and analyzing job logs.

Cadastro PF + Receita Federal

Cadastro PF + Receita Federal

Consulta dados cadastrais e situação de CPF na Receita Federal a partir de um número de CPF. Serve como ferramenta somente leitura, paga por uso, para clientes MCP.

SecureLLM MCP Server

SecureLLM MCP Server

Enables AI assistants to interact with NixOS development tools, manage builds, and optimize workflows through natural language.

mcp-istat-it

mcp-istat-it

Enables querying Italian national statistics (ISTAT) data through natural language questions, with tools for accessing demographic, economic, and social indicators.

Convoy MCP Server

Convoy MCP Server

Enables interaction with Convoy's webhooks proxy API for managing and monitoring webhook delivery, events, and configurations through natural language.

Figma Context MCP

Figma Context MCP

An MCP server that gives AI coding tools access to Figma design data for accurate one-shot implementation of designs.

godmod3-mcp

godmod3-mcp

A bridge for G0DM0D3 that exposes advanced AI capabilities through MCP tools, including multi-model racing, hive-mind synthesis, and secure chat options.

AI Takeover Tracker MCP Server

AI Takeover Tracker MCP Server

Provides AI job displacement data and automation risk assessments for over 59,000 occupations based on task-level analysis. It enables users to query risk scores, task-level breakdowns, career transition paths, and the latest AI-related employment news.

MachineElf

MachineElf

Routes urgent alerts from autonomous AI agents to human operators with idempotency and strict JSON schemas.

MCP

MCP

liteparse-mcp

liteparse-mcp

Fast, local PDF parsing as an MCP server with text extraction, bounding boxes, OCR, and visual citations. No cloud or API key required.

Dine-Discover-AI MCP Server

Dine-Discover-AI MCP Server

Enables conversational exploration of California restaurant data, vibe-based recommendations, and access to structured restaurant details and reviews.

react-ts-dev-tools

react-ts-dev-tools

An MCP server that provides tools for React and TypeScript development, including generating typed form components, explaining TypeScript compiler errors, and producing Shadcn UI installation commands.