光标MCP(Machine Control Protocol)监视器是一款用于监控和分析MCP协议交互的工具。它能助力开发者调试MCP服务器实现,分析协议消息与错误模式,还可跟踪客户端生命周期和连接状态。
光标MCP监视器可帮助开发者高效调试MCP服务器,分析协议消息和错误模式。以下将为你介绍其安装、配置和使用方法。
dotnet add package CursorMCPMonitor --version 1.0.0
可以通过以下环境变量进行全局配置:
CURSOR_LOGS_ROOT:设置日志根目录,默认为./logs。CURSOR_POLL_INTERVAL:设置轮询间隔(以毫秒为单位),默认为1000。CURSOR_LOG_PATTERN:设置日志文件匹配模式, 默认为CursorMCP*.log。[Global]
LogsRoot = ./logs
PollInterval = 1000
LogPattern = CursorMCP*.log
[Console]
Verbosity = info
ColorEnabled = true
[File]
EnableRotation = true
MaxFileSize = 1MB
[2025-03-03 12:34:56.789] [INF] [CursorMCPMonitor.Services.LogProcessorService] CreateClient detected: Cursor MCP.log 2025-03-03 12:34:56.123 [info] a602: 处理CreateClient操作
2025-03-03 12:34:56.789 +00:00 [INF] [CursorMCPMonitor.Services.LogProcessorService] CreateClient detected: Cursor MCP.log 2025-03-03 12:34:56.123 [info] a602: 处理CreateClient操作
| 错误类型 | 描述 | 解决方案 |
|---|---|---|
| 文件未找到 | 指定的日志文件不存在 | 检查日志路径和文件名是否正确 |
| 连接超时 | 与服务端通信超时 | 确保服务端正常运行并检查网络连接 |
| 数据解析失败 | 接收到无效数据格式 | 检查客户端发送的数据是否符合协议规范 |
FROM mcr.microsoft.com/dotnet/runtime:7.0.0-alpine AS base
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "run"]
docker build -t cursor-mcp-monitor .
docker run --name cursor-mcp-monitor -p 5000:5000 cursor-mcp-monitor
本项目遵循MIT开源协议,代码和文档均可自由使用、修改和分发。
如需更多帮助,请访问官方文档或联系支持团队。