github / github/copilot-sdk

MCP discovery exposes no launch config or source path — blocks viewing/editing discovered servers

Đang mở
#1,518 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Java
Star
10.5k
Fork
1.5k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
129

Mô tả

## Summary

When a session discovers MCP servers (`mcp.discover` / the session `McpServerList`), the returned shapes expose only **identity and status** — not the **resolved launch config** (command/args/url/env/headers) nor the **origin file path** of the declaration. This makes it impossible for an SDK consumer to (a) show *where* a discovered server came from, or (b) offer **edit / override** of a discovered workspace/plugin server, because the consumer never receives the config it would need to display or round-trip.

## Current shapes (from `dist/generated/rpc.d.ts` / `session-events.d.ts`, beta.9)

```ts
// DiscoveredMcpServer (rpc.d.ts ~2657)
{ name: string; type?: string; source: McpServerSource; enabled: boolean }

// McpServer (rpc.d.ts ~4148)
{ name: string; status: string; source?: McpServerSource; error?: string }

// McpServerSource (session-events.d.ts)
type McpServerSource = "user" | "workspace" | "plugin" | "builtin";
```

None of these carry:

- the resolved **launch configuration** — `command` / `args` / `env` for stdio, or `url` / `headers` / `type` for http/sse;
- the **origin file path** (e.g. which `.mcp.json` / `.github/mcp.json` the entry came from), only a coarse `source` enum.

`mcp.config.enable/disable` is enough to toggle a discovered server (and persists — thank you), but **viewing and editing** a discovered server's definition is not possible from the SDK surface.

## Ask

Extend the discovery surface so consumers can render and edit discovered servers. Either is fine:

1. Add the resolved config + origin to `DiscoveredMcpServer` (and/or `McpServer`), e.g.

```ts
{
name: string;
source: McpServerSource;
enabled: boolean;
// new:
config?: McpServerConfig; // command/args/env | url/headers/type
sourcePath?: string; // absolute path of the declaring file
}
```

2. Or add a dedicated rpc, e.g. `mcp.config.get({ name })` → resolved config + origin path, so consumers can fetch on demand.

Either unlocks: showing the source file in a server detail view, and an **edit/override** affordance for discovered workspace/plugin servers (today only `user`-source servers we wrote ourselves can be edited, because we hold their config; discovered ones are opaque).

## Context / why

We're a desktop UI (Dafman) over the Copilot agent. Users expect to see where a discovered MCP server is defined and to tweak its args/env without hand-editing JSON files they may not know the location of. Toggle persistence already works; this is the remaining gap for a full MCP management UI.

(Filed from downstream tracking issue AsafMah/dafman#9. Happy to provide a repro or test against a beta.)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Đọc dist/generated/rpc.d.ts và session-events.d.ts, sau đó theo dõi các shape của mcp.discover và session McpServerList cùng với mcp.config.enable/disable. Xác định xem phản hồi discovery hay một mcp.config.get RPC mới cung cấp tốt hơn cấu hình stdio hoặc HTTP/SSE đã được resolve và đường dẫn đến tệp khai báo cấu hình đó; hoàn tất nghĩa là các consumer có thể xem nguồn gốc và chỉnh sửa hoặc ghi đè các server được phát hiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
api
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.