Files
opencode/patches/@modelcontextprotocol%2Fclient@2.3.1.patch
T

183 lines
8.6 KiB
Diff

diff --git a/dist/index.cjs b/dist/index.cjs
index 71cf63076b073284aa14f63cd41efa653e8def0f..90e2a8778c4a0981aa57d3b5c6657d9c7c0e3562 100644
--- a/dist/index.cjs
+++ b/dist/index.cjs
@@ -1038,7 +1038,6 @@ async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, o
else {
const wellKnownPath = buildWellKnownPath(wellKnownType, issuer.pathname);
url = new URL(wellKnownPath, opts?.metadataServerUrl ?? issuer);
- url.search = issuer.search;
}
let response = await tryMetadataDiscovery(url, protocolVersion, fetchFn);
if (!opts?.metadataUrl && shouldAttemptFallback(response, issuer.pathname)) response = await tryMetadataDiscovery(new URL(`/.well-known/${wellKnownType}`, issuer), protocolVersion, fetchFn);
@@ -1222,7 +1221,6 @@ async function startAuthorization(authorizationServerUrl, { metadata, clientInfo
authorizationUrl.searchParams.set("redirect_uri", String(redirectUrl));
if (state) authorizationUrl.searchParams.set("state", state);
if (scope) authorizationUrl.searchParams.set("scope", scope);
- if (scope?.split(" ").includes("offline_access")) authorizationUrl.searchParams.append("prompt", "consent");
if (resource) authorizationUrl.searchParams.set("resource", resourceIndicatorToString(resource));
return {
authorizationUrl,
@@ -3206,7 +3204,16 @@ var Client = class extends require_src.Protocol {
}));
return require_src.runInputRequiredFlow({
getRequestHandler: (method) => this._getRequestHandler(method),
- buildContext: (baseCtx) => this.buildContext(baseCtx, void 0),
+ buildContext: (baseCtx) => this.buildContext({
+ ...baseCtx,
+ mcpReq: {
+ ...baseCtx.mcpReq,
+ origin: {
+ request: flow.request,
+ options: flow.options
+ }
+ }
+ }, void 0),
sessionId: this.transport?.sessionId
}, this._inputRequiredDriverConfig, decoded, flow);
}
@@ -4350,7 +4357,7 @@ var Client = class extends require_src.Protocol {
_excludeInvalidXMcpHeaderTools(result) {
if (this.getProtocolEra() !== "modern" || !this.transport || detectProbeTransportKind(this.transport) === "stdio") return;
const filtered = result.tools.filter((tool) => {
- const scan = require_src.scanXMcpHeaderDeclarations(tool.inputSchema);
+ const scan = require_src.scanXMcpHeaderDeclarations(tool?.inputSchema);
if (!scan.valid) {
console.warn(`[mcp-sdk] excluding tool '${tool.name}' from tools/list: invalid x-mcp-header declaration — ${scan.reason}`);
return false;
diff --git a/dist/index.mjs b/dist/index.mjs
index c1a09a82b8121d6a1b038ccc6d02bae46d55dbcf..0adaa1f8ef80f1bd29581e896add283258a57918 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -1035,7 +1035,6 @@ async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, o
else {
const wellKnownPath = buildWellKnownPath(wellKnownType, issuer.pathname);
url = new URL(wellKnownPath, opts?.metadataServerUrl ?? issuer);
- url.search = issuer.search;
}
let response = await tryMetadataDiscovery(url, protocolVersion, fetchFn);
if (!opts?.metadataUrl && shouldAttemptFallback(response, issuer.pathname)) response = await tryMetadataDiscovery(new URL(`/.well-known/${wellKnownType}`, issuer), protocolVersion, fetchFn);
@@ -1219,7 +1218,6 @@ async function startAuthorization(authorizationServerUrl, { metadata, clientInfo
authorizationUrl.searchParams.set("redirect_uri", String(redirectUrl));
if (state) authorizationUrl.searchParams.set("state", state);
if (scope) authorizationUrl.searchParams.set("scope", scope);
- if (scope?.split(" ").includes("offline_access")) authorizationUrl.searchParams.append("prompt", "consent");
if (resource) authorizationUrl.searchParams.set("resource", resourceIndicatorToString(resource));
return {
authorizationUrl,
@@ -3203,7 +3201,16 @@ var Client = class extends Protocol {
}));
return runInputRequiredFlow({
getRequestHandler: (method) => this._getRequestHandler(method),
- buildContext: (baseCtx) => this.buildContext(baseCtx, void 0),
+ buildContext: (baseCtx) => this.buildContext({
+ ...baseCtx,
+ mcpReq: {
+ ...baseCtx.mcpReq,
+ origin: {
+ request: flow.request,
+ options: flow.options
+ }
+ }
+ }, void 0),
sessionId: this.transport?.sessionId
}, this._inputRequiredDriverConfig, decoded, flow);
}
@@ -4347,7 +4354,7 @@ var Client = class extends Protocol {
_excludeInvalidXMcpHeaderTools(result) {
if (this.getProtocolEra() !== "modern" || !this.transport || detectProbeTransportKind(this.transport) === "stdio") return;
const filtered = result.tools.filter((tool) => {
- const scan = scanXMcpHeaderDeclarations(tool.inputSchema);
+ const scan = scanXMcpHeaderDeclarations(tool?.inputSchema);
if (!scan.valid) {
console.warn(`[mcp-sdk] excluding tool '${tool.name}' from tools/list: invalid x-mcp-header declaration — ${scan.reason}`);
return false;
diff --git a/dist/src-DpAS0jfg.cjs b/dist/src-DpAS0jfg.cjs
index e2ffe6482e0d8eed88082215547ccde7b5ef2d37..1550d1d30cdbd79b35af59ef69a2e9e26d67290e 100644
--- a/dist/src-DpAS0jfg.cjs
+++ b/dist/src-DpAS0jfg.cjs
@@ -1093,11 +1093,7 @@ function build$1() {
properties: zod_v4.record(zod_v4.string(), JSONValueSchema$1).optional(),
required: zod_v4.array(zod_v4.string()).optional()
}).catchall(zod_v4.unknown()),
- outputSchema: zod_v4.object({
- type: zod_v4.literal("object"),
- properties: zod_v4.record(zod_v4.string(), JSONValueSchema$1).optional(),
- required: zod_v4.array(zod_v4.string()).optional()
- }).catchall(zod_v4.unknown()).optional(),
+ outputSchema: zod_v4.looseObject({ $schema: zod_v4.string().optional() }).optional(),
annotations: ToolAnnotationsSchema$1.optional(),
execution: ToolExecutionSchema$1.optional(),
_meta: zod_v4.record(zod_v4.string(), zod_v4.unknown()).optional()
@@ -1109,7 +1105,7 @@ function build$1() {
/**
* The server's response to a {@linkcode ListToolsRequest | tools/list} request from the client.
*/
- const ListToolsResultSchema$1 = PaginatedResultSchema$1.extend({ tools: zod_v4.array(ToolSchema$1) });
+ const ListToolsResultSchema$1 = PaginatedResultSchema$1.extend({ tools: zod_v4.array(zod_v4.unknown()) });
/**
* The server's response to a tool call.
*/
@@ -2859,7 +2855,7 @@ function build() {
const ListToolsResultSchema$1 = wireResult({
ttlMs: zod_v4.number().int().min(0),
cacheScope: zod_v4.enum(["public", "private"]),
- tools: zod_v4.array(ToolSchema$1),
+ tools: zod_v4.array(zod_v4.unknown()),
nextCursor: CursorSchema$1.optional()
});
const ListPromptsResultSchema$1 = wireResult({
@@ -3120,7 +3116,7 @@ function build() {
"tools/list": liftedResult({
ttlMs: zod_v4.number().int().min(0),
cacheScope: zod_v4.enum(["public", "private"]),
- tools: zod_v4.array(ToolSchema$1),
+ tools: zod_v4.array(zod_v4.unknown()),
nextCursor: CursorSchema$1.optional()
}),
"prompts/get": liftedResult({
diff --git a/dist/src-WCy6ifGf.mjs b/dist/src-WCy6ifGf.mjs
index 7a40fb418c402ffc6cac3e71192313a79c63be27..e9c090ae5e18531bb2fc5e225f0f072fddc67ab5 100644
--- a/dist/src-WCy6ifGf.mjs
+++ b/dist/src-WCy6ifGf.mjs
@@ -1092,11 +1092,7 @@ function build$1() {
properties: z.record(z.string(), JSONValueSchema$1).optional(),
required: z.array(z.string()).optional()
}).catchall(z.unknown()),
- outputSchema: z.object({
- type: z.literal("object"),
- properties: z.record(z.string(), JSONValueSchema$1).optional(),
- required: z.array(z.string()).optional()
- }).catchall(z.unknown()).optional(),
+ outputSchema: z.looseObject({ $schema: z.string().optional() }).optional(),
annotations: ToolAnnotationsSchema$1.optional(),
execution: ToolExecutionSchema$1.optional(),
_meta: z.record(z.string(), z.unknown()).optional()
@@ -1108,7 +1104,7 @@ function build$1() {
/**
* The server's response to a {@linkcode ListToolsRequest | tools/list} request from the client.
*/
- const ListToolsResultSchema$1 = PaginatedResultSchema$1.extend({ tools: z.array(ToolSchema$1) });
+ const ListToolsResultSchema$1 = PaginatedResultSchema$1.extend({ tools: z.array(z.unknown()) });
/**
* The server's response to a tool call.
*/
@@ -2858,7 +2854,7 @@ function build() {
const ListToolsResultSchema$1 = wireResult({
ttlMs: z.number().int().min(0),
cacheScope: z.enum(["public", "private"]),
- tools: z.array(ToolSchema$1),
+ tools: z.array(z.unknown()),
nextCursor: CursorSchema$1.optional()
});
const ListPromptsResultSchema$1 = wireResult({
@@ -3119,7 +3115,7 @@ function build() {
"tools/list": liftedResult({
ttlMs: z.number().int().min(0),
cacheScope: z.enum(["public", "private"]),
- tools: z.array(ToolSchema$1),
+ tools: z.array(z.unknown()),
nextCursor: CursorSchema$1.optional()
}),
"prompts/get": liftedResult({