MCP Server
基于WebSocket的MCP(Model Control Protocol)服务器,用于处理模型请求并提供响应。
项目结构
安装
本项目使用uv进行依赖管理。
配置
- 复制环境变量示例文件并进行配置:
- 编辑
.env
文件,设置您的配置。
运行
服务器将在http://localhost:8000
上运行,WebSocket端点为ws://localhost:8000/ws
。
测试客户端
打开client/index.html
文件在浏览器中测试MCP服务器。
MCP协议
MCP协议是一个基于WebSocket的协议,用于控制和管理AI模型。
请求格式
响应格式
错误格式
事件格式
支持的动作
chat
: 聊天请求completion
: 文本完成请求
扩展
您可以通过以下方式扩展MCP服务器:
- 创建新的处理器在
src/mcp/handlers/
目录 - 在
main.py
中注册新的处理器 - 自定义协议实现在
src/mcp/protocol/
目录
This server cannot be installed
A WebSocket-based Model Control Protocol (MCP) server that processes model requests and provides responses. Supports chat and text completion actions with a standardized JSON protocol for AI model communication.