MCP 服务器
Archyl 提供模型上下文协议(MCP)服务器,允许 AI 助手与您的架构文档进行交互。这使得强大的 AI 驱动的架构探索和文档编写成为可能。
什么是 MCP?
模型上下文协议(MCP)是一个开放协议,使 AI 助手能够安全地访问外部工具和数据源。通过 Archyl 的 MCP 服务器,您的 AI 助手可以:
- 浏览和查询您的项目及其完整的 C4 模型
- 创建和修改架构元素、关系和图表
- 读取和编写 ADR、文档、API 契约和事件通道
- 在编写代码之前检查合规性规则、漂移评分、DORA 指标和归属信息
- 跟踪发布、变更请求、评论和历史记录
支持的客户端
Archyl 的 MCP 服务器支持以下客户端:
- Antigravity - Google 的 AI 驱动 IDE
- Claude Code - Anthropic 的 CLI 工具
- Claude Desktop - Claude 的桌面应用程序
- Cursor - AI 优先的代码编辑器
- OpenAI Codex - OpenAI 的 AI 编程助手
- VS Code - 配合 GitHub Copilot Chat
- Warp - 集成 AI 的现代终端
- Windsurf - Codeium 的 AI 驱动 IDE
身份认证
API 密钥(推荐)
大多数客户端使用 API 密钥进行身份认证。根据您使用的工具:
- 支持自定义头的工具(Claude Code、Cursor、Warp、Windsurf、Antigravity):使用
X-API-Key头 - 不支持自定义头的工具(Claude Desktop、VS Code、OpenAI Codex):在 URL 中使用
?apiKey=YOUR_API_KEY查询参数
从您的个人资料 → API 密钥页面生成 API 密钥。
密钥的权限范围决定了助手能做什么:只读密钥可以调用所有 list_* 和 get_* 工具,而 create_*、update_*、delete_* 和 import_dsl 需要具有写入权限范围的密钥。给您的智能体一个只读密钥,是让它探索您的架构而无法修改架构的最简单方式。
OAuth 2.1
服务器还实现了带动态客户端注册的 OAuth 2.1,适用于通过浏览器登录而非粘贴密钥进行连接的客户端(mcp:read 和 mcp:write 权限范围与上述 API 密钥权限范围一致)。将此类客户端指向同一端点,它会通过以下地址自动发现认证流程:
https://api.archyl.com/.well-known/oauth-authorization-server
https://api.archyl.com/.well-known/oauth-protected-resource
设置
Antigravity
- 打开 Antigravity 并点击 Agent 面板中的 "..." 菜单
- 选择 "MCP Servers" > "Manage MCP Servers" > "View raw config"
- 添加到
~/.gemini/antigravity/mcp_config.json:
{
"mcpServers": {
"archyl": {
"serverUrl": "https://api.archyl.com/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
- 重启 Antigravity 以应用更改
注意:Antigravity 对 HTTP 类型的 MCP 服务器使用 serverUrl 而非 url。
Claude Code
在项目根目录创建 .mcp.json 文件:
{
"mcpServers": {
"archyl": {
"type": "http",
"url": "https://api.archyl.com/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
运行 Claude Code — 它会自动检测 MCP 服务器。
Claude Desktop
- 打开 Claude Desktop 设置
- 导航到开发者 → MCP 服务器
- 点击"添加服务器"并添加:
{
"mcpServers": {
"archyl": {
"url": "https://api.archyl.com/mcp?apiKey=YOUR_API_KEY"
}
}
}
- 重启 Claude Desktop
注意:Claude Desktop 远程连接器不支持自定义头,因此 API 密钥必须作为 URL 查询参数传递。
Cursor
在项目中创建 .cursor/mcp.json 文件:
{
"mcpServers": {
"archyl": {
"url": "https://api.archyl.com/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
重启 Cursor 以加载 MCP 服务器。
OpenAI Codex
打开或创建 ~/.codex/config.toml 并添加:
[mcp_servers.archyl]
url = "https://api.archyl.com/mcp?apiKey=YOUR_API_KEY"
重启 Codex CLI 或 IDE 以应用更改。
VS Code
- 打开 VS Code 设置(Cmd/Ctrl + ,)
- 搜索 "MCP" 并点击 "在 settings.json 中编辑"
- 添加:
{
"mcp": {
"servers": {
"archyl": {
"url": "https://api.archyl.com/mcp?apiKey=YOUR_API_KEY"
}
}
}
}
Warp
- 打开 Warp 并前往设置 > MCP 服务器
- 点击"添加服务器"并粘贴配置:
{
"archyl": {
"url": "https://api.archyl.com/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
- 重启 Warp 以应用更改
Windsurf
打开 MCP 配置文件 ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"archyl": {
"serverUrl": "https://api.archyl.com/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
重启 Windsurf 以应用更改。
工具参考
服务器提供 189 个工具。它们遵循可预测的命名规范,因此助手通常能够猜到正确的工具:
| 前缀 | 作用 | 所需权限范围 |
|---|---|---|
list_* |
列出某一类型的条目,通常在项目范围内 | 读取 |
get_* |
获取单个条目的完整信息及其关联 | 读取 |
create_* |
创建新条目 | 写入 |
update_* |
修改现有条目 | 写入 |
delete_* |
删除条目(及其从属项) | 写入 |
link_* / unlink_* |
将制品关联到 C4 元素或取消关联 | 写入 |
大多数项目范围的工具需要 projectId;元素范围的工具需要 elementId 和 elementType(C4 层级:1 = 系统,2 = 容器,3 = 组件,4 = 代码)。请先让您的助手调用 list_projects —— 它会从中获取所需的 ID。
您的客户端会通过
tools/list自动发现此列表,因此它始终与服务器保持同步。下面的表格供人工查阅,以决定应该提出什么请求。
工具配置文件
189 个工具超出了执行限定任务的编码代理所需——全部公开会消耗上下文。在 MCP URL 后附加 ?profile=coding(或发送 X-Archyl-Tool-Profile: coding 请求头),即可将工具面缩减为 16 个:任务聚焦的上下文、Harness 工作会话循环以及一致性/差异检查。省略该参数(或使用 profile=full)则获得完整目录。
智能体上下文 (4)
从这里开始:这些工具只需一次调用,就能让助手掌握整体架构全貌,无需多次调用。
| Tool | Description |
|---|---|
get_agent_context |
Get the complete architectural context for a project: C4 model, ADRs, tech stack, guardrails, API contracts, and event channels |
find_relevant_context |
Given a natural-language task, return ONLY the architecture elements relevant to it (ranked), their connected neighbours, the decisions (ADRs) and… |
get_project_c4_model |
Get the complete C4 model for a project including all systems, containers, components, code elements, and relationships |
impact_of |
Compute the blast radius of changing a C4 element: the dependents that are AFFECTED if it changes, the dependencies it relies on, and the distinct… |
Harness 工作会话 (8)
面向编码代理的受治理工作循环:声明一个工作单元以获取聚焦的上下文和建议性锁,工作期间发送心跳,并以可开启架构变更请求的结果收尾。 另有项目记忆:为后续工作者记住事实,并召回先前会话学到的内容。
| Tool | Description |
|---|---|
plan_work |
Produce an architecture-aware implementation plan for a task: ordered steps grounded in the documented C4 model, with the ADRs and guardrails that… |
start_work_session |
Declare a unit of work BEFORE starting it |
heartbeat_work_session |
Mark an active work session as still alive |
finish_work_session |
Close a work session with what actually happened: a summary, the decisions worth recording, and follow-ups |
list_work_sessions |
List a project's harness work sessions — who is (or was) working on what, with the elements each session holds leases on |
remember |
Store a memory for future workers: a convention, a pitfall, or a fact worth knowing about an element or the project |
recall |
Search the project's memory: session outcomes, notes, conventions and pitfalls left by previous agents and humans |
confirm_memory |
Re-attest a memory you just verified in the code or at runtime: bumps its confirmation count and resets its freshness, so it keeps outranking stale… |
项目 (7)
| Tool | Description |
|---|---|
list_projects |
List all architecture projects the user has access to |
get_project |
Get detailed information about a specific project including its C4 model overview |
create_project |
Create a new architecture project |
update_project |
Update an existing project's details |
delete_project |
Delete a project and all its associated data (systems, containers, components, relationships) |
get_project_settings |
Get the settings for a project (discovery config, PR settings, layout preferences, etc.) |
update_project_settings |
Update project settings such as diagram layout, code level visibility, request mode, etc |
组织与团队 (5)
| Tool | Description |
|---|---|
list_organizations |
List organizations the user belongs to |
get_organization |
Get detailed information about an organization |
list_teams |
List teams in an organization |
get_team |
Get detailed information about a team |
create_team |
Create a new team in an organization |
C4 元素 (15)
系统(第 1 层)、容器(第 2 层)、组件(第 3 层)和代码元素(第 4 层)。
| Tool | Description |
|---|---|
list_systems |
List all C4 Systems in a project |
create_system |
Create a new C4 System (Level 1) in a project |
update_system |
Update an existing C4 System |
delete_system |
Delete a C4 System and all its containers, components, and code elements |
list_containers |
List all C4 Containers in a system |
create_container |
Create a new C4 Container (Level 2) in a system |
update_container |
Update an existing C4 Container |
delete_container |
Delete a C4 Container and all its components and code elements |
list_components |
List all C4 Components in a container |
create_component |
Create a new C4 Component (Level 3) in a container |
update_component |
Update an existing C4 Component |
delete_component |
Delete a C4 Component and all its code elements |
create_code_element |
Create a new C4 Code Element (Level 4) in a component |
update_code_element |
Update an existing C4 Code Element |
delete_code_element |
Delete a C4 Code Element |
关系 (4)
| Tool | Description |
|---|---|
list_relationships |
List all relationships in a project |
create_relationship |
Create a relationship (connection) between two C4 elements |
update_relationship |
Update an existing relationship |
delete_relationship |
Delete a relationship between C4 elements |
图表布局与叠加层 (5)
| Tool | Description |
|---|---|
update_positions |
Batch update positions of C4 elements on the diagram (systems, containers, components, code elements, overlays) |
list_overlays |
List all overlays in a project |
create_overlay |
Create a visual overlay (grouping) on the diagram |
update_overlay |
Update an existing overlay |
delete_overlay |
Delete an overlay |
文档 (11)
| Tool | Description |
|---|---|
list_documentation |
List project documentation |
get_documentation |
Get detailed information about a documentation item |
create_documentation |
Create a new documentation item |
update_documentation |
Update an existing documentation item |
delete_documentation |
Delete a documentation item |
move_documentation |
Move a documentation item to a folder and/or position |
list_documentation_folders |
List folders for a project |
create_documentation_folder |
Create a new documentation folder |
update_documentation_folder |
Rename a documentation folder |
move_documentation_folder |
Move a documentation folder to a new parent and/or position |
delete_documentation_folder |
Delete a documentation folder (children and docs are reparented to the parent folder) |
架构决策记录 (6)
| Tool | Description |
|---|---|
list_adrs |
List Architecture Decision Records in a project |
get_adr |
Get detailed information about an Architecture Decision Record |
create_adr |
Create a new Architecture Decision Record |
update_adr |
Update an existing Architecture Decision Record |
delete_adr |
Delete an Architecture Decision Record |
link_adr_to_element |
Link an ADR to a C4 element (system, container, component, or code) |
API 契约 (8)
OpenAPI、gRPC、GraphQL、AsyncAPI 和 MCP 工具契约。
| Tool | Description |
|---|---|
list_api_contracts |
List API contracts for a project |
list_api_contracts_by_element |
List API contracts linked to a specific C4 element |
get_api_contract |
Get a single API contract with its links to C4 elements |
create_api_contract |
Create a new API contract (OpenAPI, gRPC, GraphQL, AsyncAPI, or MCP tools) |
update_api_contract |
Update an existing API contract |
delete_api_contract |
Delete an API contract and all its links |
link_api_contract |
Link an API contract to a C4 element (system, container, component, or code) |
unlink_api_contract |
Remove a link between an API contract and a C4 element |
事件通道 (8)
| Tool | Description |
|---|---|
list_event_channels |
List event channels (producers/consumers) for a project |
list_event_channels_by_element |
List event channels linked to a specific C4 element |
get_event_channel |
Get a single event channel with its links to C4 elements |
create_event_channel |
Create a new event channel (producer or consumer) |
update_event_channel |
Update an existing event channel |
delete_event_channel |
Delete an event channel and all its links |
link_event_channel |
Link an event channel to a C4 element (system, container, component, or code) |
unlink_event_channel |
Remove a link between an event channel and a C4 element |
流程与白板 (8)
| Tool | Description |
|---|---|
list_flows |
List user/system flows in the organization |
get_flow |
Get detailed information about a flow including its steps |
create_flow |
Create a new user/system flow diagram |
delete_flow |
Delete a flow |
list_whiteboards |
List whiteboards in the organization |
get_whiteboard |
Get detailed information about a whiteboard |
create_whiteboard |
Create a new whiteboard for free-form diagramming |
delete_whiteboard |
Delete a whiteboard |
评论与讨论 (11)
| Tool | Description |
|---|---|
list_comments |
List all comments for a project with pagination |
list_comments_by_element |
List comments for a specific C4 element |
get_comment |
Get a single comment by ID with its replies |
get_comment_count |
Get the number of comments for a C4 element |
create_comment |
Create a new comment on a project or C4 element |
update_comment |
Update an existing comment (only the author can update) |
delete_comment |
Delete a comment (only the author can delete) |
resolve_comment |
Mark a comment thread as resolved |
unresolve_comment |
Mark a comment thread as unresolved (reopen) |
add_comment_reaction |
Add a reaction emoji to a comment |
remove_comment_reaction |
Remove a reaction emoji from a comment |
归属 (6)
| Tool | Description |
|---|---|
who_owns |
Find the user and team owners of a C4 element |
get_ownership_map |
Get the global ownership map showing all C4 elements across the organization with their team and user ownership data, plus coverage statistics |
get_element_owners |
Get the owners of a C4 element (system, container, component, or code element) |
set_element_owners |
Set the owners of a C4 element (replaces existing owners) |
add_element_owner |
Add a single owner to a C4 element |
remove_element_owner |
Remove an owner from a C4 element |
技术与技术雷达 (10)
| Tool | Description |
|---|---|
list_technologies |
List all technologies in the organization, optionally filtered by category or search term |
get_technology |
Get detailed information about a specific technology |
create_technology |
Create a new technology in the organization |
update_technology |
Update an existing technology |
delete_technology |
Delete a technology and all its element/relationship links |
get_technology_radar |
Get the technology radar data showing all technologies with their usage counts across elements and relationships |
get_element_technologies |
Get technologies linked to a C4 element (system, container, or component) |
set_element_technologies |
Set the technologies linked to a C4 element (replaces existing links) |
get_relationship_technologies |
Get technologies linked to a C4 relationship |
set_relationship_technologies |
Set the technologies linked to a C4 relationship (replaces existing links) |
发布与环境 (10)
| Tool | Description |
|---|---|
list_releases |
List releases for a project with optional filters |
get_release |
Get detailed information about a specific release |
create_release |
Create a new release for a project |
update_release |
Update an existing release |
delete_release |
Delete a release |
list_environments |
List deployment environments for a project, ordered by position |
create_environment |
Create a new deployment environment for a project |
update_environment |
Update an existing deployment environment |
delete_environment |
Delete a deployment environment |
reorder_environments |
Reorder environments for a project by providing the environment IDs in the desired order |
架构变更请求 (6)
| Tool | Description |
|---|---|
list_requests |
List architecture change requests for a project |
get_request |
Get detailed information about an architecture change request including its changes and reviews |
create_request |
Create a new architecture change request |
update_request |
Update the title or description of an architecture change request (author only, not merged) |
list_request_changes |
List all changes in an architecture change request |
list_request_reviews |
List all reviews for an architecture change request |
合规性规则 (9)
| Tool | Description |
|---|---|
list_conformance_rules |
List architecture conformance rules for the organization, with optional project filter |
get_conformance_rule |
Get detailed information about a conformance rule |
create_conformance_rule |
Create a new architecture conformance rule |
update_conformance_rule |
Update a conformance rule's name, description, severity, or config |
delete_conformance_rule |
Delete a conformance rule |
run_conformance_check |
Run conformance rules against changed files and return a violation report |
list_conformance_checks |
List recent conformance checks for a project |
get_conformance_report |
Get the full report for a conformance check, including all violations |
get_conformance_stats |
Get conformance statistics for a project (total checks, pass/fail rate, latest status) |
漂移检测 (4)
| Tool | Description |
|---|---|
get_drift_score |
Get the latest drift score for a project |
compute_drift_score |
Trigger a drift score computation for a project |
get_drift_details |
Get the per-element drift breakdown for a specific score computation |
get_drift_history |
Get the drift score trend over time for a project |
DORA 指标、ROI 与预测 (4)
| Tool | Description |
|---|---|
get_dora_metrics |
Calculate DORA metrics (Deployment Frequency, Lead Time for Changes, Change Failure Rate, Mean Time to Restore) for a project |
get_dora_trend |
Get DORA metrics trend over time, bucketed by day, week, or month |
compute_architecture_roi |
Quantify the financial impact of architecture decisions |
get_predictions |
Analyze drift trends, DORA trajectories, conformance decay, and complexity growth to forecast risks and recommend preventive actions |
历史记录与时间旅行 (5)
| Tool | Description |
|---|---|
list_history |
List change history entries for the organization, optionally filtered by project, entity name, user, or action |
list_versions |
List all time-travel versions (snapshots) for a project, ordered by version number descending |
get_version |
Get a specific version by project ID and version number, including the full snapshot data and changes |
diff_version |
Compare a version with another version or the current live state |
analyze_architecture_diff |
AI-powered analysis of a git diff to detect architecture changes |
洞察 (3)
| Tool | Description |
|---|---|
list_insights |
List AI-generated architecture insights |
get_insight |
Get detailed information about an insight |
silence_insight |
Silence an insight to hide it from the list |
市场与小组件 (15)
| Tool | Description |
|---|---|
list_marketplace_products |
List all available marketplace integration products (Datadog, GitHub, GitLab, SonarQube, etc.) |
get_marketplace_product |
Get detailed information about a marketplace product including its configuration schema |
list_marketplace_connections |
List all configured marketplace connections for the organization |
get_marketplace_connection |
Get detailed information about a specific marketplace connection |
create_marketplace_connection |
Create a new marketplace connection to an integration product |
update_marketplace_connection |
Update an existing marketplace connection |
delete_marketplace_connection |
Delete a marketplace connection and all its associated widgets |
list_marketplace_widgets |
List marketplace widgets for a project |
list_marketplace_widgets_by_element |
List marketplace widgets linked to a specific C4 element |
get_marketplace_widget |
Get detailed information about a specific marketplace widget |
create_marketplace_widget |
Create a new marketplace widget for a project |
update_marketplace_widget |
Update an existing marketplace widget |
delete_marketplace_widget |
Delete a marketplace widget |
list_organization_widgets |
List marketplace widgets scoped to the organization (not project-specific) |
create_organization_widget |
Create a new marketplace widget scoped to the organization (not project-specific) |
Webhook (7)
| Tool | Description |
|---|---|
list_webhook_notifications |
List all outgoing webhook notification configurations for the organization |
get_webhook_notification |
Get detailed information about a specific webhook notification configuration |
create_webhook_notification |
Create a new outgoing webhook notification |
update_webhook_notification |
Update an existing webhook notification configuration |
delete_webhook_notification |
Delete a webhook notification and all its delivery history |
test_webhook_notification |
Send a test event to a webhook endpoint to verify it is configured correctly |
list_webhook_deliveries |
List recent delivery history for a webhook notification, including status and response codes |
组织级架构 (9)
跨项目视图和组织级制品。
| Tool | Description |
|---|---|
list_global_systems |
List all C4 systems across all projects in the organization (global architecture view) |
list_global_relationships |
List all C4 relationships visible in the global architecture view |
list_global_adrs |
List organization-level Architecture Decision Records (not scoped to a specific project) |
create_global_adr |
Create an organization-level Architecture Decision Record |
list_global_docs |
List organization-level documentation (not scoped to a specific project) |
create_global_doc |
Create an organization-level documentation page |
list_global_api_contracts |
List organization-level API contracts (not scoped to a specific project) |
create_global_api_contract |
Create an organization-level API contract |
list_global_comments |
List organization-level discussion comments (not scoped to a specific project) |
架构即代码 (1)
| Tool | Description |
|---|---|
import_dsl |
Import architecture from a DSL format (Archyl YAML, Structurizr DSL, LikeC4, IcePanel JSON, or Backstage catalog JSON) into a project |
对话示例
探索架构
您:"我的电商项目中有哪些系统?"
AI:使用 list_systems 工具 "您的电商项目有 4 个系统:网上商店、支付服务、库存系统和通知服务……"
创建元素
您:"在网上商店系统中添加一个名为 Redis 缓存的新容器,用于会话存储"
AI:使用 create_container 工具 "我已经在网上商店系统中创建了 Redis 缓存容器,描述为'用于会话存储的内存缓存'。"
文档
您:"为我们选择 PostgreSQL 而非 MongoDB 的决策创建一个 ADR"
AI:使用 create_adr 工具 "我已经创建了 ADR-001:数据库技术选型,记录了选择 PostgreSQL 的决策,因为它具有 ACID 合规性和灵活的查询能力……"
编写代码之前
您:"我准备为结账流程添加限流功能。我需要了解什么?"
AI:使用 find_relevant_context 和 impact_of 工具 "结账流程涉及 API 网关和订单服务。修改网关会影响 6 个下游容器。ADR-014 已经规定使用 Redis 进行限流,并且有一条合规性规则禁止新增对旧版会话存储的依赖……"
治理检查
您:"我们是否偏离了已记录的架构?"
AI:使用 get_drift_score 和 run_conformance_check 工具 "漂移评分为 82%(上个月为 91%,有所下降)。存在两处违规:搜索服务直接调用订单数据库,支付服务使用了未经批准的 HTTP 客户端……"
端点
流式 HTTP(MCP)
https://api.archyl.com/mcp
使用此端点将您的 AI 助手连接到 Archyl 的架构文档。它支持流式 HTTP 传输协议。
故障排除
连接失败
- 检查您的 API 密钥是否有效
- 确保端点 URL 正确
- 检查网络连接
认证失败
- 对于支持自定义头的工具:验证
X-API-Key头是否正确设置 - 对于不支持自定义头的工具:验证 URL 中的
?apiKey=查询参数 - 确保您的 API 密钥未过期
工具未找到
- 确保使用了正确的工具名称 —— 参见工具参考,或让您的客户端刷新其工具列表
- 某些客户端会缓存
tools/list;升级后请重启客户端
写入工具被拒绝
create_*、update_*、delete_*和import_dsl需要具有写入权限范围的 API 密钥 —— 只读密钥只能调用list_*和get_*- 检查您的订阅套餐:某些功能(Webhook、市场连接、托管智能体运行)受套餐限制
Antigravity 相关问题
- 确保在配置中使用
serverUrl(而非url) - 配置文件位置为
~/.gemini/antigravity/mcp_config.json
OpenAI Codex 相关问题
- 确保
~/.codex/config.toml中的 TOML 语法正确 - 使用
[mcp_servers.archyl]作为表名
Warp 相关问题
- 导航到设置 > MCP 服务器管理配置
- 更改配置后重启 Warp
最佳实践
描述要具体
当要求 AI 修改架构时,请具体说明:
- 包含项目名称
- 指定元素类型
- 提供描述
审查变更
始终审查 AI 创建的元素:
- 检查名称和描述是否准确
- 验证关系是否正确
- 根据需要进行更新
用于探索
MCP 非常适合:
- 快速探索大型架构
- 生成初始文档
- 回答有关系统的问题