使用说明
组合式MCP服务器
生产级MCP(模型上下文协议)服务器组合 Redshift查询功能 和 知识库矢量库 特征。
特性
Redshift工具
- run_query -通过IAM身份验证执行SQL
get_cluster_credentials - list_schemas -列出数据库架构
- list_tables -列出架构中的表
- describe_table -获取表结构
较大的结果(>100行)会自动存储在S3中,并返回20个样本行。
知识库工具
- build_vectorstore -从S3 markdown文件构建矢量存储
- 查询向量库 -RRF重排序的混合搜索(语义+关键字)
- 获取向量存储状态 -检查构建状态和缓存统计信息
快速开始
本地开发
-
安装uv(如果尚未安装):
curl -LsSf https://astral.sh/uv/install.sh | sh # Or on Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex" -
启动基础设施:
docker-compose up -d postgres localstack -
安装依赖项:
uv pip install -e ".[dev]" -
配置环境:
cp .env.example .env.local # Edit .env.local with your settings -
运行服务器:
# With MCP Inspector mcp dev src/combined_mcp_server/main.py # Or directly python -m combined_mcp_server.main
ECS部署
# Build container
docker build -t combined-mcp-server .
# Run with health checks
docker run -p 8080:8080 --env-file .env combined-mcp-server
健康终点:
GET /health-活体探针GET /ready-准备就绪探针GET /status-详细状态
配置
看 .env.example 对于所有配置选项。关键设置:
| 变量 | 描述 |
|---|---|
REDSHIFT_CLUSTER_ID |
Redshift群集标识符 |
POSTGRES_SECRET_NAME |
pgvector DB的秘密管理器秘密 |
KNOWLEDGEBASE_S3_BUCKET |
带有markdown文件的S3存储桶 |
BEDROCK_EMBEDDING_MODEL |
Titan嵌入模型ID |
建筑
┌─────────────────────────────────────────────────────┐
│ Combined MCP Server │
├─────────────────────┬───────────────────────────────┤
│ Redshift Tools │ Knowledgebase Tools │
│ ───────────────── │ ─────────────────────────── │
│ • run_query │ • build_vectorstore │
│ • list_schemas │ • query_vectorstore │
│ • list_tables │ • get_vectorstore_status │
│ • describe_table │ │
├─────────────────────┴───────────────────────────────┤
│ Core Services │
│ AWS (Secrets Manager, S3, Bedrock, Redshift) │
│ PostgreSQL + pgvector │
└─────────────────────────────────────────────────────┘
测试
# Unit tests
pytest tests/ -v
# With coverage
pytest tests/ -v --cov=combined_mcp_server
# Integration tests (requires Docker)
docker-compose up -d
pytest tests/ -v -m integration
许可证
麻省理工学院