MCP-Native Enterprise Integration Hub
MCP-Native 企业集成中心
概述
一个受管控的 AI 智能体平台,将 GitHub Issues、Jira 和 Slack 作为 MCP(Model Context Protocol)服务器暴露。LangGraph 编排智能体将自然语言请求路由到经过 Pydantic 验证的工具模式中,并通过一个强制的 HITL 审批检查点对所有写操作在执行前进行把关。每个智能体决策、工具调用和操作结果都会持久化到 PostgreSQL 中以实现完整审计追踪,PGVector 语义搜索会在每次新操作规划前检索相关的历史操作。
Related MCP server: GitHub Flow MCP
架构
graph TD
User -->|POST /agent/run| FastAPI
FastAPI --> LangGraph
LangGraph --> ParseIntent
ParseIntent --> RetrieveSimilar
RetrieveSimilar -->|PGVector| PostgreSQL
RetrieveSimilar --> PlanAction
PlanAction --> HITLGate
HITLGate -->|Write op| HITLApproval[(PostgreSQL HITLApproval)]
HITLGate -->|Read op| ExecuteAction
ExecuteAction --> GitHubMCP
ExecuteAction --> JiraMCP
ExecuteAction --> SlackMCP
ExecuteAction --> LogRun
LogRun --> PostgreSQL必需的 OAuth 范围
Slack:channels:read、channels:history、chat:write
GitHub:repo(用于私有仓库)或 public_repo
Jira:read:jira-work、write:jira-work
设置
# 1. Clone and enter the project
git clone <repo-url> mcp-enterprise-hub
cd mcp-enterprise-hub
# 2. Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure environment variables
cp .env.example .env
# Edit .env and fill in: ANTHROPIC_API_KEY, OPENAI_API_KEY, GITHUB_TOKEN,
# JIRA_API_TOKEN, JIRA_EMAIL, JIRA_BASE_URL, SLACK_BOT_TOKEN
# 5. Start PostgreSQL (with pgvector)
docker compose up -d postgres
# 6. Initialize the database schema
python src/db/init_db.py
# 7. Run the API server
uvicorn src.api.main:app --reload
# 8. (Optional) Run the test suite
docker compose up -d postgres # test DB is created automatically on first run
pytest --cov=src --cov-report=term-missing tests/端口冲突说明:如果您已有一个本地 Postgres 实例在 5432 端口运行(macOS 上通过 Homebrew 或 Postgres.app 很常见),Docker 的端口映射可能会悄然输掉这个端口的竞争——
docker compose up -d会报告容器为健康状态,但实际上localhost:5432会路由到你的本机 Postgres,而它没有mcp_enterprise_hub角色/数据库,并会报FATAL: role "postgres" does not exist或类似的错误。要么停止本地 Postgres 服务,要么通过docker-compose.override.yml将容器映射到一个空闲端口:services: postgres: ports: - "5433:5432"并更新
.env中的DATABASE_URL/TEST_DATABASE_URL使其使用 5433 端口。
API 调用示例
1. 读操作(列出 GitHub issues)——立即完成:
curl -X POST http://localhost:8000/agent/run \
-H "Content-Type: application/json" \
-d '{"message": "list open issues in octo/hello"}'{
"status": "completed",
"result": {
"issues": [
{"id": 1, "number": 42, "title": "Login button unresponsive", "state": "open", "url": "https://github.com/octo/hello/issues/42"}
],
"metadata": {"is_write": false, "connector": "github", "tool_name": "list_issues"}
},
"run_id": "6a9b1a2e-4c9b-4c1e-9c0e-7a1f2b3c4d5e",
"session_id": "d1e2f3a4-5b6c-7d8e-9f0a-1b2c3d4e5f6a"
}2. 写操作(创建 Jira 工单)—— 返回 pending_approval:
curl -X POST http://localhost:8000/agent/run \
-H "Content-Type: application/json" \
-d '{"message": "create a Jira ticket in project ABC titled '\''Login button unresponsive on mobile'\''"}'{
"status": "pending_approval",
"approval_id": "9f8e7d6c-5b4a-3c2d-1e0f-a1b2c3d4e5f6",
"action_plan": {
"connector": "jira",
"tool_name": "create_issue",
"validated_params": {
"project_key": "ABC",
"summary": "Login button unresponsive on mobile",
"description": "Login button unresponsive on mobile",
"issue_type": "Bug"
},
"is_write_operation": true,
"risk_level": "medium"
},
"session_id": "d1e2f3a4-5b6c-7d8e-9f0a-1b2c3d4e5f6a"
}3. 批准该写操作—— 执行并返回结果:
curl -X POST http://localhost:8000/agent/approve/9f8e7d6c-5b4a-3c2d-1e0f-a1b2c3d4e5f6 \
-H "Content-Type: application/json" \
-d '{"reviewer_notes": "Looks good, approved"}'{
"status": "approved",
"result": {
"key": "ABC-123",
"url": "https://your-domain.atlassian.net/browse/ABC-123",
"metadata": {"is_write": true, "connector": "jira", "tool_name": "create_issue"}
},
"run_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
}测试结果
$ pytest --cov=src --cov-report=term-missing tests/
collected 52 items
tests/test_agent.py ............. [ 25%]
tests/test_api.py .................. [ 59%]
tests/test_mcp_servers.py ..................... [100%]
================================ tests coverage ================================
Name Stmts Miss Cover Missing
----------------------------------------------------------------
src/__init__.py 0 0 100%
src/agent/__init__.py 0 0 100%
src/agent/hitl.py 29 1 97% 33
src/agent/state.py 13 0 100%
src/agent/workflow.py 189 5 97% 108, 263-266
src/api/__init__.py 0 0 100%
src/api/main.py 209 3 99% 150-152
src/db/__init__.py 0 0 100%
src/db/database.py 16 0 100%
src/db/init_db.py 16 16 0% 1-24
src/db/models.py 60 0 100%
src/db/vector_search.py 7 0 100%
src/mcp_servers/__init__.py 0 0 100%
src/mcp_servers/common.py 11 0 100%
src/mcp_servers/github_server.py 95 3 97% 7, 175-177
src/mcp_servers/jira_server.py 81 3 96% 7, 168-170
src/mcp_servers/slack_server.py 86 4 95% 7, 144, 161-163
----------------------------------------------------------------
TOTAL 812 35 96%
52 passed in 2.92sHITL 拦截率(在完整测试套件运行后,针对持久化的测试数据库度量,在进行每个测试的截断之前):
指标 | 计数 |
到达 | 9 |
| 9 / 9 (100%) |
在 | 4 |
其中,未经先前 | 0 |
被拒绝且从未执行的写入 | 2 |
每个写操作测试运行都在任何 MCP 工具调用触发之前被 HITL 拦截;没有任何执行在没有匹配的 APPROVED HITLApproval 行的情况下进入 AuditLog。
恢复指标(供参考)
测试期间有 19 次智能体运行持久化到 PostgreSQL
MCP 服务器、智能体和 API 层的测试覆盖率超过 85%
HITL 在测试套件中拦截了 100% 的写操作(0 次未经审查的写入被执行)
This server cannot be deployed
Maintenance
Related MCP Connectors
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
Human-in-the-loop review and approval for AI agents. Audit trail, approval policies, native MCP.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceMCP server that equips AI agents with dev workflow tools including GitHub project management, conventional commits, visual regression testing, Jira/Confluence integration, and a persistent memory knowledge graph.8 npmMIT
- AlicenseCqualityBmaintenanceA policy-aware MCP server for GitHub and GitHub Actions that enables safe AI-assisted infrastructure workflows—inspecting repositories, preparing branches and pull requests, and constrained remote mutations behind explicit preview-bound approval tokens.18MIT
- AlicenseNot gradedqualityBmaintenanceAn MCP-native agentic platform orchestrating planner/executor/critic agents over hybrid RAG with three-tier memory, budget enforcement, safety guardrails, and full observability. It exposes all capabilities as MCP tools, enabling natural-language control of document ingestion, retrieval-augmented generation, and multi-step AI workflows.MIT
- AlicenseBqualityBmaintenanceA security-first MCP gateway that enables AI assistants to safely inspect and interact with GitHub repositories through a controlled, auditable tool layer with policy enforcement and human approval for mutations.27MIT