Skip to content

Commit ec00a97

Browse files
sunnylqmclaude
andcommitted
feat(mcp): 外部 Agent / MCP 连接管理页
创建/查看/撤销 MCP 访问令牌:scope 与应用范围可选(默认最小两项 scope)、 有效期默认 90 天(服务端上限 365)、明文只在创建后弹窗显示一次,并直接给出 可粘贴的客户端配置片段。 端点地址取自 services/request 新增的 resolveApiBaseUrl(),跟当前会话实际 连接的 API 基址走——生产构建里 process.env.PUBLIC_API 不会被替换,页面里 自己拼常量会在切换端点/自部署时给出错误地址。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent af7c393 commit ec00a97

9 files changed

Lines changed: 624 additions & 2 deletions

File tree

src/components/top-navigation/index.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
ApiOutlined,
23
AppstoreOutlined,
34
DashboardOutlined,
45
FileTextOutlined,
@@ -115,6 +116,15 @@ export default function TopNavigation({
115116
<Link to={rootRouterPath.apiTokens}>{t('nav.api_tokens')}</Link>
116117
),
117118
},
119+
{
120+
key: 'mcp-connections',
121+
icon: <ApiOutlined />,
122+
label: (
123+
<Link to={rootRouterPath.mcpConnections}>
124+
{t('nav.mcp_connections')}
125+
</Link>
126+
),
127+
},
118128
{
119129
key: 'members',
120130
icon: <TeamOutlined />,

src/i18n/locales/en.json

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,65 @@
288288
"all_apps": "All apps",
289289
"n_apps": "{{count}} app(s)"
290290
},
291+
"mcp": {
292+
"title": "External agents / MCP",
293+
"description": "Connect Pushy's read-only diagnostics to your own AI client.",
294+
"docs_link": "Read the guide",
295+
"create_token": "Create MCP token",
296+
"create_modal_title": "Create MCP token",
297+
"endpoint_label": "MCP endpoint",
298+
"privacy_notice": "Results go to the client you authorize, which may forward them to the model provider you chose. Grant only the apps you need to debug.",
299+
"token_name": "Token name",
300+
"token_name_required": "Please enter a token name",
301+
"token_name_placeholder": "e.g. troubleshooting",
302+
"client_id": "Client label",
303+
"client_id_required": "Please enter a client label",
304+
"client_id_hint": "Name of the client that will connect; used for display and audit attribution only",
305+
"scopes": "Scopes",
306+
"scopes_required": "Select at least one scope",
307+
"scopes_hint": "The two defaults cover release topology and update diagnosis",
308+
"scope_pushy_apps_read": "List authorized apps",
309+
"scope_pushy_diagnose": "Release topology, update decisions and artifact states",
310+
"scope_pushy_health_read": "Version health (not available yet)",
311+
"scope_pushy_metrics_read": "Metrics queries (not available yet)",
312+
"scope_pushy_quota_read": "Quota status (not available yet)",
313+
"scope_pushy_audit_read": "Audit summaries (elevated, not available yet)",
314+
"scope_pushy_nodes_read": "Self-hosted node status (elevated, not available yet)",
315+
"apps_hint": "Empty = every app of the account; granting only the apps you debug is strongly recommended",
316+
"all_apps": "All apps",
317+
"n_apps": "{{count}} app(s)",
318+
"expiration": "Expiry",
319+
"expiration_hint": "The server caps this at 365 days; just reissue when it expires",
320+
"exp_days": "{{count}} days",
321+
"create_button": "Create",
322+
"create_success": "MCP token created",
323+
"create_failed": "Creation failed",
324+
"created_title": "Token created",
325+
"created_ok": "Saved it",
326+
"created_warning": "This token is shown only once — copy it now.",
327+
"client_config_hint": "Client configuration example (Claude Desktop and friends):",
328+
"copy_button": "Copy token",
329+
"copied": "Copied to clipboard",
330+
"col_name": "Name",
331+
"col_client": "Client",
332+
"col_token": "Token",
333+
"col_scopes": "Scopes",
334+
"col_apps": "Apps",
335+
"col_expires": "Expires",
336+
"col_last_used": "Last used",
337+
"col_action": "Action",
338+
"revoked": "Revoked",
339+
"expired": "Expired",
340+
"never": "Never",
341+
"never_used": "Never used",
342+
"revoke_button": "Revoke",
343+
"revoke_title": "Revoke this token?",
344+
"revoke_desc": "Clients using it disconnect immediately.",
345+
"revoke_success": "Token revoked",
346+
"revoke_failed": "Revocation failed",
347+
"yes": "Yes",
348+
"no": "No"
349+
},
291350
"audit_logs": {
292351
"status_all": "All Statuses",
293352
"status_2xx": "2xx Success",
@@ -678,7 +737,8 @@
678737
"theme_auto": "Follow system",
679738
"theme_light": "Light",
680739
"theme_dark": "Dark",
681-
"members": "Team"
740+
"members": "Team",
741+
"mcp_connections": "External agents / MCP"
682742
},
683743
"app_drawer": {
684744
"expand": "Expand app list",

src/i18n/locales/zh-CN.json

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,65 @@
288288
"all_apps": "全部应用",
289289
"n_apps": "{{count}} 个应用"
290290
},
291+
"mcp": {
292+
"title": "外部 Agent / MCP",
293+
"description": "把 Pushy 的只读诊断能力接到你自己的 AI 客户端。",
294+
"docs_link": "查看接入文档",
295+
"create_token": "创建 MCP 令牌",
296+
"create_modal_title": "创建 MCP 令牌",
297+
"endpoint_label": "MCP 服务地址",
298+
"privacy_notice": "返回的数据会交给你授权的客户端,它可能继续发送给你选择的模型供应商。请只勾选需要排查的应用。",
299+
"token_name": "令牌名称",
300+
"token_name_required": "请输入令牌名称",
301+
"token_name_placeholder": "例如:排障用",
302+
"client_id": "客户端标识",
303+
"client_id_required": "请输入客户端标识",
304+
"client_id_hint": "填写将要连接的客户端名称,仅用于展示与审计归因",
305+
"scopes": "授权范围(scope)",
306+
"scopes_required": "请至少选择一个 scope",
307+
"scopes_hint": "默认两项即可完成发布拓扑与更新判定的排查",
308+
"scope_pushy_apps_read": "读取已授权应用列表",
309+
"scope_pushy_diagnose": "发布拓扑、更新判定与产物状态",
310+
"scope_pushy_health_read": "版本健康度(尚未开放)",
311+
"scope_pushy_metrics_read": "指标查询(尚未开放)",
312+
"scope_pushy_quota_read": "配额状态(尚未开放)",
313+
"scope_pushy_audit_read": "审计摘要(需高权限,尚未开放)",
314+
"scope_pushy_nodes_read": "自托管节点状态(需高权限,尚未开放)",
315+
"apps_hint": "不选 = 账户下全部应用;强烈建议只勾选需要排查的应用",
316+
"all_apps": "全部应用",
317+
"n_apps": "{{count}} 个应用",
318+
"expiration": "有效期",
319+
"expiration_hint": "服务端上限 365 天;到期后重新签发即可",
320+
"exp_days": "{{count}} 天",
321+
"create_button": "创建",
322+
"create_success": "MCP 令牌创建成功",
323+
"create_failed": "创建失败",
324+
"created_title": "令牌创建成功",
325+
"created_ok": "我已保存",
326+
"created_warning": "令牌只显示这一次,请立即复制保存。",
327+
"client_config_hint": "客户端配置示例(Claude Desktop 等):",
328+
"copy_button": "复制令牌",
329+
"copied": "已复制到剪贴板",
330+
"col_name": "名称",
331+
"col_client": "客户端",
332+
"col_token": "令牌",
333+
"col_scopes": "授权范围",
334+
"col_apps": "应用范围",
335+
"col_expires": "到期",
336+
"col_last_used": "最后使用",
337+
"col_action": "操作",
338+
"revoked": "已撤销",
339+
"expired": "已过期",
340+
"never": "永不过期",
341+
"never_used": "从未使用",
342+
"revoke_button": "撤销",
343+
"revoke_title": "确定撤销此令牌?",
344+
"revoke_desc": "撤销后使用该令牌的客户端会立即断开。",
345+
"revoke_success": "令牌已撤销",
346+
"revoke_failed": "撤销失败",
347+
"yes": "确定",
348+
"no": "取消"
349+
},
291350
"audit_logs": {
292351
"status_all": "全部状态",
293352
"status_2xx": "2xx 成功",
@@ -678,7 +737,8 @@
678737
"theme_auto": "跟随系统",
679738
"theme_light": "浅色",
680739
"theme_dark": "深色",
681-
"members": "团队"
740+
"members": "团队",
741+
"mcp_connections": "外部 Agent / MCP"
682742
},
683743
"app_drawer": {
684744
"expand": "展开应用列表",

0 commit comments

Comments
 (0)