nex_docus/docs/sdd/specs/DV-0011-mcp-integration/design.md

18 lines
604 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# DV-0011MCP 接入 设计Design
## 上下文
`app/mcp/server.py`、`app/mcp/context.py`、模型 `mcp_bot.py`;挂载于 `main.py``/mcp`
## 数据模型
- `mcp_bots`user_id 唯一、bot_id、bot_secret、status、last_used_at
## 认证
1. X-Bot-Id 查 mcp_bots → 校验 X-Bot-Secret → 映射到用户 → 以该用户执行工具。
## 工具示例
- list_created_projects、create_project 等均经权限判定require_project_read/write_access
## 挂载
- `app.mount("/mcp", MCPHeaderAuthApp(mcp_http_app))`;前端 Nginx 不得对 /mcp 301/302。