MCP Server for Cursor

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides Google Drive integration for file management, allowing the MCP server to interact with Google Drive for storing and retrieving files.

光标的 MCP 服务器

用于 Cursor IDE 集成的模型上下文协议 (MCP) 服务器实现,通过 SSE(服务器发送事件)和 WebSocket 连接提供现代 Web 仪表板和工具。

特征

  • 通过 WebSocket 支持进行实时连接监控
  • 用于服务器管理的现代 Web 仪表板
  • 基于 SSE 与 Cursor IDE 的通信
  • 用于验证连通性的内置测试工具
  • 集成 Google Drive 进行文件管理
  • 用于添加新工具的可扩展架构
  • 连接历史记录可视化
  • 客户端管理界面
  • 服务配置用户界面
  • 可自定义的服务器设置

先决条件

  • Python 3.8 或更高版本
  • Node.js 18 或更高版本
  • npm(Node.js 包管理器)
  • pip(Python 包管理器)
  • 游标 IDE

安装

  1. 克隆存储库:
git clone <repository-url> cd MCP-Server
  1. 安装依赖项:
# Install all dependencies (both backend and frontend) npm run install-all # Or install separately: # Backend dependencies pip install -r requirements.txt # Frontend dependencies cd frontend npm install cd ..

发展

启动开发服务器:

# Start both backend and frontend in development mode npm run dev # This will start both servers concurrently

服务器将从以下时间启动:

  • 后端: http://localhost:8765
  • 前端: http://localhost:3000 (如果端口 3000 正在使用,则为3001

您还可以单独启动服务器:

# Backend (in one terminal) python mcp_server.py # Frontend (in another terminal) cd frontend npm run dev

开发服务器提供:

  • 前端更改的热重新加载
  • API 请求自动代理到后端
  • WebSocket 连接处理
  • 后端和前端并行开发

如果您正在运行其他使用端口 3000 的应用程序,前端将自动尝试端口 3001,并递增直到找到可用端口。运行npm run dev时,实际 URL 将显示在终端中。

项目结构

MCP-Server/ ├── frontend/ # Frontend application │ ├── src/ # Source code │ │ ├── api/ # API clients │ │ ├── pages/ # React components │ │ └── main.tsx # Entry point │ ├── package.json # Frontend dependencies │ └── vite.config.ts # Vite configuration ├── mcp_server.py # Main server implementation ├── services.py # Service management ├── test_client.py # Test client implementation ├── requirements.txt # Python dependencies ├── package.json # Root package.json └── services_config.json # Service configurations

可用端点

HTTP 端点

  • /api/status - 获取服务器状态
  • /api/connections/history - 获取连接历史记录
  • /api/clients - 获取活跃客户
  • /api/services/{service_id} - 服务配置
  • /api/settings - 服务器设置

WebSocket 端点

  • /ws/{client_id} - 实时更新和 ping/pong

SSE 端点

  • /sse ——Cursor IDE 的服务器发送事件

工具端点

  • /invoke/test测试工具
  • /invoke/google_drive - Google Drive 操作

生产部署

构建并启动生产服务器:

# Build frontend and start production server npm run prod # Or build frontend separately: npm run build python mcp_server.py

配置

初始设置

  1. 复制模板配置:
cp services_config.template.json services_config.json
  1. 使用您的服务凭证更新services_config.json
    • 对于 Google Drive:
      • 在 Google Cloud Console 中创建项目
      • 启用 Google Drive API
      • 创建 OAuth 2.0 凭据
      • 添加您的client_idclient_secret

服务器设置

通过 Web 仪表板配置服务器设置:

  • 调试模式
  • SSL 设置
  • 连接限制
  • Ping 超时
  • 协议设置

测试

使用提供的测试客户端测试服务器:

python test_client.py

测试客户端将:

  • 连接到 SSE 和 WebSocket 端点
  • 发送定期 ping
  • 测试可用的工具
  • 监视连接状态

故障排除

  1. 连接问题
    • 检查后端和前端日志
    • 在浏览器 DevTools 中验证 WebSocket 连接
    • 确保vite.config.ts中的代理设置正确
    • 检查端口冲突
  2. 前端问题
    • 清除浏览器缓存
    • 检查浏览器控制台是否有错误
    • 验证 Node.js 和 npm 版本
    • 检查 TypeScript 编译错误
  3. 后端问题
    • 检查mcp_server.log是否存在错误
    • 验证 Python 依赖项是否已安装
    • 检查端口可用性
    • 确保服务配置有效

安全说明

  • 服务器正在开发中接受所有来源(CORS *
  • WebSocket 连接使用客户端 ID 进行基本识别
  • 服务凭证存储在services_config.json
  • 环境变量应该用于生产中的敏感数据

贡献

  1. 分叉存储库
  2. 创建功能分支
  3. 进行更改
  4. 运行测试
  5. 提交拉取请求

执照

[在此添加您的许可证信息]

-
security - not tested
F
license - not found
-
quality - not tested

与 Cursor IDE 集成的模型上下文协议服务器,通过 SSE 和 WebSocket 连接提供实时通信、现代 Web 仪表板和可扩展工具。

  1. Features
    1. Prerequisites
      1. Installation
        1. Development
          1. Project Structure
          2. Available Endpoints
          3. Tool Endpoints
        2. Production Deployment
          1. Configuration
            1. Initial Setup
            2. Server Settings
          2. Testing
            1. Troubleshooting
              1. Security Notes
                1. Contributing
                  1. License
                    ID: i8mr884fr8