Skip to content

Commit f61d1fe

Browse files
docs(mcp-apps): address worth-doing review feedback
- python: add enable_mcp_apps entries to create_session and resume_session docstring Args lists, describing the runtime gate and the capabilities.ui.mcpApps detection mechanism. - java: thread sessionId through warnIfMcpAppsDropped and include it in the warning message, matching the Python/Go/.NET/Rust pattern for multi-session debugging. - nodejs/test: replace the 'see review feedback' marker in the sandbox sanitization section header with a self-contained reference to SEP-1865 \xc2\xa7Security Implications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3d41f8e commit f61d1fe

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

java/src/main/java/com/github/copilot/sdk/CopilotClient.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ private static boolean isUnsupportedConnectMethod(JsonRpcException ex) {
300300
* a consumer trying to use MCP Apps would see no error -- just tools that never
301301
* expose {@code _meta.ui.resourceUri}.
302302
*/
303-
private static void warnIfMcpAppsDropped(boolean requested, SessionCapabilities capabilities) {
303+
private static void warnIfMcpAppsDropped(boolean requested, SessionCapabilities capabilities, String sessionId) {
304304
if (!requested) {
305305
return;
306306
}
@@ -309,7 +309,8 @@ private static void warnIfMcpAppsDropped(boolean requested, SessionCapabilities
309309
if (advertised) {
310310
return;
311311
}
312-
LOG.warning("enableMcpApps was requested but the runtime did not advertise capabilities.ui.mcpApps. "
312+
LOG.warning("Session " + sessionId
313+
+ ": enableMcpApps was requested but the runtime did not advertise capabilities.ui.mcpApps. "
313314
+ "The runtime's MCP_APPS feature flag or COPILOT_MCP_APPS=true environment override is "
314315
+ "likely unset; the MCP Apps surface is unavailable for this session.");
315316
}
@@ -491,7 +492,7 @@ public CompletableFuture<CopilotSession> createSession(SessionConfig config) {
491492
rpcNanos);
492493
session.setWorkspacePath(response.workspacePath());
493494
session.setCapabilities(response.capabilities());
494-
warnIfMcpAppsDropped(config.isEnableMcpApps(), response.capabilities());
495+
warnIfMcpAppsDropped(config.isEnableMcpApps(), response.capabilities(), sessionId);
495496
// If the server returned a different sessionId (e.g. a v2 CLI that ignores
496497
// the client-supplied ID), re-key the sessions map.
497498
String returnedId = response.sessionId();
@@ -577,7 +578,7 @@ public CompletableFuture<CopilotSession> resumeSession(String sessionId, ResumeS
577578
rpcNanos);
578579
session.setWorkspacePath(response.workspacePath());
579580
session.setCapabilities(response.capabilities());
580-
warnIfMcpAppsDropped(config.isEnableMcpApps(), response.capabilities());
581+
warnIfMcpAppsDropped(config.isEnableMcpApps(), response.capabilities(), sessionId);
581582
// If the server returned a different sessionId than what was requested, re-key.
582583
String returnedId = response.sessionId();
583584
if (returnedId != null && !returnedId.equals(sessionId)) {

nodejs/test/mcpAppsSandbox.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ describe("buildMcpAppsCspHeader", () => {
7373
});
7474

7575
// ------------------------------------------------------------------
76-
// Domain-input sanitization (defends against CSP directive injection
77-
// from malicious or sloppy MCP servers — see review feedback).
76+
// Domain-input sanitization per SEP-1865 §Security Implications:
77+
// server-supplied CSP domain entries must be validated before
78+
// interpolation to prevent directive injection.
7879
// ------------------------------------------------------------------
7980

8081
it("drops entries containing CSP metacharacters that would inject a sibling directive", () => {

python/copilot/client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,13 @@ async def create_session(
16441644
session. Optionally associates repository metadata with the
16451645
cloud session.
16461646
on_event: Callback for session events.
1647+
enable_mcp_apps: Opt into MCP Apps (SEP-1865) UI passthrough.
1648+
When True, the SDK sends ``requestMcpApps: True`` on
1649+
``session.create``. The runtime only honors the opt-in when its
1650+
``MCP_APPS`` feature flag (or ``COPILOT_MCP_APPS=true`` env
1651+
override) is on; otherwise the request is silently dropped.
1652+
Inspect ``capabilities.ui.mcpApps`` on the create response to
1653+
detect the drop (the SDK also logs a warning).
16471654
16481655
Returns:
16491656
A :class:`CopilotSession` instance for the new session.
@@ -2020,6 +2027,13 @@ async def resume_session(
20202027
disabled_skills: Skills to disable.
20212028
infinite_sessions: Infinite session configuration.
20222029
on_event: Callback for session events.
2030+
enable_mcp_apps: Opt into MCP Apps (SEP-1865) UI passthrough on
2031+
resume. When True, the SDK sends ``requestMcpApps: True`` on
2032+
``session.resume``. The runtime only honors the opt-in when its
2033+
``MCP_APPS`` feature flag (or ``COPILOT_MCP_APPS=true`` env
2034+
override) is on; otherwise the request is silently dropped.
2035+
Inspect ``capabilities.ui.mcpApps`` on the resume response to
2036+
detect the drop (the SDK also logs a warning).
20232037
continue_pending_work: When True, instructs the runtime to continue any
20242038
tool calls or permission prompts that were still pending when the
20252039
session was last suspended. When False (the default), the runtime

0 commit comments

Comments
 (0)