MCP连接器
一个整合了Azure DevOps和Confluence/Docupedia集成的MCP网关系统。
概述
该项目在共享环境中统一了三台MCP服务器:
先决条件
- Python>=3.12
- 紫外线 (推荐)或pip
安装
1.克隆存储库
git clone
cd mcp-connector2.设置虚拟环境
# with uv
uv venv .venv
# Or with python
python -m venv .venv
# Activate the virtual environment
.\.venv\Scripts\Activate.ps1您的shell提示符现在应该显示 (.venv) 表示虚拟环境处于活动状态。
3.安装依赖项
# with uv
uv sync
# Or with pip please copy also the point (.)
pip install -e .配置
创建.env文件
创建 .env 根目录中的文件或 env.txt 文件,只需将其重命名为 .env 并填写所需的令牌。
# Azure DevOps
AZURE_DEVOPS_PAT=your-pat-token
# Confluence
CONFLUENCE_API_TOKEN=your-confluence-token
# Proxy Configuration
HTTP_PROXY=http://localhost:3128
HTTPS_PROXY=http://localhost:3128
http_proxy=http://localhost:3128
https_proxy=http://localhost:3128
NODE_TLS_REJECT_UNAUTHORIZED=0Azure DevOps(mcp-ado)
- 复制示例配置:
Copy-Item mcp-ado\config.example.json mcp-ado\config.json- 编辑
mcp-ado\config.json:
{
"azure_devops": {
"organization": "your-organization",
"default_project": "your-project",
"api_version": "7.1"
}
}创建个人访问令牌(PAT):
- 首选
https://dev.azure.com/{your-organization} - 用户设置→ 个人访问令牌→ “新令牌”
- 所需范围:
- 代码:读写 - 工作项目:读写 - 构建:阅读 - 项目和团队:阅读
- 复制令牌并粘贴到
.env
汇流/Docupedia(mcp-Docupedia)
- 复制示例配置:
Copy-Item mcp-docupedia\config.example.json mcp-docupedia\config.json- 编辑
mcp-docupedia\config.json:
default_space:使用您的Confluence空格键(例如“DOCUPEDIA”)max_results:要返回的最大搜索结果数。这可以根据您的需求进行调整。取决于每次搜索要向AI模型返回多少结果。{
"confluence": {
"host": "inside-docupedia.bosch.com/confluence",
"default_space": "Your_Space_Key"
},
"proxy": {
"enabled": true,
"url": "http://localhost:3128",
"disable_ssl_verification": true
},
"server": {
"port": 8004,
"host": "0.0.0.0"
},
"search_defaults": {
"max_results": 30,
"content_type": "page"
}
}
创建PAT:
- 登录Confluence
- 个人资料→ 设置→ 个人访问令牌
- “创建令牌”→ 给它起个名字→ 复制令牌
- 将令牌粘贴到
.env
代理配置:
如果您支持公司代理,请设置 enabled: true 以及正确的代理URL。使用 disable_ssl_verification: true 用于自签名证书。
网关(mcp网关)
编辑 mcp-gateway\gateway_config.json:
{
"gateway": {
"name": "MCP Gateway Server",
"cors": {
"origins": ["*"],
"credentials": true
}
},
"child_servers": [
{
"name": "ADO Server",
"type": "proxy",
"url": "http://localhost:8003/mcp",
"prefix": "ado",
"description": "Azure DevOps Integration"
},
{
"name": "Docupedia Server",
"type": "proxy",
"url": "http://localhost:8004/mcp",
"prefix": "docupedia",
"description": "Confluence/Docupedia Integration"
}
]
}用法
启动所有服务
选项1:使用Python启动器
# Start MCP servers
uv run launcher.py
# In a separate terminal, start the Gateway UI
uv run mcp-gateway/ui.py选项2:使用PowerShell脚本(单独的窗口)
.\start-all.ps1服务器:
- MCP ADO服务器(端口8003)
- MCP Docupedia服务器(端口8004)
- 网关UI仪表板(端口8001)
停止服务:
按 Ctrl+C 在终端中停止启动器和所有正在运行的服务器。
启动个人服务
# ADO Server
uv run mcp-ado/mcp_server.py
# Docupedia Server
uv run mcp-docupedia/mcp_server.py
# Gateway UI
uv run mcp-gateway/ui.py端点
| 服务 | 端点 | 运行状况检查 |
|---|---|---|
| MCP ADO服务器 | ||
| MCP Docupedia服务器 | ||
| 网关 |
项目结构
mcp-connector/
├── .venv/ # Shared virtual environment
├── .env # Environment variables (PATs, tokens)
├── env.txt # Environment template
├── pyproject.toml # Central dependency management
├── uv.lock # Dependency lock file
├── setup.ps1 # Setup script
├── launcher.py # Unified launcher for all servers
├── start-all.ps1 # Start all services in separate windows
├── README.md # This file
├── docs/ # Documentation and diagrams
├── mcp-ado/
│ ├── mcp_server.py # ADO Server
│ ├── config.json # ADO Configuration
│ └── README.md # ADO Documentation
├── mcp-docupedia/
│ ├── mcp_server.py # Docupedia Server
│ ├── config.json # Confluence Configuration
│ └── README.md # Docupedia Documentation
└── mcp-gateway/
├── gateway_server.py # Gateway Server
├── ui.py # Terminal UI
├── gateway_config.json # Gateway Configuration
└── README.md # Gateway Documentation故障排除
安装失败
- 确保已安装Python 3.12+:
python --version - 安装紫外线: 紫外线装置
- 跑
.\setup.ps1再次
服务器无法启动
- 检查端口8001、8003、8004是否空闲
- 验证配置文件是否有错误
- 检查PAT令牌的有效性
身份验证错误
- 验证PAT是否未过期
- 检查所需的范围/权限
- 在浏览器中手动测试连接
代理问题
- 确保代理URL正确
- 对于自签名证书:
disable_ssl_verification: true - 测试用
$env:HTTP_PROXY = "http://localhost:3128"
更多信息
各个服务器的详细文档:
- Azure DevOps服务器 -工具、API和示例
- Docupedia服务器 -CQL查询和Confluence API
- 网关服务器 -配置和监控
