MCP 服务器 - 模型上下文协议 API
MCP Server 是基于 FastAPI 的模型上下文协议 (MCP) 实现,为 LLM 模型和应用程序之间的交互提供了标准化接口。
特点
- 🚀 基于 FastAPI 和异步操作的高性能 API
- 🔄**提供全面的 MCP 支持,**包括资源、工具、提示和采样
- 📊 通过 Prometheus 和 Grafana 进行监控和指标
- 🧩 通过简单的界面添加新工具的可扩展性
- 📝 GraphQL API ,可灵活处理数据
- 💬 WebSocket 支持实时交互
- 🔍 通过与 Elasticsearch 集成进行语义搜索
- 🗃️ 通过 Redis缓存以提高性能
- 📦通过 Poetry管理依赖项以实现可靠的包管理
入门
安装
- 克隆存储库:
- 安装 Poetry(如果尚未安装):
- 通过 Poetry 安装依赖项:
启动服务器
或者通过 just 实用程序:
启动后,API 可在以下网址访问: http://localhost:8000
API 文档
- Swagger 用户界面: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- GraphQL 游乐场: http://localhost:8000/graphql
项目结构
可用工具
文件系统工具
支持读取、写入、删除和列出文件的文件系统工具。
天气工具
通过坐标获取天气数据的工具。
文本分析工具
一种文本分析工具,包括情感检测和总结。
文本处理工具
文本处理工具,包括格式化、统计计算、实体提取。
图像处理工具
支持调整大小、裁剪和应用过滤器的图像处理工具。
WebSocket API
要连接到 WebSocket API:
GraphQL API
通过 GraphQL 进行查询的示例:
运行测试
要运行测试,请使用 Poetry:
或者通过 just 实用程序:
Docker
通过 Docker Compose 构建和运行
要启动单个服务:
与 LLM 集成
MCP Server 提供了标准化接口,可与来自不同供应商的 LLM 模型集成:
指标和监控
MCP 服务器通过/metrics
端点提供 Prometheus 格式的指标。指标包括:
- 每个工具的请求数量
- 查询执行时间
- 错误和异常
发展
格式化代码并使用 linters 检查:
执照
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
支持模型上下文协议 (MCP) 的高性能 FastAPI 服务器,可与大型语言模型无缝集成,具有 REST、GraphQL 和 WebSocket API,以及实时监控和向量搜索功能。
Related Resources
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server that integrates with Cursor IDE, providing real-time communication, modern web dashboards, and extensible tools via SSE and WebSocket connections.Last updated -8391Python
- -securityAlicense-qualityA server that enables Large Language Models to discover and interact with REST APIs defined by OpenAPI specifications through the Model Context Protocol.Last updated -37896TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server implementation that enables seamless integration with Claude and other MCP-compatible clients to access Prem AI's language models, RAG capabilities, and document management features.Last updated -JavaScript
- -securityAlicense-qualityA Model Context Protocol server that exposes over 200+ APIs from API.market as MCP resources, allowing large language models to discover and interact with various APIs through natural language commands.Last updated -1112TypeScriptMIT License