WeTrack MCP服务器
用于MongoDB管道生成和执行的MCP(模型上下文协议)服务器。该服务器为人工智能模型提供了与存储在MongoDB中的金融事件数据交互的工具。
特性
- 管道生成:使用GPT-5.1从自然语言查询生成MongoDB聚合管道
- 管道执行:执行MongoDB聚合管道并返回结果
- 远程访问:用于远程MCP访问的HTTP/SSE服务器(Claude AI等)
- 认证:OAuth2和Bearer令牌身份验证支持
- 日期处理:自动将日期字符串转换为MongoDB查询的日期时间对象
工具
- generate_mongodb管道:从自然语言查询生成MongoDB聚合管道
- execute_mongodb-pipeline:执行MongoDB聚合管道并返回结果
设置
- 安装依赖项:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- 在中配置环境变量
.env:
MONGODB_URI=your_mongodb_uri
MONGODB_DATABASE=your_database
MONGODB_VIEW=your_view_or_collection
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL_PIPELINE=gpt-5.1
SERVER_PORT=8002
# Authentication (optional)
OAUTH_ENABLED=false
OAUTH_CLIENT_ID=your_client_id
OAUTH_CLIENT_SECRET=your_client_secret
BEARER_TOKEN_ENABLED=false
BEARER_TOKEN=your_bearer_token
MCP_TOKEN=your_mcp_token
MCP_CLIENT_ID=your_client_id- 运行服务器:
python -m src.server_http远程访问(Claude AI)
- 使用ngrok公开服务器:
ngrok http 8002- 使用ngrok URL和身份验证凭据配置Claude AI。
项目结构
wetrack-mcp-server/
├── src/
│ ├── config/ # Configuration settings
│ ├── services/ # LLM and MongoDB services
│ ├── tools/ # MCP tools (generate, execute)
│ ├── utils/ # Date and JSON utilities
│ ├── auth.py # Authentication utilities
│ ├── oauth.py # OAuth2 implementation
│ └── server_http.py # HTTP/SSE server
├── test_pipeline.py # Pipeline testing script
└── requirements.txt # Python dependencies许可证
麻省理工学院
