Skip to content

Commit f5fbfe1

Browse files
fix(server): identify the app requesting an MCP approval
1 parent 354ccc9 commit f5fbfe1

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎apps/server/src/mcp/toolkits/core.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ it.effect("lists, reads and resolves approvals with offered decisions and caller
669669
requestKind: "command",
670670
prompt:
671671
id === "approve-client" ? `${"🙂".repeat(3999)}🚀hidden warning` : "Run the command?",
672+
...(id === "approve-client" ? { appName: "Fixture app" } : {}),
672673
options,
673674
});
674675
}
@@ -709,6 +710,7 @@ it.effect("lists, reads and resolves approvals with offered decisions and caller
709710
kind: "command",
710711
prompt: `${"🙂".repeat(3999)}🚀`,
711712
promptTruncated: true,
713+
appName: "Fixture app",
712714
options,
713715
});
714716

‎apps/server/src/mcp/toolkits/thread/handlers.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ export const layer = McpToolAccess.toLayer(ThreadToolkit, {
241241
kind: request.kind,
242242
...(prompt === undefined ? {} : { prompt: prompt.slice(0, 4000).join("") }),
243243
...(prompt !== undefined && prompt.length > 4000 ? { promptTruncated: true } : {}),
244+
...(approval?.appName === undefined ? {} : { appName: approval.appName }),
244245
...(approval?.options === undefined ? {} : { options: approval.options }),
245246
};
246247
}),

‎apps/server/src/mcp/toolkits/thread/tools.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ const pendingRequest = Schema.Struct({
155155
questions: Schema.optional(Schema.Array(question)),
156156
prompt: Schema.optional(Schema.String),
157157
promptTruncated: Schema.optional(Schema.Boolean),
158+
appName: Schema.optional(Schema.String),
158159
options: Schema.optional(Schema.Array(ProviderApprovalOption)),
159160
});
160161
const PendingRequestListTool = Tool.make("t3_pending_request_list", {

0 commit comments

Comments
 (0)