Enables configuration management through environment variables, allowing customization of the MCP server's behavior
Provides the API backend for the MCP server, allowing HTTP-based interactions with the system's microservices
Supports Jupyter notebook execution within the MCP environment, allowing notebook-based workflows for AI applications
模型上下文协议(MCP)
概述
MCP 是一个模块化框架,用于管理、执行和监控 AI 模型上下文,包括 LLM 提示、Jupyter Notebook 和 Python 脚本。它提供了一个 FastAPI 后端和一个 Streamlit 仪表板前端。
特征
- 注册和管理不同类型的 MCP(LLM 提示、笔记本、脚本)
- 执行 MCP 并在 Web UI 中查看结果
- 监控服务器健康和统计数据
- 可扩展至新的 MCP 类型
设置
先决条件
- Python 3.9+
- (推荐)创建并激活虚拟环境
安装依赖项
环境变量
- 设置
MCP_API_KEY
用于 API 认证(可选,提供默认值) - 对于 LLM,如果使用 Claude,请设置
ANTHROPIC_API_KEY
启动后端
启动前端
用法
- 通过http://localhost:8501访问仪表板
- 从 UI 创建、管理和测试 MCP
- 从侧边栏监控健康状况和统计数据
添加新的 MCP
- 在
mcp/core/
中实现一个新的 MCP 类 - 在后端注册
- 在
mcp/ui/app.py
中添加 UI 支持
运行测试
项目结构
mcp/api/
——FastAPI 后端mcp/ui/
- Streamlit 前端mcp/core/
- 核心 MCP 类型和逻辑tests/
-测试套件
执照
麻省理工学院
API 文档
服务器运行后,您可以访问:
- API 文档: http://localhost:8000/docs
- Prometheus 指标: http://localhost:8000/metrics
- 健康检查: http://localhost:8000/health
- 统计信息: http://localhost:8000/stats
安全
- 所有端点都需要 API 密钥认证
- 默认启用速率限制
- CORS 配置为仅允许特定来源
- 所有敏感配置都通过环境变量进行管理
监控
该服务器包括:
- Prometheus 的请求计数、延迟和服务器执行指标
- 结构化 JSON 日志记录
- 健康检查端点
- 服务器统计端点
贡献
- 分叉存储库
- 创建功能分支
- 提交你的更改
- 推送到分支
- 创建拉取请求
Notebook 和 LLM 集成的附加依赖项
该项目现在需要以下附加 Python 包:
- 熊猫
- numpy
- matplotlib
- 造纸厂
- nb格式
- jupyter
- 人择
使用以下命令安装所有依赖项:
使用 Notebook MCP 调用 LLM(Claude)
示例笔记本( mcp/notebooks/example.ipynb
)演示了:
- 数据分析和绘图
- 通过
anthropic
Python 包调用 Claude LLM
要使用 LLM 单元,请确保已在环境或.env
文件中设置了ANTHROPIC_API_KEY
。
LLM 的笔记本单元如下所示:
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
通过微服务构建和协调 AI 应用程序的模块化系统,具有 LLM 交互、Jupyter 笔记本执行和可视化工作流功能。
Related MCP Servers
- -securityFlicense-qualityEnables AI agent and task management using the CrewAI framework, allowing users to create and run agents and tasks in an automated workflow environment.Last updated -03JavaScript
- -securityAlicense-qualityA lightweight, modular API service that provides useful tools like weather, date/time, calculator, search, email, and task management through a RESTful interface, designed for integration with AI agents and automated workflows.Last updated -PythonMIT License
- -securityAlicense-qualityAn MCP server that enables AI agents to interact with Modal, allowing them to deploy apps and run functions in a serverless cloud environment.Last updated -PythonMIT License
- -securityFlicense-qualityA lightweight Python-based server designed to run, manage and create CrewAI workflows using the Model Context Protocol for communicating with LLMs and tools like Claude Desktop or Cursor IDE.Last updated -1Python