Add loan-advisor-chatgpt-app (part 4)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/middleware/hostHeaderValidation.d.ts +32 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/middleware/hostHeaderValidation.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/middleware/hostHeaderValidation.js +80 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/middleware/hostHeaderValidation.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sse.d.ts +82 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sse.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sse.js +172 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sse.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts +28 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js +82 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/streamableHttp.d.ts +122 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/streamableHttp.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/streamableHttp.js +165 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/streamableHttp.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts +268 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js +755 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts +84 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js +244 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.d.ts +12 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js +79 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth-utils.d.ts +23 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth-utils.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth-utils.js +48 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth-utils.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts +240 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js +224 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/metadataUtils.d.ts +16 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/metadataUtils.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/metadataUtils.js +25 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/metadataUtils.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts +443 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js +1112 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/responseMessage.d.ts +45 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/responseMessage.d.ts.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/responseMessage.js +23 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/responseMessage.js.map +1 -0
- loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts +13 -0
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../../src/server/mcp.ts"],"names":[],"mappings":";;;AAAA,yCAAmD;AACnD,mDAcyB;AACzB,2EAAiE;AACjE,0CAsCqB;AACrB,qDAA+D;AAC/D,6DAAkE;AAIlE,2EAA0E;AAC1E,uEAAiF;AAEjF,6BAAkC;AAElC;;;;GAIG;AACH,MAAa,SAAS;IAclB,YAAY,UAA0B,EAAE,OAAuB;QARvD,yBAAoB,GAA0C,EAAE,CAAC;QACjE,iCAA4B,GAEhC,EAAE,CAAC;QACC,qBAAgB,GAAuC,EAAE,CAAC;QAC1D,uBAAkB,GAAyC,EAAE,CAAC;QAuC9D,6BAAwB,GAAG,KAAK,CAAC;QAsRjC,kCAA6B,GAAG,KAAK,CAAC;QAmFtC,iCAA4B,GAAG,KAAK,CAAC;QAiFrC,+BAA0B,GAAG,KAAK,CAAC;QA7dvC,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;OAMG;IACH,IAAI,YAAY;QACZ,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACtB,IAAI,CAAC,aAAa,GAAG;gBACjB,KAAK,EAAE,IAAI,0CAA0B,CAAC,IAAI,CAAC;aAC9C,CAAC;QACN,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,SAAoB;QAC9B,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAA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ACV,OAAO,EAAE,KAAK;KACjB;CACJ,CAAC"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/middleware/hostHeaderValidation.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { RequestHandler } from 'express';
|
| 2 |
+
/**
|
| 3 |
+
* Express middleware for DNS rebinding protection.
|
| 4 |
+
* Validates Host header hostname (port-agnostic) against an allowed list.
|
| 5 |
+
*
|
| 6 |
+
* This is particularly important for servers without authorization or HTTPS,
|
| 7 |
+
* such as localhost servers or development servers. DNS rebinding attacks can
|
| 8 |
+
* bypass same-origin policy by manipulating DNS to point a domain to a
|
| 9 |
+
* localhost address, allowing malicious websites to access your local server.
|
| 10 |
+
*
|
| 11 |
+
* @param allowedHostnames - List of allowed hostnames (without ports).
|
| 12 |
+
* For IPv6, provide the address with brackets (e.g., '[::1]').
|
| 13 |
+
* @returns Express middleware function
|
| 14 |
+
*
|
| 15 |
+
* @example
|
| 16 |
+
* ```typescript
|
| 17 |
+
* const middleware = hostHeaderValidation(['localhost', '127.0.0.1', '[::1]']);
|
| 18 |
+
* app.use(middleware);
|
| 19 |
+
* ```
|
| 20 |
+
*/
|
| 21 |
+
export declare function hostHeaderValidation(allowedHostnames: string[]): RequestHandler;
|
| 22 |
+
/**
|
| 23 |
+
* Convenience middleware for localhost DNS rebinding protection.
|
| 24 |
+
* Allows only localhost, 127.0.0.1, and [::1] (IPv6 localhost) hostnames.
|
| 25 |
+
*
|
| 26 |
+
* @example
|
| 27 |
+
* ```typescript
|
| 28 |
+
* app.use(localhostHostValidation());
|
| 29 |
+
* ```
|
| 30 |
+
*/
|
| 31 |
+
export declare function localhostHostValidation(): RequestHandler;
|
| 32 |
+
//# sourceMappingURL=hostHeaderValidation.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/middleware/hostHeaderValidation.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"hostHeaderValidation.d.ts","sourceRoot":"","sources":["../../../../src/server/middleware/hostHeaderValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,cAAc,CA4C/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,IAAI,cAAc,CAExD"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/middleware/hostHeaderValidation.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.hostHeaderValidation = hostHeaderValidation;
|
| 4 |
+
exports.localhostHostValidation = localhostHostValidation;
|
| 5 |
+
/**
|
| 6 |
+
* Express middleware for DNS rebinding protection.
|
| 7 |
+
* Validates Host header hostname (port-agnostic) against an allowed list.
|
| 8 |
+
*
|
| 9 |
+
* This is particularly important for servers without authorization or HTTPS,
|
| 10 |
+
* such as localhost servers or development servers. DNS rebinding attacks can
|
| 11 |
+
* bypass same-origin policy by manipulating DNS to point a domain to a
|
| 12 |
+
* localhost address, allowing malicious websites to access your local server.
|
| 13 |
+
*
|
| 14 |
+
* @param allowedHostnames - List of allowed hostnames (without ports).
|
| 15 |
+
* For IPv6, provide the address with brackets (e.g., '[::1]').
|
| 16 |
+
* @returns Express middleware function
|
| 17 |
+
*
|
| 18 |
+
* @example
|
| 19 |
+
* ```typescript
|
| 20 |
+
* const middleware = hostHeaderValidation(['localhost', '127.0.0.1', '[::1]']);
|
| 21 |
+
* app.use(middleware);
|
| 22 |
+
* ```
|
| 23 |
+
*/
|
| 24 |
+
function hostHeaderValidation(allowedHostnames) {
|
| 25 |
+
return (req, res, next) => {
|
| 26 |
+
const hostHeader = req.headers.host;
|
| 27 |
+
if (!hostHeader) {
|
| 28 |
+
res.status(403).json({
|
| 29 |
+
jsonrpc: '2.0',
|
| 30 |
+
error: {
|
| 31 |
+
code: -32000,
|
| 32 |
+
message: 'Missing Host header'
|
| 33 |
+
},
|
| 34 |
+
id: null
|
| 35 |
+
});
|
| 36 |
+
return;
|
| 37 |
+
}
|
| 38 |
+
// Use URL API to parse hostname (handles IPv4, IPv6, and regular hostnames)
|
| 39 |
+
let hostname;
|
| 40 |
+
try {
|
| 41 |
+
hostname = new URL(`http://${hostHeader}`).hostname;
|
| 42 |
+
}
|
| 43 |
+
catch {
|
| 44 |
+
res.status(403).json({
|
| 45 |
+
jsonrpc: '2.0',
|
| 46 |
+
error: {
|
| 47 |
+
code: -32000,
|
| 48 |
+
message: `Invalid Host header: ${hostHeader}`
|
| 49 |
+
},
|
| 50 |
+
id: null
|
| 51 |
+
});
|
| 52 |
+
return;
|
| 53 |
+
}
|
| 54 |
+
if (!allowedHostnames.includes(hostname)) {
|
| 55 |
+
res.status(403).json({
|
| 56 |
+
jsonrpc: '2.0',
|
| 57 |
+
error: {
|
| 58 |
+
code: -32000,
|
| 59 |
+
message: `Invalid Host: ${hostname}`
|
| 60 |
+
},
|
| 61 |
+
id: null
|
| 62 |
+
});
|
| 63 |
+
return;
|
| 64 |
+
}
|
| 65 |
+
next();
|
| 66 |
+
};
|
| 67 |
+
}
|
| 68 |
+
/**
|
| 69 |
+
* Convenience middleware for localhost DNS rebinding protection.
|
| 70 |
+
* Allows only localhost, 127.0.0.1, and [::1] (IPv6 localhost) hostnames.
|
| 71 |
+
*
|
| 72 |
+
* @example
|
| 73 |
+
* ```typescript
|
| 74 |
+
* app.use(localhostHostValidation());
|
| 75 |
+
* ```
|
| 76 |
+
*/
|
| 77 |
+
function localhostHostValidation() {
|
| 78 |
+
return hostHeaderValidation(['localhost', '127.0.0.1', '[::1]']);
|
| 79 |
+
}
|
| 80 |
+
//# sourceMappingURL=hostHeaderValidation.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/middleware/hostHeaderValidation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"hostHeaderValidation.js","sourceRoot":"","sources":["../../../../src/server/middleware/hostHeaderValidation.ts"],"names":[],"mappings":";;AAqBA,oDA4CC;AAWD,0DAEC;AA5ED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,oBAAoB,CAAC,gBAA0B;IAC3D,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;QACvD,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;QAC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.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
| 2 |
+
import { Transport } from '../shared/transport.js';
|
| 3 |
+
import { JSONRPCMessage, MessageExtraInfo } from '../types.js';
|
| 4 |
+
import { AuthInfo } from './auth/types.js';
|
| 5 |
+
/**
|
| 6 |
+
* Configuration options for SSEServerTransport.
|
| 7 |
+
*/
|
| 8 |
+
export interface SSEServerTransportOptions {
|
| 9 |
+
/**
|
| 10 |
+
* List of allowed host header values for DNS rebinding protection.
|
| 11 |
+
* If not specified, host validation is disabled.
|
| 12 |
+
* @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead,
|
| 13 |
+
* or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default.
|
| 14 |
+
*/
|
| 15 |
+
allowedHosts?: string[];
|
| 16 |
+
/**
|
| 17 |
+
* List of allowed origin header values for DNS rebinding protection.
|
| 18 |
+
* If not specified, origin validation is disabled.
|
| 19 |
+
* @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead,
|
| 20 |
+
* or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default.
|
| 21 |
+
*/
|
| 22 |
+
allowedOrigins?: string[];
|
| 23 |
+
/**
|
| 24 |
+
* Enable DNS rebinding protection (requires allowedHosts and/or allowedOrigins to be configured).
|
| 25 |
+
* Default is false for backwards compatibility.
|
| 26 |
+
* @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead,
|
| 27 |
+
* or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default.
|
| 28 |
+
*/
|
| 29 |
+
enableDnsRebindingProtection?: boolean;
|
| 30 |
+
}
|
| 31 |
+
/**
|
| 32 |
+
* Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests.
|
| 33 |
+
*
|
| 34 |
+
* This transport is only available in Node.js environments.
|
| 35 |
+
* @deprecated SSEServerTransport is deprecated. Use StreamableHTTPServerTransport instead.
|
| 36 |
+
*/
|
| 37 |
+
export declare class SSEServerTransport implements Transport {
|
| 38 |
+
private _endpoint;
|
| 39 |
+
private res;
|
| 40 |
+
private _sseResponse?;
|
| 41 |
+
private _sessionId;
|
| 42 |
+
private _options;
|
| 43 |
+
onclose?: () => void;
|
| 44 |
+
onerror?: (error: Error) => void;
|
| 45 |
+
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
| 46 |
+
/**
|
| 47 |
+
* Creates a new SSE server transport, which will direct the client to POST messages to the relative or absolute URL identified by `_endpoint`.
|
| 48 |
+
*/
|
| 49 |
+
constructor(_endpoint: string, res: ServerResponse, options?: SSEServerTransportOptions);
|
| 50 |
+
/**
|
| 51 |
+
* Validates request headers for DNS rebinding protection.
|
| 52 |
+
* @returns Error message if validation fails, undefined if validation passes.
|
| 53 |
+
*/
|
| 54 |
+
private validateRequestHeaders;
|
| 55 |
+
/**
|
| 56 |
+
* Handles the initial SSE connection request.
|
| 57 |
+
*
|
| 58 |
+
* This should be called when a GET request is made to establish the SSE stream.
|
| 59 |
+
*/
|
| 60 |
+
start(): Promise<void>;
|
| 61 |
+
/**
|
| 62 |
+
* Handles incoming POST messages.
|
| 63 |
+
*
|
| 64 |
+
* This should be called when a POST request is made to send a message to the server.
|
| 65 |
+
*/
|
| 66 |
+
handlePostMessage(req: IncomingMessage & {
|
| 67 |
+
auth?: AuthInfo;
|
| 68 |
+
}, res: ServerResponse, parsedBody?: unknown): Promise<void>;
|
| 69 |
+
/**
|
| 70 |
+
* Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different than HTTP POST.
|
| 71 |
+
*/
|
| 72 |
+
handleMessage(message: unknown, extra?: MessageExtraInfo): Promise<void>;
|
| 73 |
+
close(): Promise<void>;
|
| 74 |
+
send(message: JSONRPCMessage): Promise<void>;
|
| 75 |
+
/**
|
| 76 |
+
* Returns the session ID for this transport.
|
| 77 |
+
*
|
| 78 |
+
* This can be used to route incoming POST requests.
|
| 79 |
+
*/
|
| 80 |
+
get sessionId(): string;
|
| 81 |
+
}
|
| 82 |
+
//# sourceMappingURL=sse.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sse.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../src/server/sse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAwB,gBAAgB,EAAe,MAAM,aAAa,CAAC;AAGlG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK3C;;GAE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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
| 3 |
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
| 4 |
+
};
|
| 5 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 6 |
+
exports.SSEServerTransport = void 0;
|
| 7 |
+
const node_crypto_1 = require("node:crypto");
|
| 8 |
+
const node_tls_1 = require("node:tls");
|
| 9 |
+
const types_js_1 = require("../types.js");
|
| 10 |
+
const raw_body_1 = __importDefault(require("raw-body"));
|
| 11 |
+
const content_type_1 = __importDefault(require("content-type"));
|
| 12 |
+
const node_url_1 = require("node:url");
|
| 13 |
+
const MAXIMUM_MESSAGE_SIZE = '4mb';
|
| 14 |
+
/**
|
| 15 |
+
* Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests.
|
| 16 |
+
*
|
| 17 |
+
* This transport is only available in Node.js environments.
|
| 18 |
+
* @deprecated SSEServerTransport is deprecated. Use StreamableHTTPServerTransport instead.
|
| 19 |
+
*/
|
| 20 |
+
class SSEServerTransport {
|
| 21 |
+
/**
|
| 22 |
+
* Creates a new SSE server transport, which will direct the client to POST messages to the relative or absolute URL identified by `_endpoint`.
|
| 23 |
+
*/
|
| 24 |
+
constructor(_endpoint, res, options) {
|
| 25 |
+
this._endpoint = _endpoint;
|
| 26 |
+
this.res = res;
|
| 27 |
+
this._sessionId = (0, node_crypto_1.randomUUID)();
|
| 28 |
+
this._options = options || { enableDnsRebindingProtection: false };
|
| 29 |
+
}
|
| 30 |
+
/**
|
| 31 |
+
* Validates request headers for DNS rebinding protection.
|
| 32 |
+
* @returns Error message if validation fails, undefined if validation passes.
|
| 33 |
+
*/
|
| 34 |
+
validateRequestHeaders(req) {
|
| 35 |
+
// Skip validation if protection is not enabled
|
| 36 |
+
if (!this._options.enableDnsRebindingProtection) {
|
| 37 |
+
return undefined;
|
| 38 |
+
}
|
| 39 |
+
// Validate Host header if allowedHosts is configured
|
| 40 |
+
if (this._options.allowedHosts && this._options.allowedHosts.length > 0) {
|
| 41 |
+
const hostHeader = req.headers.host;
|
| 42 |
+
if (!hostHeader || !this._options.allowedHosts.includes(hostHeader)) {
|
| 43 |
+
return `Invalid Host header: ${hostHeader}`;
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
// Validate Origin header if allowedOrigins is configured
|
| 47 |
+
if (this._options.allowedOrigins && this._options.allowedOrigins.length > 0) {
|
| 48 |
+
const originHeader = req.headers.origin;
|
| 49 |
+
if (originHeader && !this._options.allowedOrigins.includes(originHeader)) {
|
| 50 |
+
return `Invalid Origin header: ${originHeader}`;
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
return undefined;
|
| 54 |
+
}
|
| 55 |
+
/**
|
| 56 |
+
* Handles the initial SSE connection request.
|
| 57 |
+
*
|
| 58 |
+
* This should be called when a GET request is made to establish the SSE stream.
|
| 59 |
+
*/
|
| 60 |
+
async start() {
|
| 61 |
+
if (this._sseResponse) {
|
| 62 |
+
throw new Error('SSEServerTransport already started! If using Server class, note that connect() calls start() automatically.');
|
| 63 |
+
}
|
| 64 |
+
this.res.writeHead(200, {
|
| 65 |
+
'Content-Type': 'text/event-stream',
|
| 66 |
+
'Cache-Control': 'no-cache, no-transform',
|
| 67 |
+
Connection: 'keep-alive'
|
| 68 |
+
});
|
| 69 |
+
// Send the endpoint event
|
| 70 |
+
// Use a dummy base URL because this._endpoint is relative.
|
| 71 |
+
// This allows using URL/URLSearchParams for robust parameter handling.
|
| 72 |
+
const dummyBase = 'http://localhost'; // Any valid base works
|
| 73 |
+
const endpointUrl = new node_url_1.URL(this._endpoint, dummyBase);
|
| 74 |
+
endpointUrl.searchParams.set('sessionId', this._sessionId);
|
| 75 |
+
// Reconstruct the relative URL string (pathname + search + hash)
|
| 76 |
+
const relativeUrlWithSession = endpointUrl.pathname + endpointUrl.search + endpointUrl.hash;
|
| 77 |
+
this.res.write(`event: endpoint\ndata: ${relativeUrlWithSession}\n\n`);
|
| 78 |
+
this._sseResponse = this.res;
|
| 79 |
+
this.res.on('close', () => {
|
| 80 |
+
this._sseResponse = undefined;
|
| 81 |
+
this.onclose?.();
|
| 82 |
+
});
|
| 83 |
+
}
|
| 84 |
+
/**
|
| 85 |
+
* Handles incoming POST messages.
|
| 86 |
+
*
|
| 87 |
+
* This should be called when a POST request is made to send a message to the server.
|
| 88 |
+
*/
|
| 89 |
+
async handlePostMessage(req, res, parsedBody) {
|
| 90 |
+
if (!this._sseResponse) {
|
| 91 |
+
const message = 'SSE connection not established';
|
| 92 |
+
res.writeHead(500).end(message);
|
| 93 |
+
throw new Error(message);
|
| 94 |
+
}
|
| 95 |
+
// Validate request headers for DNS rebinding protection
|
| 96 |
+
const validationError = this.validateRequestHeaders(req);
|
| 97 |
+
if (validationError) {
|
| 98 |
+
res.writeHead(403).end(validationError);
|
| 99 |
+
this.onerror?.(new Error(validationError));
|
| 100 |
+
return;
|
| 101 |
+
}
|
| 102 |
+
const authInfo = req.auth;
|
| 103 |
+
const host = req.headers.host;
|
| 104 |
+
const protocol = req.socket instanceof node_tls_1.TLSSocket ? 'https' : 'http';
|
| 105 |
+
const fullUrl = host && req.url ? new node_url_1.URL(req.url, `${protocol}://${host}`) : undefined;
|
| 106 |
+
const requestInfo = {
|
| 107 |
+
headers: req.headers,
|
| 108 |
+
url: fullUrl
|
| 109 |
+
};
|
| 110 |
+
let body;
|
| 111 |
+
try {
|
| 112 |
+
const ct = content_type_1.default.parse(req.headers['content-type'] ?? '');
|
| 113 |
+
if (ct.type !== 'application/json') {
|
| 114 |
+
throw new Error(`Unsupported content-type: ${ct.type}`);
|
| 115 |
+
}
|
| 116 |
+
body =
|
| 117 |
+
parsedBody ??
|
| 118 |
+
(await (0, raw_body_1.default)(req, {
|
| 119 |
+
limit: MAXIMUM_MESSAGE_SIZE,
|
| 120 |
+
encoding: ct.parameters.charset ?? 'utf-8'
|
| 121 |
+
}));
|
| 122 |
+
}
|
| 123 |
+
catch (error) {
|
| 124 |
+
res.writeHead(400).end(String(error));
|
| 125 |
+
this.onerror?.(error);
|
| 126 |
+
return;
|
| 127 |
+
}
|
| 128 |
+
try {
|
| 129 |
+
await this.handleMessage(typeof body === 'string' ? JSON.parse(body) : body, { requestInfo, authInfo });
|
| 130 |
+
}
|
| 131 |
+
catch {
|
| 132 |
+
res.writeHead(400).end(`Invalid message: ${body}`);
|
| 133 |
+
return;
|
| 134 |
+
}
|
| 135 |
+
res.writeHead(202).end('Accepted');
|
| 136 |
+
}
|
| 137 |
+
/**
|
| 138 |
+
* Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different than HTTP POST.
|
| 139 |
+
*/
|
| 140 |
+
async handleMessage(message, extra) {
|
| 141 |
+
let parsedMessage;
|
| 142 |
+
try {
|
| 143 |
+
parsedMessage = types_js_1.JSONRPCMessageSchema.parse(message);
|
| 144 |
+
}
|
| 145 |
+
catch (error) {
|
| 146 |
+
this.onerror?.(error);
|
| 147 |
+
throw error;
|
| 148 |
+
}
|
| 149 |
+
this.onmessage?.(parsedMessage, extra);
|
| 150 |
+
}
|
| 151 |
+
async close() {
|
| 152 |
+
this._sseResponse?.end();
|
| 153 |
+
this._sseResponse = undefined;
|
| 154 |
+
this.onclose?.();
|
| 155 |
+
}
|
| 156 |
+
async send(message) {
|
| 157 |
+
if (!this._sseResponse) {
|
| 158 |
+
throw new Error('Not connected');
|
| 159 |
+
}
|
| 160 |
+
this._sseResponse.write(`event: message\ndata: ${JSON.stringify(message)}\n\n`);
|
| 161 |
+
}
|
| 162 |
+
/**
|
| 163 |
+
* Returns the session ID for this transport.
|
| 164 |
+
*
|
| 165 |
+
* This can be used to route incoming POST requests.
|
| 166 |
+
*/
|
| 167 |
+
get sessionId() {
|
| 168 |
+
return this._sessionId;
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
exports.SSEServerTransport = SSEServerTransport;
|
| 172 |
+
//# sourceMappingURL=sse.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sse.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../../src/server/sse.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAyC;AAEzC,uCAAqC;AAErC,0CAAkG;AAClG,wDAAkC;AAClC,gEAAuC;AAEvC,uCAA+B;AAE/B,MAAM,oBAAoB,GAAG,KAAK,CAAC;AA+BnC;;;;;GAKG;AACH,MAAa,kBAAkB;IAQ3B;;OAEG;IACH,YACY,SAAiB,EACjB,GAAmB,EAC3B,OAAmC;QAF3B,cAAS,GAAT,SAAS,CAAQ;QACjB,QAAG,GAAH,GAAG,CAAgB;QAG3B,IAAI,CAAC,UAAU,GAAG,IAAA,wBAAU,GAAE,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,CAAC;IACvE,CAAC;IAED;;;OAGG;IACK,sBAAsB,CAAC,GAAoB;QAC/C,+CAA+C;QAC/C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,CAAC;YAC9C,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,qDAAqD;QACrD,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtE,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;YACpC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAClE,OAAO,wBAAwB,UAAU,EAAE,CAAC;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AAgB,EAAE,KAAwB;QAC1D,IAAI,aAA6B,CAAC;QAClC,IAAI,CAAC;YACD,aAAa,GAAG,+BAAoB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,OAAO,EAAE,CAAC,KAAc,CAAC,CAAC;YAC/B,MAAM,KAAK,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,SAAS,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAuB;QAC9B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpF,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CACJ;AArLD,gDAqLC"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Readable, Writable } from 'node:stream';
|
| 2 |
+
import { JSONRPCMessage } from '../types.js';
|
| 3 |
+
import { Transport } from '../shared/transport.js';
|
| 4 |
+
/**
|
| 5 |
+
* Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.
|
| 6 |
+
*
|
| 7 |
+
* This transport is only available in Node.js environments.
|
| 8 |
+
*/
|
| 9 |
+
export declare class StdioServerTransport implements Transport {
|
| 10 |
+
private _stdin;
|
| 11 |
+
private _stdout;
|
| 12 |
+
private _readBuffer;
|
| 13 |
+
private _started;
|
| 14 |
+
constructor(_stdin?: Readable, _stdout?: Writable);
|
| 15 |
+
onclose?: () => void;
|
| 16 |
+
onerror?: (error: Error) => void;
|
| 17 |
+
onmessage?: (message: JSONRPCMessage) => void;
|
| 18 |
+
_ondata: (chunk: Buffer) => void;
|
| 19 |
+
_onerror: (error: Error) => void;
|
| 20 |
+
/**
|
| 21 |
+
* Starts listening for messages on stdin.
|
| 22 |
+
*/
|
| 23 |
+
start(): Promise<void>;
|
| 24 |
+
private processReadBuffer;
|
| 25 |
+
close(): Promise<void>;
|
| 26 |
+
send(message: JSONRPCMessage): Promise<void>;
|
| 27 |
+
}
|
| 28 |
+
//# sourceMappingURL=stdio.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/server/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,SAAS;IAK9C,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IALnB,OAAO,CAAC,WAAW,CAAgC;IACnD,OAAO,CAAC,QAAQ,C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.__importDefault) || function (mod) {
|
| 3 |
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
| 4 |
+
};
|
| 5 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 6 |
+
exports.StdioServerTransport = void 0;
|
| 7 |
+
const node_process_1 = __importDefault(require("node:process"));
|
| 8 |
+
const stdio_js_1 = require("../shared/stdio.js");
|
| 9 |
+
/**
|
| 10 |
+
* Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.
|
| 11 |
+
*
|
| 12 |
+
* This transport is only available in Node.js environments.
|
| 13 |
+
*/
|
| 14 |
+
class StdioServerTransport {
|
| 15 |
+
constructor(_stdin = node_process_1.default.stdin, _stdout = node_process_1.default.stdout) {
|
| 16 |
+
this._stdin = _stdin;
|
| 17 |
+
this._stdout = _stdout;
|
| 18 |
+
this._readBuffer = new stdio_js_1.ReadBuffer();
|
| 19 |
+
this._started = false;
|
| 20 |
+
// Arrow functions to bind `this` properly, while maintaining function identity.
|
| 21 |
+
this._ondata = (chunk) => {
|
| 22 |
+
this._readBuffer.append(chunk);
|
| 23 |
+
this.processReadBuffer();
|
| 24 |
+
};
|
| 25 |
+
this._onerror = (error) => {
|
| 26 |
+
this.onerror?.(error);
|
| 27 |
+
};
|
| 28 |
+
}
|
| 29 |
+
/**
|
| 30 |
+
* Starts listening for messages on stdin.
|
| 31 |
+
*/
|
| 32 |
+
async start() {
|
| 33 |
+
if (this._started) {
|
| 34 |
+
throw new Error('StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.');
|
| 35 |
+
}
|
| 36 |
+
this._started = true;
|
| 37 |
+
this._stdin.on('data', this._ondata);
|
| 38 |
+
this._stdin.on('error', this._onerror);
|
| 39 |
+
}
|
| 40 |
+
processReadBuffer() {
|
| 41 |
+
while (true) {
|
| 42 |
+
try {
|
| 43 |
+
const message = this._readBuffer.readMessage();
|
| 44 |
+
if (message === null) {
|
| 45 |
+
break;
|
| 46 |
+
}
|
| 47 |
+
this.onmessage?.(message);
|
| 48 |
+
}
|
| 49 |
+
catch (error) {
|
| 50 |
+
this.onerror?.(error);
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
async close() {
|
| 55 |
+
// Remove our event listeners first
|
| 56 |
+
this._stdin.off('data', this._ondata);
|
| 57 |
+
this._stdin.off('error', this._onerror);
|
| 58 |
+
// Check if we were the only data listener
|
| 59 |
+
const remainingDataListeners = this._stdin.listenerCount('data');
|
| 60 |
+
if (remainingDataListeners === 0) {
|
| 61 |
+
// Only pause stdin if we were the only listener
|
| 62 |
+
// This prevents interfering with other parts of the application that might be using stdin
|
| 63 |
+
this._stdin.pause();
|
| 64 |
+
}
|
| 65 |
+
// Clear the buffer and notify closure
|
| 66 |
+
this._readBuffer.clear();
|
| 67 |
+
this.onclose?.();
|
| 68 |
+
}
|
| 69 |
+
send(message) {
|
| 70 |
+
return new Promise(resolve => {
|
| 71 |
+
const json = (0, stdio_js_1.serializeMessage)(message);
|
| 72 |
+
if (this._stdout.write(json)) {
|
| 73 |
+
resolve();
|
| 74 |
+
}
|
| 75 |
+
else {
|
| 76 |
+
this._stdout.once('drain', resolve);
|
| 77 |
+
}
|
| 78 |
+
});
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
exports.StdioServerTransport = StdioServerTransport;
|
| 82 |
+
//# sourceMappingURL=stdio.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/server/stdio.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAmC;AAEnC,iDAAkE;AAIlE;;;;GAIG;AACH,MAAa,oBAAoB;IAI7B,YACY,SAAmB,sBAAO,CAAC,KAAK,EAChC,UAAoB,sBAAO,CAAC,MAAM;QADlC,WAAM,GAAN,MAAM,CAA0B;QAChC,YAAO,GAAP,OAAO,CAA2B;Q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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Node.js HTTP Streamable HTTP Server Transport
|
| 3 |
+
*
|
| 4 |
+
* This is a thin wrapper around `WebStandardStreamableHTTPServerTransport` that provides
|
| 5 |
+
* compatibility with Node.js HTTP server (IncomingMessage/ServerResponse).
|
| 6 |
+
*
|
| 7 |
+
* For web-standard environments (Cloudflare Workers, Deno, Bun), use `WebStandardStreamableHTTPServerTransport` directly.
|
| 8 |
+
*/
|
| 9 |
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
| 10 |
+
import { Transport } from '../shared/transport.js';
|
| 11 |
+
import { AuthInfo } from './auth/types.js';
|
| 12 |
+
import { MessageExtraInfo, JSONRPCMessage, RequestId } from '../types.js';
|
| 13 |
+
import { WebStandardStreamableHTTPServerTransportOptions, EventStore, StreamId, EventId } from './webStandardStreamableHttp.js';
|
| 14 |
+
export type { EventStore, StreamId, EventId };
|
| 15 |
+
/**
|
| 16 |
+
* Configuration options for StreamableHTTPServerTransport
|
| 17 |
+
*
|
| 18 |
+
* This is an alias for WebStandardStreamableHTTPServerTransportOptions for backward compatibility.
|
| 19 |
+
*/
|
| 20 |
+
export type StreamableHTTPServerTransportOptions = WebStandardStreamableHTTPServerTransportOptions;
|
| 21 |
+
/**
|
| 22 |
+
* Server transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification.
|
| 23 |
+
* It supports both SSE streaming and direct HTTP responses.
|
| 24 |
+
*
|
| 25 |
+
* This is a wrapper around `WebStandardStreamableHTTPServerTransport` that provides Node.js HTTP compatibility.
|
| 26 |
+
* It uses the `@hono/node-server` library to convert between Node.js HTTP and Web Standard APIs.
|
| 27 |
+
*
|
| 28 |
+
* Usage example:
|
| 29 |
+
*
|
| 30 |
+
* ```typescript
|
| 31 |
+
* // Stateful mode - server sets the session ID
|
| 32 |
+
* const statefulTransport = new StreamableHTTPServerTransport({
|
| 33 |
+
* sessionIdGenerator: () => randomUUID(),
|
| 34 |
+
* });
|
| 35 |
+
*
|
| 36 |
+
* // Stateless mode - explicitly set session ID to undefined
|
| 37 |
+
* const statelessTransport = new StreamableHTTPServerTransport({
|
| 38 |
+
* sessionIdGenerator: undefined,
|
| 39 |
+
* });
|
| 40 |
+
*
|
| 41 |
+
* // Using with pre-parsed request body
|
| 42 |
+
* app.post('/mcp', (req, res) => {
|
| 43 |
+
* transport.handleRequest(req, res, req.body);
|
| 44 |
+
* });
|
| 45 |
+
* ```
|
| 46 |
+
*
|
| 47 |
+
* In stateful mode:
|
| 48 |
+
* - Session ID is generated and included in response headers
|
| 49 |
+
* - Session ID is always included in initialization responses
|
| 50 |
+
* - Requests with invalid session IDs are rejected with 404 Not Found
|
| 51 |
+
* - Non-initialization requests without a session ID are rejected with 400 Bad Request
|
| 52 |
+
* - State is maintained in-memory (connections, message history)
|
| 53 |
+
*
|
| 54 |
+
* In stateless mode:
|
| 55 |
+
* - No Session ID is included in any responses
|
| 56 |
+
* - No session validation is performed
|
| 57 |
+
*/
|
| 58 |
+
export declare class StreamableHTTPServerTransport implements Transport {
|
| 59 |
+
private _webStandardTransport;
|
| 60 |
+
private _requestListener;
|
| 61 |
+
private _requestContext;
|
| 62 |
+
constructor(options?: StreamableHTTPServerTransportOptions);
|
| 63 |
+
/**
|
| 64 |
+
* Gets the session ID for this transport instance.
|
| 65 |
+
*/
|
| 66 |
+
get sessionId(): string | undefined;
|
| 67 |
+
/**
|
| 68 |
+
* Sets callback for when the transport is closed.
|
| 69 |
+
*/
|
| 70 |
+
set onclose(handler: (() => void) | undefined);
|
| 71 |
+
get onclose(): (() => void) | undefined;
|
| 72 |
+
/**
|
| 73 |
+
* Sets callback for transport errors.
|
| 74 |
+
*/
|
| 75 |
+
set onerror(handler: ((error: Error) => void) | undefined);
|
| 76 |
+
get onerror(): ((error: Error) => void) | undefined;
|
| 77 |
+
/**
|
| 78 |
+
* Sets callback for incoming messages.
|
| 79 |
+
*/
|
| 80 |
+
set onmessage(handler: ((message: JSONRPCMessage, extra?: MessageExtraInfo) => void) | undefined);
|
| 81 |
+
get onmessage(): ((message: JSONRPCMessage, extra?: MessageExtraInfo) => void) | undefined;
|
| 82 |
+
/**
|
| 83 |
+
* Starts the transport. This is required by the Transport interface but is a no-op
|
| 84 |
+
* for the Streamable HTTP transport as connections are managed per-request.
|
| 85 |
+
*/
|
| 86 |
+
start(): Promise<void>;
|
| 87 |
+
/**
|
| 88 |
+
* Closes the transport and all active connections.
|
| 89 |
+
*/
|
| 90 |
+
close(): Promise<void>;
|
| 91 |
+
/**
|
| 92 |
+
* Sends a JSON-RPC message through the transport.
|
| 93 |
+
*/
|
| 94 |
+
send(message: JSONRPCMessage, options?: {
|
| 95 |
+
relatedRequestId?: RequestId;
|
| 96 |
+
}): Promise<void>;
|
| 97 |
+
/**
|
| 98 |
+
* Handles an incoming HTTP request, whether GET or POST.
|
| 99 |
+
*
|
| 100 |
+
* This method converts Node.js HTTP objects to Web Standard Request/Response
|
| 101 |
+
* and delegates to the underlying WebStandardStreamableHTTPServerTransport.
|
| 102 |
+
*
|
| 103 |
+
* @param req - Node.js IncomingMessage, optionally with auth property from middleware
|
| 104 |
+
* @param res - Node.js ServerResponse
|
| 105 |
+
* @param parsedBody - Optional pre-parsed body from body-parser middleware
|
| 106 |
+
*/
|
| 107 |
+
handleRequest(req: IncomingMessage & {
|
| 108 |
+
auth?: AuthInfo;
|
| 109 |
+
}, res: ServerResponse, parsedBody?: unknown): Promise<void>;
|
| 110 |
+
/**
|
| 111 |
+
* Close an SSE stream for a specific request, triggering client reconnection.
|
| 112 |
+
* Use this to implement polling behavior during long-running operations -
|
| 113 |
+
* client will reconnect after the retry interval specified in the priming event.
|
| 114 |
+
*/
|
| 115 |
+
closeSSEStream(requestId: RequestId): void;
|
| 116 |
+
/**
|
| 117 |
+
* Close the standalone GET SSE stream, triggering client reconnection.
|
| 118 |
+
* Use this to implement polling behavior for server-initiated notifications.
|
| 119 |
+
*/
|
| 120 |
+
closeStandaloneSSEStream(): void;
|
| 121 |
+
}
|
| 122 |
+
//# sourceMappingURL=streamableHttp.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/streamableHttp.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"streamableHttp.d.ts","sourceRoot":"","sources":["../../../src/server/streamableHttp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAEH,+CAA+C,EAC/C,UAAU,EACV,QAAQ,EACR,OAAO,EACV,MAAM,gCAAgC,CAAC;AAGxC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAA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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
/**
|
| 3 |
+
* Node.js HTTP Streamable HTTP Server Transport
|
| 4 |
+
*
|
| 5 |
+
* This is a thin wrapper around `WebStandardStreamableHTTPServerTransport` that provides
|
| 6 |
+
* compatibility with Node.js HTTP server (IncomingMessage/ServerResponse).
|
| 7 |
+
*
|
| 8 |
+
* For web-standard environments (Cloudflare Workers, Deno, Bun), use `WebStandardStreamableHTTPServerTransport` directly.
|
| 9 |
+
*/
|
| 10 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 11 |
+
exports.StreamableHTTPServerTransport = void 0;
|
| 12 |
+
const node_server_1 = require("@hono/node-server");
|
| 13 |
+
const webStandardStreamableHttp_js_1 = require("./webStandardStreamableHttp.js");
|
| 14 |
+
/**
|
| 15 |
+
* Server transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification.
|
| 16 |
+
* It supports both SSE streaming and direct HTTP responses.
|
| 17 |
+
*
|
| 18 |
+
* This is a wrapper around `WebStandardStreamableHTTPServerTransport` that provides Node.js HTTP compatibility.
|
| 19 |
+
* It uses the `@hono/node-server` library to convert between Node.js HTTP and Web Standard APIs.
|
| 20 |
+
*
|
| 21 |
+
* Usage example:
|
| 22 |
+
*
|
| 23 |
+
* ```typescript
|
| 24 |
+
* // Stateful mode - server sets the session ID
|
| 25 |
+
* const statefulTransport = new StreamableHTTPServerTransport({
|
| 26 |
+
* sessionIdGenerator: () => randomUUID(),
|
| 27 |
+
* });
|
| 28 |
+
*
|
| 29 |
+
* // Stateless mode - explicitly set session ID to undefined
|
| 30 |
+
* const statelessTransport = new StreamableHTTPServerTransport({
|
| 31 |
+
* sessionIdGenerator: undefined,
|
| 32 |
+
* });
|
| 33 |
+
*
|
| 34 |
+
* // Using with pre-parsed request body
|
| 35 |
+
* app.post('/mcp', (req, res) => {
|
| 36 |
+
* transport.handleRequest(req, res, req.body);
|
| 37 |
+
* });
|
| 38 |
+
* ```
|
| 39 |
+
*
|
| 40 |
+
* In stateful mode:
|
| 41 |
+
* - Session ID is generated and included in response headers
|
| 42 |
+
* - Session ID is always included in initialization responses
|
| 43 |
+
* - Requests with invalid session IDs are rejected with 404 Not Found
|
| 44 |
+
* - Non-initialization requests without a session ID are rejected with 400 Bad Request
|
| 45 |
+
* - State is maintained in-memory (connections, message history)
|
| 46 |
+
*
|
| 47 |
+
* In stateless mode:
|
| 48 |
+
* - No Session ID is included in any responses
|
| 49 |
+
* - No session validation is performed
|
| 50 |
+
*/
|
| 51 |
+
class StreamableHTTPServerTransport {
|
| 52 |
+
constructor(options = {}) {
|
| 53 |
+
// Store auth and parsedBody per request for passing through to handleRequest
|
| 54 |
+
this._requestContext = new WeakMap();
|
| 55 |
+
this._webStandardTransport = new webStandardStreamableHttp_js_1.WebStandardStreamableHTTPServerTransport(options);
|
| 56 |
+
// Create a request listener that wraps the web standard transport
|
| 57 |
+
// getRequestListener converts Node.js HTTP to Web Standard and properly handles SSE streaming
|
| 58 |
+
// overrideGlobalObjects: false prevents Hono from overwriting global Response, which would
|
| 59 |
+
// break frameworks like Next.js whose response classes extend the native Response
|
| 60 |
+
this._requestListener = (0, node_server_1.getRequestListener)(async (webRequest) => {
|
| 61 |
+
// Get context if available (set during handleRequest)
|
| 62 |
+
const context = this._requestContext.get(webRequest);
|
| 63 |
+
return this._webStandardTransport.handleRequest(webRequest, {
|
| 64 |
+
authInfo: context?.authInfo,
|
| 65 |
+
parsedBody: context?.parsedBody
|
| 66 |
+
});
|
| 67 |
+
}, { overrideGlobalObjects: false });
|
| 68 |
+
}
|
| 69 |
+
/**
|
| 70 |
+
* Gets the session ID for this transport instance.
|
| 71 |
+
*/
|
| 72 |
+
get sessionId() {
|
| 73 |
+
return this._webStandardTransport.sessionId;
|
| 74 |
+
}
|
| 75 |
+
/**
|
| 76 |
+
* Sets callback for when the transport is closed.
|
| 77 |
+
*/
|
| 78 |
+
set onclose(handler) {
|
| 79 |
+
this._webStandardTransport.onclose = handler;
|
| 80 |
+
}
|
| 81 |
+
get onclose() {
|
| 82 |
+
return this._webStandardTransport.onclose;
|
| 83 |
+
}
|
| 84 |
+
/**
|
| 85 |
+
* Sets callback for transport errors.
|
| 86 |
+
*/
|
| 87 |
+
set onerror(handler) {
|
| 88 |
+
this._webStandardTransport.onerror = handler;
|
| 89 |
+
}
|
| 90 |
+
get onerror() {
|
| 91 |
+
return this._webStandardTransport.onerror;
|
| 92 |
+
}
|
| 93 |
+
/**
|
| 94 |
+
* Sets callback for incoming messages.
|
| 95 |
+
*/
|
| 96 |
+
set onmessage(handler) {
|
| 97 |
+
this._webStandardTransport.onmessage = handler;
|
| 98 |
+
}
|
| 99 |
+
get onmessage() {
|
| 100 |
+
return this._webStandardTransport.onmessage;
|
| 101 |
+
}
|
| 102 |
+
/**
|
| 103 |
+
* Starts the transport. This is required by the Transport interface but is a no-op
|
| 104 |
+
* for the Streamable HTTP transport as connections are managed per-request.
|
| 105 |
+
*/
|
| 106 |
+
async start() {
|
| 107 |
+
return this._webStandardTransport.start();
|
| 108 |
+
}
|
| 109 |
+
/**
|
| 110 |
+
* Closes the transport and all active connections.
|
| 111 |
+
*/
|
| 112 |
+
async close() {
|
| 113 |
+
return this._webStandardTransport.close();
|
| 114 |
+
}
|
| 115 |
+
/**
|
| 116 |
+
* Sends a JSON-RPC message through the transport.
|
| 117 |
+
*/
|
| 118 |
+
async send(message, options) {
|
| 119 |
+
return this._webStandardTransport.send(message, options);
|
| 120 |
+
}
|
| 121 |
+
/**
|
| 122 |
+
* Handles an incoming HTTP request, whether GET or POST.
|
| 123 |
+
*
|
| 124 |
+
* This method converts Node.js HTTP objects to Web Standard Request/Response
|
| 125 |
+
* and delegates to the underlying WebStandardStreamableHTTPServerTransport.
|
| 126 |
+
*
|
| 127 |
+
* @param req - Node.js IncomingMessage, optionally with auth property from middleware
|
| 128 |
+
* @param res - Node.js ServerResponse
|
| 129 |
+
* @param parsedBody - Optional pre-parsed body from body-parser middleware
|
| 130 |
+
*/
|
| 131 |
+
async handleRequest(req, res, parsedBody) {
|
| 132 |
+
// Store context for this request to pass through auth and parsedBody
|
| 133 |
+
// We need to intercept the request creation to attach this context
|
| 134 |
+
const authInfo = req.auth;
|
| 135 |
+
// Create a custom handler that includes our context
|
| 136 |
+
// overrideGlobalObjects: false prevents Hono from overwriting global Response, which would
|
| 137 |
+
// break frameworks like Next.js whose response classes extend the native Response
|
| 138 |
+
const handler = (0, node_server_1.getRequestListener)(async (webRequest) => {
|
| 139 |
+
return this._webStandardTransport.handleRequest(webRequest, {
|
| 140 |
+
authInfo,
|
| 141 |
+
parsedBody
|
| 142 |
+
});
|
| 143 |
+
}, { overrideGlobalObjects: false });
|
| 144 |
+
// Delegate to the request listener which handles all the Node.js <-> Web Standard conversion
|
| 145 |
+
// including proper SSE streaming support
|
| 146 |
+
await handler(req, res);
|
| 147 |
+
}
|
| 148 |
+
/**
|
| 149 |
+
* Close an SSE stream for a specific request, triggering client reconnection.
|
| 150 |
+
* Use this to implement polling behavior during long-running operations -
|
| 151 |
+
* client will reconnect after the retry interval specified in the priming event.
|
| 152 |
+
*/
|
| 153 |
+
closeSSEStream(requestId) {
|
| 154 |
+
this._webStandardTransport.closeSSEStream(requestId);
|
| 155 |
+
}
|
| 156 |
+
/**
|
| 157 |
+
* Close the standalone GET SSE stream, triggering client reconnection.
|
| 158 |
+
* Use this to implement polling behavior for server-initiated notifications.
|
| 159 |
+
*/
|
| 160 |
+
closeStandaloneSSEStream() {
|
| 161 |
+
this._webStandardTransport.closeStandaloneSSEStream();
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
exports.StreamableHTTPServerTransport = StreamableHTTPServerTransport;
|
| 165 |
+
//# sourceMappingURL=streamableHttp.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/streamableHttp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"streamableHttp.js","sourceRoot":"","sources":["../../../src/server/streamableHttp.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAGH,mDAAuD;AAIvD,iFAMwC;AAYxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAa,6BAA6B;IAMtC,YAAY,UAAgD,EAAE;QAH9D,6EAA6E;QACrE,oBAAe,GAAoE,IAAI,OAAO,EAAE,CAAC;QAGrG,IAAI,CAAC,qBAAqB,GAAG,IAAI,uEAAwC,CAAC,OAAO,CAAC,CAAC;QAEnF,kEAAkE;QAClE,8FAA8F;QAC9F,2FAA2F;QAC3F,kFAAkF;QAClF,IAAI,CAAC,gBAAgB,GAAG,IAAA,gCAAkB,EACtC,KAAK,EAAE,UAAmB,EAAE,EAAE;YAC1B,sDAAsD;YACtD,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,UAAU,EAAE;gBACxD,QAAQ,EAAE,OAAO,EAAE,QAAQ;gBAC3B,UAAU,EAAE,OAAO,EAAE,UAAU;aAClC,CAAC,CAAC;QACP,CAAC,EACD,EAAE,qBAAqB,EAAE,KAAK,EAAE,CACnC,CAAC;IACN,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC;IAChD,CAAC;IAED;;OAEG;IACH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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Web Standards Streamable HTTP Server Transport
|
| 3 |
+
*
|
| 4 |
+
* This is the core transport implementation using Web Standard APIs (Request, Response, ReadableStream).
|
| 5 |
+
* It can run on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc.
|
| 6 |
+
*
|
| 7 |
+
* For Node.js Express/HTTP compatibility, use `StreamableHTTPServerTransport` which wraps this transport.
|
| 8 |
+
*/
|
| 9 |
+
import { Transport } from '../shared/transport.js';
|
| 10 |
+
import { AuthInfo } from './auth/types.js';
|
| 11 |
+
import { MessageExtraInfo, JSONRPCMessage, RequestId } from '../types.js';
|
| 12 |
+
export type StreamId = string;
|
| 13 |
+
export type EventId = string;
|
| 14 |
+
/**
|
| 15 |
+
* Interface for resumability support via event storage
|
| 16 |
+
*/
|
| 17 |
+
export interface EventStore {
|
| 18 |
+
/**
|
| 19 |
+
* Stores an event for later retrieval
|
| 20 |
+
* @param streamId ID of the stream the event belongs to
|
| 21 |
+
* @param message The JSON-RPC message to store
|
| 22 |
+
* @returns The generated event ID for the stored event
|
| 23 |
+
*/
|
| 24 |
+
storeEvent(streamId: StreamId, message: JSONRPCMessage): Promise<EventId>;
|
| 25 |
+
/**
|
| 26 |
+
* Get the stream ID associated with a given event ID.
|
| 27 |
+
* @param eventId The event ID to look up
|
| 28 |
+
* @returns The stream ID, or undefined if not found
|
| 29 |
+
*
|
| 30 |
+
* Optional: If not provided, the SDK will use the streamId returned by
|
| 31 |
+
* replayEventsAfter for stream mapping.
|
| 32 |
+
*/
|
| 33 |
+
getStreamIdForEventId?(eventId: EventId): Promise<StreamId | undefined>;
|
| 34 |
+
replayEventsAfter(lastEventId: EventId, { send }: {
|
| 35 |
+
send: (eventId: EventId, message: JSONRPCMessage) => Promise<void>;
|
| 36 |
+
}): Promise<StreamId>;
|
| 37 |
+
}
|
| 38 |
+
/**
|
| 39 |
+
* Configuration options for WebStandardStreamableHTTPServerTransport
|
| 40 |
+
*/
|
| 41 |
+
export interface WebStandardStreamableHTTPServerTransportOptions {
|
| 42 |
+
/**
|
| 43 |
+
* Function that generates a session ID for the transport.
|
| 44 |
+
* The session ID SHOULD be globally unique and cryptographically secure (e.g., a securely generated UUID, a JWT, or a cryptographic hash)
|
| 45 |
+
*
|
| 46 |
+
* If not provided, session management is disabled (stateless mode).
|
| 47 |
+
*/
|
| 48 |
+
sessionIdGenerator?: () => string;
|
| 49 |
+
/**
|
| 50 |
+
* A callback for session initialization events
|
| 51 |
+
* This is called when the server initializes a new session.
|
| 52 |
+
* Useful in cases when you need to register multiple mcp sessions
|
| 53 |
+
* and need to keep track of them.
|
| 54 |
+
* @param sessionId The generated session ID
|
| 55 |
+
*/
|
| 56 |
+
onsessioninitialized?: (sessionId: string) => void | Promise<void>;
|
| 57 |
+
/**
|
| 58 |
+
* A callback for session close events
|
| 59 |
+
* This is called when the server closes a session due to a DELETE request.
|
| 60 |
+
* Useful in cases when you need to clean up resources associated with the session.
|
| 61 |
+
* Note that this is different from the transport closing, if you are handling
|
| 62 |
+
* HTTP requests from multiple nodes you might want to close each
|
| 63 |
+
* WebStandardStreamableHTTPServerTransport after a request is completed while still keeping the
|
| 64 |
+
* session open/running.
|
| 65 |
+
* @param sessionId The session ID that was closed
|
| 66 |
+
*/
|
| 67 |
+
onsessionclosed?: (sessionId: string) => void | Promise<void>;
|
| 68 |
+
/**
|
| 69 |
+
* If true, the server will return JSON responses instead of starting an SSE stream.
|
| 70 |
+
* This can be useful for simple request/response scenarios without streaming.
|
| 71 |
+
* Default is false (SSE streams are preferred).
|
| 72 |
+
*/
|
| 73 |
+
enableJsonResponse?: boolean;
|
| 74 |
+
/**
|
| 75 |
+
* Event store for resumability support
|
| 76 |
+
* If provided, resumability will be enabled, allowing clients to reconnect and resume messages
|
| 77 |
+
*/
|
| 78 |
+
eventStore?: EventStore;
|
| 79 |
+
/**
|
| 80 |
+
* List of allowed host header values for DNS rebinding protection.
|
| 81 |
+
* If not specified, host validation is disabled.
|
| 82 |
+
* @deprecated Use external middleware for host validation instead.
|
| 83 |
+
*/
|
| 84 |
+
allowedHosts?: string[];
|
| 85 |
+
/**
|
| 86 |
+
* List of allowed origin header values for DNS rebinding protection.
|
| 87 |
+
* If not specified, origin validation is disabled.
|
| 88 |
+
* @deprecated Use external middleware for origin validation instead.
|
| 89 |
+
*/
|
| 90 |
+
allowedOrigins?: string[];
|
| 91 |
+
/**
|
| 92 |
+
* Enable DNS rebinding protection (requires allowedHosts and/or allowedOrigins to be configured).
|
| 93 |
+
* Default is false for backwards compatibility.
|
| 94 |
+
* @deprecated Use external middleware for DNS rebinding protection instead.
|
| 95 |
+
*/
|
| 96 |
+
enableDnsRebindingProtection?: boolean;
|
| 97 |
+
/**
|
| 98 |
+
* Retry interval in milliseconds to suggest to clients in SSE retry field.
|
| 99 |
+
* When set, the server will send a retry field in SSE priming events to control
|
| 100 |
+
* client reconnection timing for polling behavior.
|
| 101 |
+
*/
|
| 102 |
+
retryInterval?: number;
|
| 103 |
+
}
|
| 104 |
+
/**
|
| 105 |
+
* Options for handling a request
|
| 106 |
+
*/
|
| 107 |
+
export interface HandleRequestOptions {
|
| 108 |
+
/**
|
| 109 |
+
* Pre-parsed request body. If provided, the transport will use this instead of parsing req.json().
|
| 110 |
+
* Useful when using body-parser middleware that has already parsed the body.
|
| 111 |
+
*/
|
| 112 |
+
parsedBody?: unknown;
|
| 113 |
+
/**
|
| 114 |
+
* Authentication info from middleware. If provided, will be passed to message handlers.
|
| 115 |
+
*/
|
| 116 |
+
authInfo?: AuthInfo;
|
| 117 |
+
}
|
| 118 |
+
/**
|
| 119 |
+
* Server transport for Web Standards Streamable HTTP: this implements the MCP Streamable HTTP transport specification
|
| 120 |
+
* using Web Standard APIs (Request, Response, ReadableStream).
|
| 121 |
+
*
|
| 122 |
+
* This transport works on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc.
|
| 123 |
+
*
|
| 124 |
+
* Usage example:
|
| 125 |
+
*
|
| 126 |
+
* ```typescript
|
| 127 |
+
* // Stateful mode - server sets the session ID
|
| 128 |
+
* const statefulTransport = new WebStandardStreamableHTTPServerTransport({
|
| 129 |
+
* sessionIdGenerator: () => crypto.randomUUID(),
|
| 130 |
+
* });
|
| 131 |
+
*
|
| 132 |
+
* // Stateless mode - explicitly set session ID to undefined
|
| 133 |
+
* const statelessTransport = new WebStandardStreamableHTTPServerTransport({
|
| 134 |
+
* sessionIdGenerator: undefined,
|
| 135 |
+
* });
|
| 136 |
+
*
|
| 137 |
+
* // Hono.js usage
|
| 138 |
+
* app.all('/mcp', async (c) => {
|
| 139 |
+
* return transport.handleRequest(c.req.raw);
|
| 140 |
+
* });
|
| 141 |
+
*
|
| 142 |
+
* // Cloudflare Workers usage
|
| 143 |
+
* export default {
|
| 144 |
+
* async fetch(request: Request): Promise<Response> {
|
| 145 |
+
* return transport.handleRequest(request);
|
| 146 |
+
* }
|
| 147 |
+
* };
|
| 148 |
+
* ```
|
| 149 |
+
*
|
| 150 |
+
* In stateful mode:
|
| 151 |
+
* - Session ID is generated and included in response headers
|
| 152 |
+
* - Session ID is always included in initialization responses
|
| 153 |
+
* - Requests with invalid session IDs are rejected with 404 Not Found
|
| 154 |
+
* - Non-initialization requests without a session ID are rejected with 400 Bad Request
|
| 155 |
+
* - State is maintained in-memory (connections, message history)
|
| 156 |
+
*
|
| 157 |
+
* In stateless mode:
|
| 158 |
+
* - No Session ID is included in any responses
|
| 159 |
+
* - No session validation is performed
|
| 160 |
+
*/
|
| 161 |
+
export declare class WebStandardStreamableHTTPServerTransport implements Transport {
|
| 162 |
+
private sessionIdGenerator;
|
| 163 |
+
private _started;
|
| 164 |
+
private _hasHandledRequest;
|
| 165 |
+
private _streamMapping;
|
| 166 |
+
private _requestToStreamMapping;
|
| 167 |
+
private _requestResponseMap;
|
| 168 |
+
private _initialized;
|
| 169 |
+
private _enableJsonResponse;
|
| 170 |
+
private _standaloneSseStreamId;
|
| 171 |
+
private _eventStore?;
|
| 172 |
+
private _onsessioninitialized?;
|
| 173 |
+
private _onsessionclosed?;
|
| 174 |
+
private _allowedHosts?;
|
| 175 |
+
private _allowedOrigins?;
|
| 176 |
+
private _enableDnsRebindingProtection;
|
| 177 |
+
private _retryInterval?;
|
| 178 |
+
sessionId?: string;
|
| 179 |
+
onclose?: () => void;
|
| 180 |
+
onerror?: (error: Error) => void;
|
| 181 |
+
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
| 182 |
+
constructor(options?: WebStandardStreamableHTTPServerTransportOptions);
|
| 183 |
+
/**
|
| 184 |
+
* Starts the transport. This is required by the Transport interface but is a no-op
|
| 185 |
+
* for the Streamable HTTP transport as connections are managed per-request.
|
| 186 |
+
*/
|
| 187 |
+
start(): Promise<void>;
|
| 188 |
+
/**
|
| 189 |
+
* Helper to create a JSON error response
|
| 190 |
+
*/
|
| 191 |
+
private createJsonErrorResponse;
|
| 192 |
+
/**
|
| 193 |
+
* Validates request headers for DNS rebinding protection.
|
| 194 |
+
* @returns Error response if validation fails, undefined if validation passes.
|
| 195 |
+
*/
|
| 196 |
+
private validateRequestHeaders;
|
| 197 |
+
/**
|
| 198 |
+
* Handles an incoming HTTP request, whether GET, POST, or DELETE
|
| 199 |
+
* Returns a Response object (Web Standard)
|
| 200 |
+
*/
|
| 201 |
+
handleRequest(req: Request, options?: HandleRequestOptions): Promise<Response>;
|
| 202 |
+
/**
|
| 203 |
+
* Writes a priming event to establish resumption capability.
|
| 204 |
+
* Only sends if eventStore is configured (opt-in for resumability) and
|
| 205 |
+
* the client's protocol version supports empty SSE data (>= 2025-11-25).
|
| 206 |
+
*/
|
| 207 |
+
private writePrimingEvent;
|
| 208 |
+
/**
|
| 209 |
+
* Handles GET requests for SSE stream
|
| 210 |
+
*/
|
| 211 |
+
private handleGetRequest;
|
| 212 |
+
/**
|
| 213 |
+
* Replays events that would have been sent after the specified event ID
|
| 214 |
+
* Only used when resumability is enabled
|
| 215 |
+
*/
|
| 216 |
+
private replayEvents;
|
| 217 |
+
/**
|
| 218 |
+
* Writes an event to an SSE stream via controller with proper formatting
|
| 219 |
+
*/
|
| 220 |
+
private writeSSEEvent;
|
| 221 |
+
/**
|
| 222 |
+
* Handles unsupported requests (PUT, PATCH, etc.)
|
| 223 |
+
*/
|
| 224 |
+
private handleUnsupportedRequest;
|
| 225 |
+
/**
|
| 226 |
+
* Handles POST requests containing JSON-RPC messages
|
| 227 |
+
*/
|
| 228 |
+
private handlePostRequest;
|
| 229 |
+
/**
|
| 230 |
+
* Handles DELETE requests to terminate sessions
|
| 231 |
+
*/
|
| 232 |
+
private handleDeleteRequest;
|
| 233 |
+
/**
|
| 234 |
+
* Validates session ID for non-initialization requests.
|
| 235 |
+
* Returns Response error if invalid, undefined otherwise
|
| 236 |
+
*/
|
| 237 |
+
private validateSession;
|
| 238 |
+
/**
|
| 239 |
+
* Validates the MCP-Protocol-Version header on incoming requests.
|
| 240 |
+
*
|
| 241 |
+
* For initialization: Version negotiation handles unknown versions gracefully
|
| 242 |
+
* (server responds with its supported version).
|
| 243 |
+
*
|
| 244 |
+
* For subsequent requests with MCP-Protocol-Version header:
|
| 245 |
+
* - Accept if in supported list
|
| 246 |
+
* - 400 if unsupported
|
| 247 |
+
*
|
| 248 |
+
* For HTTP requests without the MCP-Protocol-Version header:
|
| 249 |
+
* - Accept and default to the version negotiated at initialization
|
| 250 |
+
*/
|
| 251 |
+
private validateProtocolVersion;
|
| 252 |
+
close(): Promise<void>;
|
| 253 |
+
/**
|
| 254 |
+
* Close an SSE stream for a specific request, triggering client reconnection.
|
| 255 |
+
* Use this to implement polling behavior during long-running operations -
|
| 256 |
+
* client will reconnect after the retry interval specified in the priming event.
|
| 257 |
+
*/
|
| 258 |
+
closeSSEStream(requestId: RequestId): void;
|
| 259 |
+
/**
|
| 260 |
+
* Close the standalone GET SSE stream, triggering client reconnection.
|
| 261 |
+
* Use this to implement polling behavior for server-initiated notifications.
|
| 262 |
+
*/
|
| 263 |
+
closeStandaloneSSEStream(): void;
|
| 264 |
+
send(message: JSONRPCMessage, options?: {
|
| 265 |
+
relatedRequestId?: RequestId;
|
| 266 |
+
}): Promise<void>;
|
| 267 |
+
}
|
| 268 |
+
//# sourceMappingURL=webStandardStreamableHttp.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"webStandardStreamableHttp.d.ts","sourceRoot":"","sources":["../../../src/server/webStandardStreamableHttp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACH,gBAAgB,EAMhB,cAAc,EAEd,SAAS,EAGZ,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1E;;;;;;;OAOG;IACH,qBAAqB,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;IAExE,iBAAiB,CACb,WAAW,EAAE,OAAO,EACpB,EACI,IAAI,EACP,EAAE;QACC,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACtE,GACF,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxB;AAgBD;;GAEG;AACH,MAAM,WAAW,+CAA+C;IAC5D;;;;;OAKG;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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
/**
|
| 3 |
+
* Web Standards Streamable HTTP Server Transport
|
| 4 |
+
*
|
| 5 |
+
* This is the core transport implementation using Web Standard APIs (Request, Response, ReadableStream).
|
| 6 |
+
* It can run on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc.
|
| 7 |
+
*
|
| 8 |
+
* For Node.js Express/HTTP compatibility, use `StreamableHTTPServerTransport` which wraps this transport.
|
| 9 |
+
*/
|
| 10 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 11 |
+
exports.WebStandardStreamableHTTPServerTransport = void 0;
|
| 12 |
+
const types_js_1 = require("../types.js");
|
| 13 |
+
/**
|
| 14 |
+
* Server transport for Web Standards Streamable HTTP: this implements the MCP Streamable HTTP transport specification
|
| 15 |
+
* using Web Standard APIs (Request, Response, ReadableStream).
|
| 16 |
+
*
|
| 17 |
+
* This transport works on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc.
|
| 18 |
+
*
|
| 19 |
+
* Usage example:
|
| 20 |
+
*
|
| 21 |
+
* ```typescript
|
| 22 |
+
* // Stateful mode - server sets the session ID
|
| 23 |
+
* const statefulTransport = new WebStandardStreamableHTTPServerTransport({
|
| 24 |
+
* sessionIdGenerator: () => crypto.randomUUID(),
|
| 25 |
+
* });
|
| 26 |
+
*
|
| 27 |
+
* // Stateless mode - explicitly set session ID to undefined
|
| 28 |
+
* const statelessTransport = new WebStandardStreamableHTTPServerTransport({
|
| 29 |
+
* sessionIdGenerator: undefined,
|
| 30 |
+
* });
|
| 31 |
+
*
|
| 32 |
+
* // Hono.js usage
|
| 33 |
+
* app.all('/mcp', async (c) => {
|
| 34 |
+
* return transport.handleRequest(c.req.raw);
|
| 35 |
+
* });
|
| 36 |
+
*
|
| 37 |
+
* // Cloudflare Workers usage
|
| 38 |
+
* export default {
|
| 39 |
+
* async fetch(request: Request): Promise<Response> {
|
| 40 |
+
* return transport.handleRequest(request);
|
| 41 |
+
* }
|
| 42 |
+
* };
|
| 43 |
+
* ```
|
| 44 |
+
*
|
| 45 |
+
* In stateful mode:
|
| 46 |
+
* - Session ID is generated and included in response headers
|
| 47 |
+
* - Session ID is always included in initialization responses
|
| 48 |
+
* - Requests with invalid session IDs are rejected with 404 Not Found
|
| 49 |
+
* - Non-initialization requests without a session ID are rejected with 400 Bad Request
|
| 50 |
+
* - State is maintained in-memory (connections, message history)
|
| 51 |
+
*
|
| 52 |
+
* In stateless mode:
|
| 53 |
+
* - No Session ID is included in any responses
|
| 54 |
+
* - No session validation is performed
|
| 55 |
+
*/
|
| 56 |
+
class WebStandardStreamableHTTPServerTransport {
|
| 57 |
+
constructor(options = {}) {
|
| 58 |
+
this._started = false;
|
| 59 |
+
this._hasHandledRequest = false;
|
| 60 |
+
this._streamMapping = new Map();
|
| 61 |
+
this._requestToStreamMapping = new Map();
|
| 62 |
+
this._requestResponseMap = new Map();
|
| 63 |
+
this._initialized = false;
|
| 64 |
+
this._enableJsonResponse = false;
|
| 65 |
+
this._standaloneSseStreamId = '_GET_stream';
|
| 66 |
+
this.sessionIdGenerator = options.sessionIdGenerator;
|
| 67 |
+
this._enableJsonResponse = options.enableJsonResponse ?? false;
|
| 68 |
+
this._eventStore = options.eventStore;
|
| 69 |
+
this._onsessioninitialized = options.onsessioninitialized;
|
| 70 |
+
this._onsessionclosed = options.onsessionclosed;
|
| 71 |
+
this._allowedHosts = options.allowedHosts;
|
| 72 |
+
this._allowedOrigins = options.allowedOrigins;
|
| 73 |
+
this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false;
|
| 74 |
+
this._retryInterval = options.retryInterval;
|
| 75 |
+
}
|
| 76 |
+
/**
|
| 77 |
+
* Starts the transport. This is required by the Transport interface but is a no-op
|
| 78 |
+
* for the Streamable HTTP transport as connections are managed per-request.
|
| 79 |
+
*/
|
| 80 |
+
async start() {
|
| 81 |
+
if (this._started) {
|
| 82 |
+
throw new Error('Transport already started');
|
| 83 |
+
}
|
| 84 |
+
this._started = true;
|
| 85 |
+
}
|
| 86 |
+
/**
|
| 87 |
+
* Helper to create a JSON error response
|
| 88 |
+
*/
|
| 89 |
+
createJsonErrorResponse(status, code, message, options) {
|
| 90 |
+
const error = { code, message };
|
| 91 |
+
if (options?.data !== undefined) {
|
| 92 |
+
error.data = options.data;
|
| 93 |
+
}
|
| 94 |
+
return new Response(JSON.stringify({
|
| 95 |
+
jsonrpc: '2.0',
|
| 96 |
+
error,
|
| 97 |
+
id: null
|
| 98 |
+
}), {
|
| 99 |
+
status,
|
| 100 |
+
headers: {
|
| 101 |
+
'Content-Type': 'application/json',
|
| 102 |
+
...options?.headers
|
| 103 |
+
}
|
| 104 |
+
});
|
| 105 |
+
}
|
| 106 |
+
/**
|
| 107 |
+
* Validates request headers for DNS rebinding protection.
|
| 108 |
+
* @returns Error response if validation fails, undefined if validation passes.
|
| 109 |
+
*/
|
| 110 |
+
validateRequestHeaders(req) {
|
| 111 |
+
// Skip validation if protection is not enabled
|
| 112 |
+
if (!this._enableDnsRebindingProtection) {
|
| 113 |
+
return undefined;
|
| 114 |
+
}
|
| 115 |
+
// Validate Host header if allowedHosts is configured
|
| 116 |
+
if (this._allowedHosts && this._allowedHosts.length > 0) {
|
| 117 |
+
const hostHeader = req.headers.get('host');
|
| 118 |
+
if (!hostHeader || !this._allowedHosts.includes(hostHeader)) {
|
| 119 |
+
const error = `Invalid Host header: ${hostHeader}`;
|
| 120 |
+
this.onerror?.(new Error(error));
|
| 121 |
+
return this.createJsonErrorResponse(403, -32000, error);
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
// Validate Origin header if allowedOrigins is configured
|
| 125 |
+
if (this._allowedOrigins && this._allowedOrigins.length > 0) {
|
| 126 |
+
const originHeader = req.headers.get('origin');
|
| 127 |
+
if (originHeader && !this._allowedOrigins.includes(originHeader)) {
|
| 128 |
+
const error = `Invalid Origin header: ${originHeader}`;
|
| 129 |
+
this.onerror?.(new Error(error));
|
| 130 |
+
return this.createJsonErrorResponse(403, -32000, error);
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
return undefined;
|
| 134 |
+
}
|
| 135 |
+
/**
|
| 136 |
+
* Handles an incoming HTTP request, whether GET, POST, or DELETE
|
| 137 |
+
* Returns a Response object (Web Standard)
|
| 138 |
+
*/
|
| 139 |
+
async handleRequest(req, options) {
|
| 140 |
+
// In stateless mode (no sessionIdGenerator), each request must use a fresh transport.
|
| 141 |
+
// Reusing a stateless transport causes message ID collisions between clients.
|
| 142 |
+
if (!this.sessionIdGenerator && this._hasHandledRequest) {
|
| 143 |
+
throw new Error('Stateless transport cannot be reused across requests. Create a new transport per request.');
|
| 144 |
+
}
|
| 145 |
+
this._hasHandledRequest = true;
|
| 146 |
+
// Validate request headers for DNS rebinding protection
|
| 147 |
+
const validationError = this.validateRequestHeaders(req);
|
| 148 |
+
if (validationError) {
|
| 149 |
+
return validationError;
|
| 150 |
+
}
|
| 151 |
+
switch (req.method) {
|
| 152 |
+
case 'POST':
|
| 153 |
+
return this.handlePostRequest(req, options);
|
| 154 |
+
case 'GET':
|
| 155 |
+
return this.handleGetRequest(req);
|
| 156 |
+
case 'DELETE':
|
| 157 |
+
return this.handleDeleteRequest(req);
|
| 158 |
+
default:
|
| 159 |
+
return this.handleUnsupportedRequest();
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
/**
|
| 163 |
+
* Writes a priming event to establish resumption capability.
|
| 164 |
+
* Only sends if eventStore is configured (opt-in for resumability) and
|
| 165 |
+
* the client's protocol version supports empty SSE data (>= 2025-11-25).
|
| 166 |
+
*/
|
| 167 |
+
async writePrimingEvent(controller, encoder, streamId, protocolVersion) {
|
| 168 |
+
if (!this._eventStore) {
|
| 169 |
+
return;
|
| 170 |
+
}
|
| 171 |
+
// Priming events have empty data which older clients cannot handle.
|
| 172 |
+
// Only send priming events to clients with protocol version >= 2025-11-25
|
| 173 |
+
// which includes the fix for handling empty SSE data.
|
| 174 |
+
if (protocolVersion < '2025-11-25') {
|
| 175 |
+
return;
|
| 176 |
+
}
|
| 177 |
+
const primingEventId = await this._eventStore.storeEvent(streamId, {});
|
| 178 |
+
let primingEvent = `id: ${primingEventId}\ndata: \n\n`;
|
| 179 |
+
if (this._retryInterval !== undefined) {
|
| 180 |
+
primingEvent = `id: ${primingEventId}\nretry: ${this._retryInterval}\ndata: \n\n`;
|
| 181 |
+
}
|
| 182 |
+
controller.enqueue(encoder.encode(primingEvent));
|
| 183 |
+
}
|
| 184 |
+
/**
|
| 185 |
+
* Handles GET requests for SSE stream
|
| 186 |
+
*/
|
| 187 |
+
async handleGetRequest(req) {
|
| 188 |
+
// The client MUST include an Accept header, listing text/event-stream as a supported content type.
|
| 189 |
+
const acceptHeader = req.headers.get('accept');
|
| 190 |
+
if (!acceptHeader?.includes('text/event-stream')) {
|
| 191 |
+
this.onerror?.(new Error('Not Acceptable: Client must accept text/event-stream'));
|
| 192 |
+
return this.createJsonErrorResponse(406, -32000, 'Not Acceptable: Client must accept text/event-stream');
|
| 193 |
+
}
|
| 194 |
+
// If an Mcp-Session-Id is returned by the server during initialization,
|
| 195 |
+
// clients using the Streamable HTTP transport MUST include it
|
| 196 |
+
// in the Mcp-Session-Id header on all of their subsequent HTTP requests.
|
| 197 |
+
const sessionError = this.validateSession(req);
|
| 198 |
+
if (sessionError) {
|
| 199 |
+
return sessionError;
|
| 200 |
+
}
|
| 201 |
+
const protocolError = this.validateProtocolVersion(req);
|
| 202 |
+
if (protocolError) {
|
| 203 |
+
return protocolError;
|
| 204 |
+
}
|
| 205 |
+
// Handle resumability: check for Last-Event-ID header
|
| 206 |
+
if (this._eventStore) {
|
| 207 |
+
const lastEventId = req.headers.get('last-event-id');
|
| 208 |
+
if (lastEventId) {
|
| 209 |
+
return this.replayEvents(lastEventId);
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
// Check if there's already an active standalone SSE stream for this session
|
| 213 |
+
if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) {
|
| 214 |
+
// Only one GET SSE stream is allowed per session
|
| 215 |
+
this.onerror?.(new Error('Conflict: Only one SSE stream is allowed per session'));
|
| 216 |
+
return this.createJsonErrorResponse(409, -32000, 'Conflict: Only one SSE stream is allowed per session');
|
| 217 |
+
}
|
| 218 |
+
const encoder = new TextEncoder();
|
| 219 |
+
let streamController;
|
| 220 |
+
// Create a ReadableStream with a controller we can use to push SSE events
|
| 221 |
+
const readable = new ReadableStream({
|
| 222 |
+
start: controller => {
|
| 223 |
+
streamController = controller;
|
| 224 |
+
},
|
| 225 |
+
cancel: () => {
|
| 226 |
+
// Stream was cancelled by client
|
| 227 |
+
this._streamMapping.delete(this._standaloneSseStreamId);
|
| 228 |
+
}
|
| 229 |
+
});
|
| 230 |
+
const headers = {
|
| 231 |
+
'Content-Type': 'text/event-stream',
|
| 232 |
+
'Cache-Control': 'no-cache, no-transform',
|
| 233 |
+
Connection: 'keep-alive'
|
| 234 |
+
};
|
| 235 |
+
// After initialization, always include the session ID if we have one
|
| 236 |
+
if (this.sessionId !== undefined) {
|
| 237 |
+
headers['mcp-session-id'] = this.sessionId;
|
| 238 |
+
}
|
| 239 |
+
// Store the stream mapping with the controller for pushing data
|
| 240 |
+
this._streamMapping.set(this._standaloneSseStreamId, {
|
| 241 |
+
controller: streamController,
|
| 242 |
+
encoder,
|
| 243 |
+
cleanup: () => {
|
| 244 |
+
this._streamMapping.delete(this._standaloneSseStreamId);
|
| 245 |
+
try {
|
| 246 |
+
streamController.close();
|
| 247 |
+
}
|
| 248 |
+
catch {
|
| 249 |
+
// Controller might already be closed
|
| 250 |
+
}
|
| 251 |
+
}
|
| 252 |
+
});
|
| 253 |
+
return new Response(readable, { headers });
|
| 254 |
+
}
|
| 255 |
+
/**
|
| 256 |
+
* Replays events that would have been sent after the specified event ID
|
| 257 |
+
* Only used when resumability is enabled
|
| 258 |
+
*/
|
| 259 |
+
async replayEvents(lastEventId) {
|
| 260 |
+
if (!this._eventStore) {
|
| 261 |
+
this.onerror?.(new Error('Event store not configured'));
|
| 262 |
+
return this.createJsonErrorResponse(400, -32000, 'Event store not configured');
|
| 263 |
+
}
|
| 264 |
+
try {
|
| 265 |
+
// If getStreamIdForEventId is available, use it for conflict checking
|
| 266 |
+
let streamId;
|
| 267 |
+
if (this._eventStore.getStreamIdForEventId) {
|
| 268 |
+
streamId = await this._eventStore.getStreamIdForEventId(lastEventId);
|
| 269 |
+
if (!streamId) {
|
| 270 |
+
this.onerror?.(new Error('Invalid event ID format'));
|
| 271 |
+
return this.createJsonErrorResponse(400, -32000, 'Invalid event ID format');
|
| 272 |
+
}
|
| 273 |
+
// Check conflict with the SAME streamId we'll use for mapping
|
| 274 |
+
if (this._streamMapping.get(streamId) !== undefined) {
|
| 275 |
+
this.onerror?.(new Error('Conflict: Stream already has an active connection'));
|
| 276 |
+
return this.createJsonErrorResponse(409, -32000, 'Conflict: Stream already has an active connection');
|
| 277 |
+
}
|
| 278 |
+
}
|
| 279 |
+
const headers = {
|
| 280 |
+
'Content-Type': 'text/event-stream',
|
| 281 |
+
'Cache-Control': 'no-cache, no-transform',
|
| 282 |
+
Connection: 'keep-alive'
|
| 283 |
+
};
|
| 284 |
+
if (this.sessionId !== undefined) {
|
| 285 |
+
headers['mcp-session-id'] = this.sessionId;
|
| 286 |
+
}
|
| 287 |
+
// Create a ReadableStream with controller for SSE
|
| 288 |
+
const encoder = new TextEncoder();
|
| 289 |
+
let streamController;
|
| 290 |
+
const readable = new ReadableStream({
|
| 291 |
+
start: controller => {
|
| 292 |
+
streamController = controller;
|
| 293 |
+
},
|
| 294 |
+
cancel: () => {
|
| 295 |
+
// Stream was cancelled by client
|
| 296 |
+
// Cleanup will be handled by the mapping
|
| 297 |
+
}
|
| 298 |
+
});
|
| 299 |
+
// Replay events - returns the streamId for backwards compatibility
|
| 300 |
+
const replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, {
|
| 301 |
+
send: async (eventId, message) => {
|
| 302 |
+
const success = this.writeSSEEvent(streamController, encoder, message, eventId);
|
| 303 |
+
if (!success) {
|
| 304 |
+
this.onerror?.(new Error('Failed replay events'));
|
| 305 |
+
try {
|
| 306 |
+
streamController.close();
|
| 307 |
+
}
|
| 308 |
+
catch {
|
| 309 |
+
// Controller might already be closed
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
}
|
| 313 |
+
});
|
| 314 |
+
this._streamMapping.set(replayedStreamId, {
|
| 315 |
+
controller: streamController,
|
| 316 |
+
encoder,
|
| 317 |
+
cleanup: () => {
|
| 318 |
+
this._streamMapping.delete(replayedStreamId);
|
| 319 |
+
try {
|
| 320 |
+
streamController.close();
|
| 321 |
+
}
|
| 322 |
+
catch {
|
| 323 |
+
// Controller might already be closed
|
| 324 |
+
}
|
| 325 |
+
}
|
| 326 |
+
});
|
| 327 |
+
return new Response(readable, { headers });
|
| 328 |
+
}
|
| 329 |
+
catch (error) {
|
| 330 |
+
this.onerror?.(error);
|
| 331 |
+
return this.createJsonErrorResponse(500, -32000, 'Error replaying events');
|
| 332 |
+
}
|
| 333 |
+
}
|
| 334 |
+
/**
|
| 335 |
+
* Writes an event to an SSE stream via controller with proper formatting
|
| 336 |
+
*/
|
| 337 |
+
writeSSEEvent(controller, encoder, message, eventId) {
|
| 338 |
+
try {
|
| 339 |
+
let eventData = `event: message\n`;
|
| 340 |
+
// Include event ID if provided - this is important for resumability
|
| 341 |
+
if (eventId) {
|
| 342 |
+
eventData += `id: ${eventId}\n`;
|
| 343 |
+
}
|
| 344 |
+
eventData += `data: ${JSON.stringify(message)}\n\n`;
|
| 345 |
+
controller.enqueue(encoder.encode(eventData));
|
| 346 |
+
return true;
|
| 347 |
+
}
|
| 348 |
+
catch (error) {
|
| 349 |
+
this.onerror?.(error);
|
| 350 |
+
return false;
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
/**
|
| 354 |
+
* Handles unsupported requests (PUT, PATCH, etc.)
|
| 355 |
+
*/
|
| 356 |
+
handleUnsupportedRequest() {
|
| 357 |
+
this.onerror?.(new Error('Method not allowed.'));
|
| 358 |
+
return new Response(JSON.stringify({
|
| 359 |
+
jsonrpc: '2.0',
|
| 360 |
+
error: {
|
| 361 |
+
code: -32000,
|
| 362 |
+
message: 'Method not allowed.'
|
| 363 |
+
},
|
| 364 |
+
id: null
|
| 365 |
+
}), {
|
| 366 |
+
status: 405,
|
| 367 |
+
headers: {
|
| 368 |
+
Allow: 'GET, POST, DELETE',
|
| 369 |
+
'Content-Type': 'application/json'
|
| 370 |
+
}
|
| 371 |
+
});
|
| 372 |
+
}
|
| 373 |
+
/**
|
| 374 |
+
* Handles POST requests containing JSON-RPC messages
|
| 375 |
+
*/
|
| 376 |
+
async handlePostRequest(req, options) {
|
| 377 |
+
try {
|
| 378 |
+
// Validate the Accept header
|
| 379 |
+
const acceptHeader = req.headers.get('accept');
|
| 380 |
+
// The client MUST include an Accept header, listing both application/json and text/event-stream as supported content types.
|
| 381 |
+
if (!acceptHeader?.includes('application/json') || !acceptHeader.includes('text/event-stream')) {
|
| 382 |
+
this.onerror?.(new Error('Not Acceptable: Client must accept both application/json and text/event-stream'));
|
| 383 |
+
return this.createJsonErrorResponse(406, -32000, 'Not Acceptable: Client must accept both application/json and text/event-stream');
|
| 384 |
+
}
|
| 385 |
+
const ct = req.headers.get('content-type');
|
| 386 |
+
if (!ct || !ct.includes('application/json')) {
|
| 387 |
+
this.onerror?.(new Error('Unsupported Media Type: Content-Type must be application/json'));
|
| 388 |
+
return this.createJsonErrorResponse(415, -32000, 'Unsupported Media Type: Content-Type must be application/json');
|
| 389 |
+
}
|
| 390 |
+
// Build request info from headers and URL
|
| 391 |
+
const requestInfo = {
|
| 392 |
+
headers: Object.fromEntries(req.headers.entries()),
|
| 393 |
+
url: new URL(req.url)
|
| 394 |
+
};
|
| 395 |
+
let rawMessage;
|
| 396 |
+
if (options?.parsedBody !== undefined) {
|
| 397 |
+
rawMessage = options.parsedBody;
|
| 398 |
+
}
|
| 399 |
+
else {
|
| 400 |
+
try {
|
| 401 |
+
rawMessage = await req.json();
|
| 402 |
+
}
|
| 403 |
+
catch {
|
| 404 |
+
this.onerror?.(new Error('Parse error: Invalid JSON'));
|
| 405 |
+
return this.createJsonErrorResponse(400, -32700, 'Parse error: Invalid JSON');
|
| 406 |
+
}
|
| 407 |
+
}
|
| 408 |
+
let messages;
|
| 409 |
+
// handle batch and single messages
|
| 410 |
+
try {
|
| 411 |
+
if (Array.isArray(rawMessage)) {
|
| 412 |
+
messages = rawMessage.map(msg => types_js_1.JSONRPCMessageSchema.parse(msg));
|
| 413 |
+
}
|
| 414 |
+
else {
|
| 415 |
+
messages = [types_js_1.JSONRPCMessageSchema.parse(rawMessage)];
|
| 416 |
+
}
|
| 417 |
+
}
|
| 418 |
+
catch {
|
| 419 |
+
this.onerror?.(new Error('Parse error: Invalid JSON-RPC message'));
|
| 420 |
+
return this.createJsonErrorResponse(400, -32700, 'Parse error: Invalid JSON-RPC message');
|
| 421 |
+
}
|
| 422 |
+
// Check if this is an initialization request
|
| 423 |
+
// https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle/
|
| 424 |
+
const isInitializationRequest = messages.some(types_js_1.isInitializeRequest);
|
| 425 |
+
if (isInitializationRequest) {
|
| 426 |
+
// If it's a server with session management and the session ID is already set we should reject the request
|
| 427 |
+
// to avoid re-initialization.
|
| 428 |
+
if (this._initialized && this.sessionId !== undefined) {
|
| 429 |
+
this.onerror?.(new Error('Invalid Request: Server already initialized'));
|
| 430 |
+
return this.createJsonErrorResponse(400, -32600, 'Invalid Request: Server already initialized');
|
| 431 |
+
}
|
| 432 |
+
if (messages.length > 1) {
|
| 433 |
+
this.onerror?.(new Error('Invalid Request: Only one initialization request is allowed'));
|
| 434 |
+
return this.createJsonErrorResponse(400, -32600, 'Invalid Request: Only one initialization request is allowed');
|
| 435 |
+
}
|
| 436 |
+
this.sessionId = this.sessionIdGenerator?.();
|
| 437 |
+
this._initialized = true;
|
| 438 |
+
// If we have a session ID and an onsessioninitialized handler, call it immediately
|
| 439 |
+
// This is needed in cases where the server needs to keep track of multiple sessions
|
| 440 |
+
if (this.sessionId && this._onsessioninitialized) {
|
| 441 |
+
await Promise.resolve(this._onsessioninitialized(this.sessionId));
|
| 442 |
+
}
|
| 443 |
+
}
|
| 444 |
+
if (!isInitializationRequest) {
|
| 445 |
+
// If an Mcp-Session-Id is returned by the server during initialization,
|
| 446 |
+
// clients using the Streamable HTTP transport MUST include it
|
| 447 |
+
// in the Mcp-Session-Id header on all of their subsequent HTTP requests.
|
| 448 |
+
const sessionError = this.validateSession(req);
|
| 449 |
+
if (sessionError) {
|
| 450 |
+
return sessionError;
|
| 451 |
+
}
|
| 452 |
+
// Mcp-Protocol-Version header is required for all requests after initialization.
|
| 453 |
+
const protocolError = this.validateProtocolVersion(req);
|
| 454 |
+
if (protocolError) {
|
| 455 |
+
return protocolError;
|
| 456 |
+
}
|
| 457 |
+
}
|
| 458 |
+
// check if it contains requests
|
| 459 |
+
const hasRequests = messages.some(types_js_1.isJSONRPCRequest);
|
| 460 |
+
if (!hasRequests) {
|
| 461 |
+
// if it only contains notifications or responses, return 202
|
| 462 |
+
for (const message of messages) {
|
| 463 |
+
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo });
|
| 464 |
+
}
|
| 465 |
+
return new Response(null, { status: 202 });
|
| 466 |
+
}
|
| 467 |
+
// The default behavior is to use SSE streaming
|
| 468 |
+
// but in some cases server will return JSON responses
|
| 469 |
+
const streamId = crypto.randomUUID();
|
| 470 |
+
// Extract protocol version for priming event decision.
|
| 471 |
+
// For initialize requests, get from request params.
|
| 472 |
+
// For other requests, get from header (already validated).
|
| 473 |
+
const initRequest = messages.find(m => (0, types_js_1.isInitializeRequest)(m));
|
| 474 |
+
const clientProtocolVersion = initRequest
|
| 475 |
+
? initRequest.params.protocolVersion
|
| 476 |
+
: (req.headers.get('mcp-protocol-version') ?? types_js_1.DEFAULT_NEGOTIATED_PROTOCOL_VERSION);
|
| 477 |
+
if (this._enableJsonResponse) {
|
| 478 |
+
// For JSON response mode, return a Promise that resolves when all responses are ready
|
| 479 |
+
return new Promise(resolve => {
|
| 480 |
+
this._streamMapping.set(streamId, {
|
| 481 |
+
resolveJson: resolve,
|
| 482 |
+
cleanup: () => {
|
| 483 |
+
this._streamMapping.delete(streamId);
|
| 484 |
+
}
|
| 485 |
+
});
|
| 486 |
+
for (const message of messages) {
|
| 487 |
+
if ((0, types_js_1.isJSONRPCRequest)(message)) {
|
| 488 |
+
this._requestToStreamMapping.set(message.id, streamId);
|
| 489 |
+
}
|
| 490 |
+
}
|
| 491 |
+
for (const message of messages) {
|
| 492 |
+
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo });
|
| 493 |
+
}
|
| 494 |
+
});
|
| 495 |
+
}
|
| 496 |
+
// SSE streaming mode - use ReadableStream with controller for more reliable data pushing
|
| 497 |
+
const encoder = new TextEncoder();
|
| 498 |
+
let streamController;
|
| 499 |
+
const readable = new ReadableStream({
|
| 500 |
+
start: controller => {
|
| 501 |
+
streamController = controller;
|
| 502 |
+
},
|
| 503 |
+
cancel: () => {
|
| 504 |
+
// Stream was cancelled by client
|
| 505 |
+
this._streamMapping.delete(streamId);
|
| 506 |
+
}
|
| 507 |
+
});
|
| 508 |
+
const headers = {
|
| 509 |
+
'Content-Type': 'text/event-stream',
|
| 510 |
+
'Cache-Control': 'no-cache',
|
| 511 |
+
Connection: 'keep-alive'
|
| 512 |
+
};
|
| 513 |
+
// After initialization, always include the session ID if we have one
|
| 514 |
+
if (this.sessionId !== undefined) {
|
| 515 |
+
headers['mcp-session-id'] = this.sessionId;
|
| 516 |
+
}
|
| 517 |
+
// Store the response for this request to send messages back through this connection
|
| 518 |
+
// We need to track by request ID to maintain the connection
|
| 519 |
+
for (const message of messages) {
|
| 520 |
+
if ((0, types_js_1.isJSONRPCRequest)(message)) {
|
| 521 |
+
this._streamMapping.set(streamId, {
|
| 522 |
+
controller: streamController,
|
| 523 |
+
encoder,
|
| 524 |
+
cleanup: () => {
|
| 525 |
+
this._streamMapping.delete(streamId);
|
| 526 |
+
try {
|
| 527 |
+
streamController.close();
|
| 528 |
+
}
|
| 529 |
+
catch {
|
| 530 |
+
// Controller might already be closed
|
| 531 |
+
}
|
| 532 |
+
}
|
| 533 |
+
});
|
| 534 |
+
this._requestToStreamMapping.set(message.id, streamId);
|
| 535 |
+
}
|
| 536 |
+
}
|
| 537 |
+
// Write priming event if event store is configured (after mapping is set up)
|
| 538 |
+
await this.writePrimingEvent(streamController, encoder, streamId, clientProtocolVersion);
|
| 539 |
+
// handle each message
|
| 540 |
+
for (const message of messages) {
|
| 541 |
+
// Build closeSSEStream callback for requests when eventStore is configured
|
| 542 |
+
// AND client supports resumability (protocol version >= 2025-11-25).
|
| 543 |
+
// Old clients can't resume if the stream is closed early because they
|
| 544 |
+
// didn't receive a priming event with an event ID.
|
| 545 |
+
let closeSSEStream;
|
| 546 |
+
let closeStandaloneSSEStream;
|
| 547 |
+
if ((0, types_js_1.isJSONRPCRequest)(message) && this._eventStore && clientProtocolVersion >= '2025-11-25') {
|
| 548 |
+
closeSSEStream = () => {
|
| 549 |
+
this.closeSSEStream(message.id);
|
| 550 |
+
};
|
| 551 |
+
closeStandaloneSSEStream = () => {
|
| 552 |
+
this.closeStandaloneSSEStream();
|
| 553 |
+
};
|
| 554 |
+
}
|
| 555 |
+
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream });
|
| 556 |
+
}
|
| 557 |
+
// The server SHOULD NOT close the SSE stream before sending all JSON-RPC responses
|
| 558 |
+
// This will be handled by the send() method when responses are ready
|
| 559 |
+
return new Response(readable, { status: 200, headers });
|
| 560 |
+
}
|
| 561 |
+
catch (error) {
|
| 562 |
+
// return JSON-RPC formatted error
|
| 563 |
+
this.onerror?.(error);
|
| 564 |
+
return this.createJsonErrorResponse(400, -32700, 'Parse error', { data: String(error) });
|
| 565 |
+
}
|
| 566 |
+
}
|
| 567 |
+
/**
|
| 568 |
+
* Handles DELETE requests to terminate sessions
|
| 569 |
+
*/
|
| 570 |
+
async handleDeleteRequest(req) {
|
| 571 |
+
const sessionError = this.validateSession(req);
|
| 572 |
+
if (sessionError) {
|
| 573 |
+
return sessionError;
|
| 574 |
+
}
|
| 575 |
+
const protocolError = this.validateProtocolVersion(req);
|
| 576 |
+
if (protocolError) {
|
| 577 |
+
return protocolError;
|
| 578 |
+
}
|
| 579 |
+
await Promise.resolve(this._onsessionclosed?.(this.sessionId));
|
| 580 |
+
await this.close();
|
| 581 |
+
return new Response(null, { status: 200 });
|
| 582 |
+
}
|
| 583 |
+
/**
|
| 584 |
+
* Validates session ID for non-initialization requests.
|
| 585 |
+
* Returns Response error if invalid, undefined otherwise
|
| 586 |
+
*/
|
| 587 |
+
validateSession(req) {
|
| 588 |
+
if (this.sessionIdGenerator === undefined) {
|
| 589 |
+
// If the sessionIdGenerator ID is not set, the session management is disabled
|
| 590 |
+
// and we don't need to validate the session ID
|
| 591 |
+
return undefined;
|
| 592 |
+
}
|
| 593 |
+
if (!this._initialized) {
|
| 594 |
+
// If the server has not been initialized yet, reject all requests
|
| 595 |
+
this.onerror?.(new Error('Bad Request: Server not initialized'));
|
| 596 |
+
return this.createJsonErrorResponse(400, -32000, 'Bad Request: Server not initialized');
|
| 597 |
+
}
|
| 598 |
+
const sessionId = req.headers.get('mcp-session-id');
|
| 599 |
+
if (!sessionId) {
|
| 600 |
+
// Non-initialization requests without a session ID should return 400 Bad Request
|
| 601 |
+
this.onerror?.(new Error('Bad Request: Mcp-Session-Id header is required'));
|
| 602 |
+
return this.createJsonErrorResponse(400, -32000, 'Bad Request: Mcp-Session-Id header is required');
|
| 603 |
+
}
|
| 604 |
+
if (sessionId !== this.sessionId) {
|
| 605 |
+
// Reject requests with invalid session ID with 404 Not Found
|
| 606 |
+
this.onerror?.(new Error('Session not found'));
|
| 607 |
+
return this.createJsonErrorResponse(404, -32001, 'Session not found');
|
| 608 |
+
}
|
| 609 |
+
return undefined;
|
| 610 |
+
}
|
| 611 |
+
/**
|
| 612 |
+
* Validates the MCP-Protocol-Version header on incoming requests.
|
| 613 |
+
*
|
| 614 |
+
* For initialization: Version negotiation handles unknown versions gracefully
|
| 615 |
+
* (server responds with its supported version).
|
| 616 |
+
*
|
| 617 |
+
* For subsequent requests with MCP-Protocol-Version header:
|
| 618 |
+
* - Accept if in supported list
|
| 619 |
+
* - 400 if unsupported
|
| 620 |
+
*
|
| 621 |
+
* For HTTP requests without the MCP-Protocol-Version header:
|
| 622 |
+
* - Accept and default to the version negotiated at initialization
|
| 623 |
+
*/
|
| 624 |
+
validateProtocolVersion(req) {
|
| 625 |
+
const protocolVersion = req.headers.get('mcp-protocol-version');
|
| 626 |
+
if (protocolVersion !== null && !types_js_1.SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) {
|
| 627 |
+
this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${protocolVersion}` +
|
| 628 |
+
` (supported versions: ${types_js_1.SUPPORTED_PROTOCOL_VERSIONS.join(', ')})`));
|
| 629 |
+
return this.createJsonErrorResponse(400, -32000, `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${types_js_1.SUPPORTED_PROTOCOL_VERSIONS.join(', ')})`);
|
| 630 |
+
}
|
| 631 |
+
return undefined;
|
| 632 |
+
}
|
| 633 |
+
async close() {
|
| 634 |
+
// Close all SSE connections
|
| 635 |
+
this._streamMapping.forEach(({ cleanup }) => {
|
| 636 |
+
cleanup();
|
| 637 |
+
});
|
| 638 |
+
this._streamMapping.clear();
|
| 639 |
+
// Clear any pending responses
|
| 640 |
+
this._requestResponseMap.clear();
|
| 641 |
+
this.onclose?.();
|
| 642 |
+
}
|
| 643 |
+
/**
|
| 644 |
+
* Close an SSE stream for a specific request, triggering client reconnection.
|
| 645 |
+
* Use this to implement polling behavior during long-running operations -
|
| 646 |
+
* client will reconnect after the retry interval specified in the priming event.
|
| 647 |
+
*/
|
| 648 |
+
closeSSEStream(requestId) {
|
| 649 |
+
const streamId = this._requestToStreamMapping.get(requestId);
|
| 650 |
+
if (!streamId)
|
| 651 |
+
return;
|
| 652 |
+
const stream = this._streamMapping.get(streamId);
|
| 653 |
+
if (stream) {
|
| 654 |
+
stream.cleanup();
|
| 655 |
+
}
|
| 656 |
+
}
|
| 657 |
+
/**
|
| 658 |
+
* Close the standalone GET SSE stream, triggering client reconnection.
|
| 659 |
+
* Use this to implement polling behavior for server-initiated notifications.
|
| 660 |
+
*/
|
| 661 |
+
closeStandaloneSSEStream() {
|
| 662 |
+
const stream = this._streamMapping.get(this._standaloneSseStreamId);
|
| 663 |
+
if (stream) {
|
| 664 |
+
stream.cleanup();
|
| 665 |
+
}
|
| 666 |
+
}
|
| 667 |
+
async send(message, options) {
|
| 668 |
+
let requestId = options?.relatedRequestId;
|
| 669 |
+
if ((0, types_js_1.isJSONRPCResultResponse)(message) || (0, types_js_1.isJSONRPCErrorResponse)(message)) {
|
| 670 |
+
// If the message is a response, use the request ID from the message
|
| 671 |
+
requestId = message.id;
|
| 672 |
+
}
|
| 673 |
+
// Check if this message should be sent on the standalone SSE stream (no request ID)
|
| 674 |
+
// Ignore notifications from tools (which have relatedRequestId set)
|
| 675 |
+
// Those will be sent via dedicated response SSE streams
|
| 676 |
+
if (requestId === undefined) {
|
| 677 |
+
// For standalone SSE streams, we can only send requests and notifications
|
| 678 |
+
if ((0, types_js_1.isJSONRPCResultResponse)(message) || (0, types_js_1.isJSONRPCErrorResponse)(message)) {
|
| 679 |
+
throw new Error('Cannot send a response on a standalone SSE stream unless resuming a previous client request');
|
| 680 |
+
}
|
| 681 |
+
// Generate and store event ID if event store is provided
|
| 682 |
+
// Store even if stream is disconnected so events can be replayed on reconnect
|
| 683 |
+
let eventId;
|
| 684 |
+
if (this._eventStore) {
|
| 685 |
+
// Stores the event and gets the generated event ID
|
| 686 |
+
eventId = await this._eventStore.storeEvent(this._standaloneSseStreamId, message);
|
| 687 |
+
}
|
| 688 |
+
const standaloneSse = this._streamMapping.get(this._standaloneSseStreamId);
|
| 689 |
+
if (standaloneSse === undefined) {
|
| 690 |
+
// Stream is disconnected - event is stored for replay, nothing more to do
|
| 691 |
+
return;
|
| 692 |
+
}
|
| 693 |
+
// Send the message to the standalone SSE stream
|
| 694 |
+
if (standaloneSse.controller && standaloneSse.encoder) {
|
| 695 |
+
this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId);
|
| 696 |
+
}
|
| 697 |
+
return;
|
| 698 |
+
}
|
| 699 |
+
// Get the response for this request
|
| 700 |
+
const streamId = this._requestToStreamMapping.get(requestId);
|
| 701 |
+
if (!streamId) {
|
| 702 |
+
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
| 703 |
+
}
|
| 704 |
+
const stream = this._streamMapping.get(streamId);
|
| 705 |
+
if (!this._enableJsonResponse && stream?.controller && stream?.encoder) {
|
| 706 |
+
// For SSE responses, generate event ID if event store is provided
|
| 707 |
+
let eventId;
|
| 708 |
+
if (this._eventStore) {
|
| 709 |
+
eventId = await this._eventStore.storeEvent(streamId, message);
|
| 710 |
+
}
|
| 711 |
+
// Write the event to the response stream
|
| 712 |
+
this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
| 713 |
+
}
|
| 714 |
+
if ((0, types_js_1.isJSONRPCResultResponse)(message) || (0, types_js_1.isJSONRPCErrorResponse)(message)) {
|
| 715 |
+
this._requestResponseMap.set(requestId, message);
|
| 716 |
+
const relatedIds = Array.from(this._requestToStreamMapping.entries())
|
| 717 |
+
.filter(([_, sid]) => sid === streamId)
|
| 718 |
+
.map(([id]) => id);
|
| 719 |
+
// Check if we have responses for all requests using this connection
|
| 720 |
+
const allResponsesReady = relatedIds.every(id => this._requestResponseMap.has(id));
|
| 721 |
+
if (allResponsesReady) {
|
| 722 |
+
if (!stream) {
|
| 723 |
+
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
| 724 |
+
}
|
| 725 |
+
if (this._enableJsonResponse && stream.resolveJson) {
|
| 726 |
+
// All responses ready, send as JSON
|
| 727 |
+
const headers = {
|
| 728 |
+
'Content-Type': 'application/json'
|
| 729 |
+
};
|
| 730 |
+
if (this.sessionId !== undefined) {
|
| 731 |
+
headers['mcp-session-id'] = this.sessionId;
|
| 732 |
+
}
|
| 733 |
+
const responses = relatedIds.map(id => this._requestResponseMap.get(id));
|
| 734 |
+
if (responses.length === 1) {
|
| 735 |
+
stream.resolveJson(new Response(JSON.stringify(responses[0]), { status: 200, headers }));
|
| 736 |
+
}
|
| 737 |
+
else {
|
| 738 |
+
stream.resolveJson(new Response(JSON.stringify(responses), { status: 200, headers }));
|
| 739 |
+
}
|
| 740 |
+
}
|
| 741 |
+
else {
|
| 742 |
+
// End the SSE stream
|
| 743 |
+
stream.cleanup();
|
| 744 |
+
}
|
| 745 |
+
// Clean up
|
| 746 |
+
for (const id of relatedIds) {
|
| 747 |
+
this._requestResponseMap.delete(id);
|
| 748 |
+
this._requestToStreamMapping.delete(id);
|
| 749 |
+
}
|
| 750 |
+
}
|
| 751 |
+
}
|
| 752 |
+
}
|
| 753 |
+
}
|
| 754 |
+
exports.WebStandardStreamableHTTPServerTransport = WebStandardStreamableHTTPServerTransport;
|
| 755 |
+
//# sourceMappingURL=webStandardStreamableHttp.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"webStandardStreamableHttp.js","sourceRoot":"","sources":["../../../src/server/webStandardStreamableHttp.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAIH,0CAYqB;AA8IrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAa,wCAAwC;IAwBjD,YAAY,UAA2D,EAAE;QArBjE,aAAQ,GAAY,KAAK,CAAC;QAC1B,uBAAkB,GAAY,KAAK,CAAC;QACpC,mBAAc,GAA+B,IAAI,GAAG,EAAE,CAAC;QACvD,4BAAuB,GAA2B,IAAI,GAAG,EAAE,CAAC;QAC5D,wBAAmB,GAAmC,IAAI,GAAG,EAAE,CAAC;QAChE,iBAAY,GAAY,KAAK,CAAC;QAC9B,wBAAmB,GAAY,KAAK,CAAC;QACrC,2BAAsB,GAAW,aAAa,CAAC;QAenD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,IAAI,KAAK,CAAC;QAC/D,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QAC1D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;QAChD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG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z4 from 'zod/v4/core';
|
| 3 |
+
export type AnySchema = z3.ZodTypeAny | z4.$ZodType;
|
| 4 |
+
export type AnyObjectSchema = z3.AnyZodObject | z4.$ZodObject | AnySchema;
|
| 5 |
+
export type ZodRawShapeCompat = Record<string, AnySchema>;
|
| 6 |
+
export interface ZodV3Internal {
|
| 7 |
+
_def?: {
|
| 8 |
+
typeName?: string;
|
| 9 |
+
value?: unknown;
|
| 10 |
+
values?: unknown[];
|
| 11 |
+
shape?: Record<string, AnySchema> | (() => Record<string, AnySchema>);
|
| 12 |
+
description?: string;
|
| 13 |
+
};
|
| 14 |
+
shape?: Record<string, AnySchema> | (() => Record<string, AnySchema>);
|
| 15 |
+
value?: unknown;
|
| 16 |
+
}
|
| 17 |
+
export interface ZodV4Internal {
|
| 18 |
+
_zod?: {
|
| 19 |
+
def?: {
|
| 20 |
+
type?: string;
|
| 21 |
+
value?: unknown;
|
| 22 |
+
values?: unknown[];
|
| 23 |
+
shape?: Record<string, AnySchema> | (() => Record<string, AnySchema>);
|
| 24 |
+
};
|
| 25 |
+
};
|
| 26 |
+
value?: unknown;
|
| 27 |
+
}
|
| 28 |
+
export type SchemaOutput<S> = S extends z3.ZodTypeAny ? z3.infer<S> : S extends z4.$ZodType ? z4.output<S> : never;
|
| 29 |
+
export type SchemaInput<S> = S extends z3.ZodTypeAny ? z3.input<S> : S extends z4.$ZodType ? z4.input<S> : never;
|
| 30 |
+
/**
|
| 31 |
+
* Infers the output type from a ZodRawShapeCompat (raw shape object).
|
| 32 |
+
* Maps over each key in the shape and infers the output type from each schema.
|
| 33 |
+
*/
|
| 34 |
+
export type ShapeOutput<Shape extends ZodRawShapeCompat> = {
|
| 35 |
+
[K in keyof Shape]: SchemaOutput<Shape[K]>;
|
| 36 |
+
};
|
| 37 |
+
export declare function isZ4Schema(s: AnySchema): s is z4.$ZodType;
|
| 38 |
+
export declare function objectFromShape(shape: ZodRawShapeCompat): AnyObjectSchema;
|
| 39 |
+
export declare function safeParse<S extends AnySchema>(schema: S, data: unknown): {
|
| 40 |
+
success: true;
|
| 41 |
+
data: SchemaOutput<S>;
|
| 42 |
+
} | {
|
| 43 |
+
success: false;
|
| 44 |
+
error: unknown;
|
| 45 |
+
};
|
| 46 |
+
export declare function safeParseAsync<S extends AnySchema>(schema: S, data: unknown): Promise<{
|
| 47 |
+
success: true;
|
| 48 |
+
data: SchemaOutput<S>;
|
| 49 |
+
} | {
|
| 50 |
+
success: false;
|
| 51 |
+
error: unknown;
|
| 52 |
+
}>;
|
| 53 |
+
export declare function getObjectShape(schema: AnyObjectSchema | undefined): Record<string, AnySchema> | undefined;
|
| 54 |
+
/**
|
| 55 |
+
* Normalizes a schema to an object schema. Handles both:
|
| 56 |
+
* - Already-constructed object schemas (v3 or v4)
|
| 57 |
+
* - Raw shapes that need to be wrapped into object schemas
|
| 58 |
+
*/
|
| 59 |
+
export declare function normalizeObjectSchema(schema: AnySchema | ZodRawShapeCompat | undefined): AnyObjectSchema | undefined;
|
| 60 |
+
/**
|
| 61 |
+
* Safely extracts an error message from a parse result error.
|
| 62 |
+
* Zod errors can have different structures, so we handle various cases.
|
| 63 |
+
*/
|
| 64 |
+
export declare function getParseErrorMessage(error: unknown): string;
|
| 65 |
+
/**
|
| 66 |
+
* Gets the description from a schema, if available.
|
| 67 |
+
* Works with both Zod v3 and v4.
|
| 68 |
+
*
|
| 69 |
+
* Both versions expose a `.description` getter that returns the description
|
| 70 |
+
* from their respective internal storage (v3: _def, v4: globalRegistry).
|
| 71 |
+
*/
|
| 72 |
+
export declare function getSchemaDescription(schema: AnySchema): string | undefined;
|
| 73 |
+
/**
|
| 74 |
+
* Checks if a schema is optional.
|
| 75 |
+
* Works with both Zod v3 and v4.
|
| 76 |
+
*/
|
| 77 |
+
export declare function isSchemaOptional(schema: AnySchema): boolean;
|
| 78 |
+
/**
|
| 79 |
+
* Gets the literal value from a schema, if it's a literal schema.
|
| 80 |
+
* Works with both Zod v3 and v4.
|
| 81 |
+
* Returns undefined if the schema is not a literal or the value cannot be determined.
|
| 82 |
+
*/
|
| 83 |
+
export declare function getLiteralValue(schema: AnySchema): unknown;
|
| 84 |
+
//# sourceMappingURL=zod-compat.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"zod-compat.d.ts","sourceRoot":"","sources":["../../../src/server/zod-compat.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAMvC,MAAM,MAAM,SAAS,GAAG,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,QAAQ,CAAC;AACpD,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAI1D,MAAM,WAAW,aAAa;IAC1B,IAAI,CAAC,EAAE;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;QACtE,WAAW,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,CAAC,EAAE;QACH,GAAG,CAAC,EAA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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
// zod-compat.ts
|
| 3 |
+
// ----------------------------------------------------
|
| 4 |
+
// Unified types + helpers to accept Zod v3 and v4 (Mini)
|
| 5 |
+
// ----------------------------------------------------
|
| 6 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
| 7 |
+
if (k2 === undefined) k2 = k;
|
| 8 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
| 9 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
| 10 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
| 11 |
+
}
|
| 12 |
+
Object.defineProperty(o, k2, desc);
|
| 13 |
+
}) : (function(o, m, k, k2) {
|
| 14 |
+
if (k2 === undefined) k2 = k;
|
| 15 |
+
o[k2] = m[k];
|
| 16 |
+
}));
|
| 17 |
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
| 18 |
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
| 19 |
+
}) : function(o, v) {
|
| 20 |
+
o["default"] = v;
|
| 21 |
+
});
|
| 22 |
+
var __importStar = (this && this.__importStar) || function (mod) {
|
| 23 |
+
if (mod && mod.__esModule) return mod;
|
| 24 |
+
var result = {};
|
| 25 |
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
| 26 |
+
__setModuleDefault(result, mod);
|
| 27 |
+
return result;
|
| 28 |
+
};
|
| 29 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 30 |
+
exports.isZ4Schema = isZ4Schema;
|
| 31 |
+
exports.objectFromShape = objectFromShape;
|
| 32 |
+
exports.safeParse = safeParse;
|
| 33 |
+
exports.safeParseAsync = safeParseAsync;
|
| 34 |
+
exports.getObjectShape = getObjectShape;
|
| 35 |
+
exports.normalizeObjectSchema = normalizeObjectSchema;
|
| 36 |
+
exports.getParseErrorMessage = getParseErrorMessage;
|
| 37 |
+
exports.getSchemaDescription = getSchemaDescription;
|
| 38 |
+
exports.isSchemaOptional = isSchemaOptional;
|
| 39 |
+
exports.getLiteralValue = getLiteralValue;
|
| 40 |
+
const z3rt = __importStar(require("zod/v3"));
|
| 41 |
+
const z4mini = __importStar(require("zod/v4-mini"));
|
| 42 |
+
// --- Runtime detection ---
|
| 43 |
+
function isZ4Schema(s) {
|
| 44 |
+
// Present on Zod 4 (Classic & Mini) schemas; absent on Zod 3
|
| 45 |
+
const schema = s;
|
| 46 |
+
return !!schema._zod;
|
| 47 |
+
}
|
| 48 |
+
// --- Schema construction ---
|
| 49 |
+
function objectFromShape(shape) {
|
| 50 |
+
const values = Object.values(shape);
|
| 51 |
+
if (values.length === 0)
|
| 52 |
+
return z4mini.object({}); // default to v4 Mini
|
| 53 |
+
const allV4 = values.every(isZ4Schema);
|
| 54 |
+
const allV3 = values.every(s => !isZ4Schema(s));
|
| 55 |
+
if (allV4)
|
| 56 |
+
return z4mini.object(shape);
|
| 57 |
+
if (allV3)
|
| 58 |
+
return z3rt.object(shape);
|
| 59 |
+
throw new Error('Mixed Zod versions detected in object shape.');
|
| 60 |
+
}
|
| 61 |
+
// --- Unified parsing ---
|
| 62 |
+
function safeParse(schema, data) {
|
| 63 |
+
if (isZ4Schema(schema)) {
|
| 64 |
+
// Mini exposes top-level safeParse
|
| 65 |
+
const result = z4mini.safeParse(schema, data);
|
| 66 |
+
return result;
|
| 67 |
+
}
|
| 68 |
+
const v3Schema = schema;
|
| 69 |
+
const result = v3Schema.safeParse(data);
|
| 70 |
+
return result;
|
| 71 |
+
}
|
| 72 |
+
async function safeParseAsync(schema, data) {
|
| 73 |
+
if (isZ4Schema(schema)) {
|
| 74 |
+
// Mini exposes top-level safeParseAsync
|
| 75 |
+
const result = await z4mini.safeParseAsync(schema, data);
|
| 76 |
+
return result;
|
| 77 |
+
}
|
| 78 |
+
const v3Schema = schema;
|
| 79 |
+
const result = await v3Schema.safeParseAsync(data);
|
| 80 |
+
return result;
|
| 81 |
+
}
|
| 82 |
+
// --- Shape extraction ---
|
| 83 |
+
function getObjectShape(schema) {
|
| 84 |
+
if (!schema)
|
| 85 |
+
return undefined;
|
| 86 |
+
// Zod v3 exposes `.shape`; Zod v4 keeps the shape on `_zod.def.shape`
|
| 87 |
+
let rawShape;
|
| 88 |
+
if (isZ4Schema(schema)) {
|
| 89 |
+
const v4Schema = schema;
|
| 90 |
+
rawShape = v4Schema._zod?.def?.shape;
|
| 91 |
+
}
|
| 92 |
+
else {
|
| 93 |
+
const v3Schema = schema;
|
| 94 |
+
rawShape = v3Schema.shape;
|
| 95 |
+
}
|
| 96 |
+
if (!rawShape)
|
| 97 |
+
return undefined;
|
| 98 |
+
if (typeof rawShape === 'function') {
|
| 99 |
+
try {
|
| 100 |
+
return rawShape();
|
| 101 |
+
}
|
| 102 |
+
catch {
|
| 103 |
+
return undefined;
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
return rawShape;
|
| 107 |
+
}
|
| 108 |
+
// --- Schema normalization ---
|
| 109 |
+
/**
|
| 110 |
+
* Normalizes a schema to an object schema. Handles both:
|
| 111 |
+
* - Already-constructed object schemas (v3 or v4)
|
| 112 |
+
* - Raw shapes that need to be wrapped into object schemas
|
| 113 |
+
*/
|
| 114 |
+
function normalizeObjectSchema(schema) {
|
| 115 |
+
if (!schema)
|
| 116 |
+
return undefined;
|
| 117 |
+
// First check if it's a raw shape (Record<string, AnySchema>)
|
| 118 |
+
// Raw shapes don't have _def or _zod properties and aren't schemas themselves
|
| 119 |
+
if (typeof schema === 'object') {
|
| 120 |
+
// Check if it's actually a ZodRawShapeCompat (not a schema instance)
|
| 121 |
+
// by checking if it lacks schema-like internal properties
|
| 122 |
+
const asV3 = schema;
|
| 123 |
+
const asV4 = schema;
|
| 124 |
+
// If it's not a schema instance (no _def or _zod), it might be a raw shape
|
| 125 |
+
if (!asV3._def && !asV4._zod) {
|
| 126 |
+
// Check if all values are schemas (heuristic to confirm it's a raw shape)
|
| 127 |
+
const values = Object.values(schema);
|
| 128 |
+
if (values.length > 0 &&
|
| 129 |
+
values.every(v => typeof v === 'object' &&
|
| 130 |
+
v !== null &&
|
| 131 |
+
(v._def !== undefined ||
|
| 132 |
+
v._zod !== undefined ||
|
| 133 |
+
typeof v.parse === 'function'))) {
|
| 134 |
+
return objectFromShape(schema);
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
// If we get here, it should be an AnySchema (not a raw shape)
|
| 139 |
+
// Check if it's already an object schema
|
| 140 |
+
if (isZ4Schema(schema)) {
|
| 141 |
+
// Check if it's a v4 object
|
| 142 |
+
const v4Schema = schema;
|
| 143 |
+
const def = v4Schema._zod?.def;
|
| 144 |
+
if (def && (def.type === 'object' || def.shape !== undefined)) {
|
| 145 |
+
return schema;
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
else {
|
| 149 |
+
// Check if it's a v3 object
|
| 150 |
+
const v3Schema = schema;
|
| 151 |
+
if (v3Schema.shape !== undefined) {
|
| 152 |
+
return schema;
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
return undefined;
|
| 156 |
+
}
|
| 157 |
+
// --- Error message extraction ---
|
| 158 |
+
/**
|
| 159 |
+
* Safely extracts an error message from a parse result error.
|
| 160 |
+
* Zod errors can have different structures, so we handle various cases.
|
| 161 |
+
*/
|
| 162 |
+
function getParseErrorMessage(error) {
|
| 163 |
+
if (error && typeof error === 'object') {
|
| 164 |
+
// Try common error structures
|
| 165 |
+
if ('message' in error && typeof error.message === 'string') {
|
| 166 |
+
return error.message;
|
| 167 |
+
}
|
| 168 |
+
if ('issues' in error && Array.isArray(error.issues) && error.issues.length > 0) {
|
| 169 |
+
const firstIssue = error.issues[0];
|
| 170 |
+
if (firstIssue && typeof firstIssue === 'object' && 'message' in firstIssue) {
|
| 171 |
+
return String(firstIssue.message);
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
// Fallback: try to stringify the error
|
| 175 |
+
try {
|
| 176 |
+
return JSON.stringify(error);
|
| 177 |
+
}
|
| 178 |
+
catch {
|
| 179 |
+
return String(error);
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
return String(error);
|
| 183 |
+
}
|
| 184 |
+
// --- Schema metadata access ---
|
| 185 |
+
/**
|
| 186 |
+
* Gets the description from a schema, if available.
|
| 187 |
+
* Works with both Zod v3 and v4.
|
| 188 |
+
*
|
| 189 |
+
* Both versions expose a `.description` getter that returns the description
|
| 190 |
+
* from their respective internal storage (v3: _def, v4: globalRegistry).
|
| 191 |
+
*/
|
| 192 |
+
function getSchemaDescription(schema) {
|
| 193 |
+
return schema.description;
|
| 194 |
+
}
|
| 195 |
+
/**
|
| 196 |
+
* Checks if a schema is optional.
|
| 197 |
+
* Works with both Zod v3 and v4.
|
| 198 |
+
*/
|
| 199 |
+
function isSchemaOptional(schema) {
|
| 200 |
+
if (isZ4Schema(schema)) {
|
| 201 |
+
const v4Schema = schema;
|
| 202 |
+
return v4Schema._zod?.def?.type === 'optional';
|
| 203 |
+
}
|
| 204 |
+
const v3Schema = schema;
|
| 205 |
+
// v3 has isOptional() method
|
| 206 |
+
if (typeof schema.isOptional === 'function') {
|
| 207 |
+
return schema.isOptional();
|
| 208 |
+
}
|
| 209 |
+
return v3Schema._def?.typeName === 'ZodOptional';
|
| 210 |
+
}
|
| 211 |
+
/**
|
| 212 |
+
* Gets the literal value from a schema, if it's a literal schema.
|
| 213 |
+
* Works with both Zod v3 and v4.
|
| 214 |
+
* Returns undefined if the schema is not a literal or the value cannot be determined.
|
| 215 |
+
*/
|
| 216 |
+
function getLiteralValue(schema) {
|
| 217 |
+
if (isZ4Schema(schema)) {
|
| 218 |
+
const v4Schema = schema;
|
| 219 |
+
const def = v4Schema._zod?.def;
|
| 220 |
+
if (def) {
|
| 221 |
+
// Try various ways to get the literal value
|
| 222 |
+
if (def.value !== undefined)
|
| 223 |
+
return def.value;
|
| 224 |
+
if (Array.isArray(def.values) && def.values.length > 0) {
|
| 225 |
+
return def.values[0];
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
const v3Schema = schema;
|
| 230 |
+
const def = v3Schema._def;
|
| 231 |
+
if (def) {
|
| 232 |
+
if (def.value !== undefined)
|
| 233 |
+
return def.value;
|
| 234 |
+
if (Array.isArray(def.values) && def.values.length > 0) {
|
| 235 |
+
return def.values[0];
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
// Fallback: check for direct value property (some Zod versions)
|
| 239 |
+
const directValue = schema.value;
|
| 240 |
+
if (directValue !== undefined)
|
| 241 |
+
return directValue;
|
| 242 |
+
return undefined;
|
| 243 |
+
}
|
| 244 |
+
//# sourceMappingURL=zod-compat.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"zod-compat.js","sourceRoot":"","sources":["../../../src/server/zod-compat.ts"],"names":[],"mappings":";AAAA,gBAAgB;AAChB,uDAAuD;AACvD,yDAAyD;AACzD,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;AAqDvD,gCAIC;AAGD,0CAWC;AAGD,8BAYC;AAED,wCAYC;AAGD,wCAyBC;AAQD,sDAiDC;AAOD,oDAoBC;AAUD,oDAEC;AAMD,4CAWC;AAOD,0CAwBC;AA3QD,6CAA+B;AAC/B,oDAAsC;AA8CtC,4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
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { AnySchema, AnyObjectSchema } from './zod-compat.js';
|
| 2 |
+
type JsonSchema = Record<string, unknown>;
|
| 3 |
+
type CommonOpts = {
|
| 4 |
+
strictUnions?: boolean;
|
| 5 |
+
pipeStrategy?: 'input' | 'output';
|
| 6 |
+
target?: 'jsonSchema7' | 'draft-7' | 'jsonSchema2019-09' | 'draft-2020-12';
|
| 7 |
+
};
|
| 8 |
+
export declare function toJsonSchemaCompat(schema: AnyObjectSchema, opts?: CommonOpts): JsonSchema;
|
| 9 |
+
export declare function getMethodLiteral(schema: AnyObjectSchema): string;
|
| 10 |
+
export declare function parseWithCompat(schema: AnySchema, data: unknown): unknown;
|
| 11 |
+
export {};
|
| 12 |
+
//# sourceMappingURL=zod-json-schema-compat.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"zod-json-schema-compat.d.ts","sourceRoot":"","sources":["../../../src/server/zod-json-schema-compat.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,eAAe,EAA0D,MAAM,iBAAiB,CAAC;AAGrH,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAG1C,KAAK,UAAU,GAAG;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,MAAM,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,mBAAmB,GAAG,eAAe,CAAC;CAC9E,CAAC;AASF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAczF;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAahE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAMzE"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
// zod-json-schema-compat.ts
|
| 3 |
+
// ----------------------------------------------------
|
| 4 |
+
// JSON Schema conversion for both Zod v3 and Zod v4 (Mini)
|
| 5 |
+
// v3 uses your vendored converter; v4 uses Mini's toJSONSchema
|
| 6 |
+
// ----------------------------------------------------
|
| 7 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
| 8 |
+
if (k2 === undefined) k2 = k;
|
| 9 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
| 10 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
| 11 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
| 12 |
+
}
|
| 13 |
+
Object.defineProperty(o, k2, desc);
|
| 14 |
+
}) : (function(o, m, k, k2) {
|
| 15 |
+
if (k2 === undefined) k2 = k;
|
| 16 |
+
o[k2] = m[k];
|
| 17 |
+
}));
|
| 18 |
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
| 19 |
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
| 20 |
+
}) : function(o, v) {
|
| 21 |
+
o["default"] = v;
|
| 22 |
+
});
|
| 23 |
+
var __importStar = (this && this.__importStar) || function (mod) {
|
| 24 |
+
if (mod && mod.__esModule) return mod;
|
| 25 |
+
var result = {};
|
| 26 |
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
| 27 |
+
__setModuleDefault(result, mod);
|
| 28 |
+
return result;
|
| 29 |
+
};
|
| 30 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 31 |
+
exports.toJsonSchemaCompat = toJsonSchemaCompat;
|
| 32 |
+
exports.getMethodLiteral = getMethodLiteral;
|
| 33 |
+
exports.parseWithCompat = parseWithCompat;
|
| 34 |
+
const z4mini = __importStar(require("zod/v4-mini"));
|
| 35 |
+
const zod_compat_js_1 = require("./zod-compat.js");
|
| 36 |
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
| 37 |
+
function mapMiniTarget(t) {
|
| 38 |
+
if (!t)
|
| 39 |
+
return 'draft-7';
|
| 40 |
+
if (t === 'jsonSchema7' || t === 'draft-7')
|
| 41 |
+
return 'draft-7';
|
| 42 |
+
if (t === 'jsonSchema2019-09' || t === 'draft-2020-12')
|
| 43 |
+
return 'draft-2020-12';
|
| 44 |
+
return 'draft-7'; // fallback
|
| 45 |
+
}
|
| 46 |
+
function toJsonSchemaCompat(schema, opts) {
|
| 47 |
+
if ((0, zod_compat_js_1.isZ4Schema)(schema)) {
|
| 48 |
+
// v4 branch — use Mini's built-in toJSONSchema
|
| 49 |
+
return z4mini.toJSONSchema(schema, {
|
| 50 |
+
target: mapMiniTarget(opts?.target),
|
| 51 |
+
io: opts?.pipeStrategy ?? 'input'
|
| 52 |
+
});
|
| 53 |
+
}
|
| 54 |
+
// v3 branch — use vendored converter
|
| 55 |
+
return (0, zod_to_json_schema_1.zodToJsonSchema)(schema, {
|
| 56 |
+
strictUnions: opts?.strictUnions ?? true,
|
| 57 |
+
pipeStrategy: opts?.pipeStrategy ?? 'input'
|
| 58 |
+
});
|
| 59 |
+
}
|
| 60 |
+
function getMethodLiteral(schema) {
|
| 61 |
+
const shape = (0, zod_compat_js_1.getObjectShape)(schema);
|
| 62 |
+
const methodSchema = shape?.method;
|
| 63 |
+
if (!methodSchema) {
|
| 64 |
+
throw new Error('Schema is missing a method literal');
|
| 65 |
+
}
|
| 66 |
+
const value = (0, zod_compat_js_1.getLiteralValue)(methodSchema);
|
| 67 |
+
if (typeof value !== 'string') {
|
| 68 |
+
throw new Error('Schema method literal must be a string');
|
| 69 |
+
}
|
| 70 |
+
return value;
|
| 71 |
+
}
|
| 72 |
+
function parseWithCompat(schema, data) {
|
| 73 |
+
const result = (0, zod_compat_js_1.safeParse)(schema, data);
|
| 74 |
+
if (!result.success) {
|
| 75 |
+
throw result.error;
|
| 76 |
+
}
|
| 77 |
+
return result.data;
|
| 78 |
+
}
|
| 79 |
+
//# sourceMappingURL=zod-json-schema-compat.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"zod-json-schema-compat.js","sourceRoot":"","sources":["../../../src/server/zod-json-schema-compat.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,uDAAuD;AACv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,CAAC;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAgB,eAAe,CAAC,MAAiB,EAAE,IAAa;IAC5D,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC,KAAK,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACvB,CAAC"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth-utils.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Utilities for handling OAuth resource URIs.
|
| 3 |
+
*/
|
| 4 |
+
/**
|
| 5 |
+
* Converts a server URL to a resource URL by removing the fragment.
|
| 6 |
+
* RFC 8707 section 2 states that resource URIs "MUST NOT include a fragment component".
|
| 7 |
+
* Keeps everything else unchanged (scheme, domain, port, path, query).
|
| 8 |
+
*/
|
| 9 |
+
export declare function resourceUrlFromServerUrl(url: URL | string): URL;
|
| 10 |
+
/**
|
| 11 |
+
* Checks if a requested resource URL matches a configured resource URL.
|
| 12 |
+
* A requested resource matches if it has the same scheme, domain, port,
|
| 13 |
+
* and its path starts with the configured resource's path.
|
| 14 |
+
*
|
| 15 |
+
* @param requestedResource The resource URL being requested
|
| 16 |
+
* @param configuredResource The resource URL that has been configured
|
| 17 |
+
* @returns true if the requested resource matches the configured resource, false otherwise
|
| 18 |
+
*/
|
| 19 |
+
export declare function checkResourceAllowed({ requestedResource, configuredResource }: {
|
| 20 |
+
requestedResource: URL | string;
|
| 21 |
+
configuredResource: URL | string;
|
| 22 |
+
}): boolean;
|
| 23 |
+
//# sourceMappingURL=auth-utils.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth-utils.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"auth-utils.d.ts","sourceRoot":"","sources":["../../../src/shared/auth-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,CAI/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EACjC,iBAAiB,EACjB,kBAAkB,EACrB,EAAE;IACC,iBAAiB,EAAE,GAAG,GAAG,MAAM,CAAC;IAChC,kBAAkB,EAAE,GAAG,GAAG,MAAM,CAAC;CACpC,GAAG,OAAO,CAwBV"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth-utils.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
/**
|
| 3 |
+
* Utilities for handling OAuth resource URIs.
|
| 4 |
+
*/
|
| 5 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 6 |
+
exports.resourceUrlFromServerUrl = resourceUrlFromServerUrl;
|
| 7 |
+
exports.checkResourceAllowed = checkResourceAllowed;
|
| 8 |
+
/**
|
| 9 |
+
* Converts a server URL to a resource URL by removing the fragment.
|
| 10 |
+
* RFC 8707 section 2 states that resource URIs "MUST NOT include a fragment component".
|
| 11 |
+
* Keeps everything else unchanged (scheme, domain, port, path, query).
|
| 12 |
+
*/
|
| 13 |
+
function resourceUrlFromServerUrl(url) {
|
| 14 |
+
const resourceURL = typeof url === 'string' ? new URL(url) : new URL(url.href);
|
| 15 |
+
resourceURL.hash = ''; // Remove fragment
|
| 16 |
+
return resourceURL;
|
| 17 |
+
}
|
| 18 |
+
/**
|
| 19 |
+
* Checks if a requested resource URL matches a configured resource URL.
|
| 20 |
+
* A requested resource matches if it has the same scheme, domain, port,
|
| 21 |
+
* and its path starts with the configured resource's path.
|
| 22 |
+
*
|
| 23 |
+
* @param requestedResource The resource URL being requested
|
| 24 |
+
* @param configuredResource The resource URL that has been configured
|
| 25 |
+
* @returns true if the requested resource matches the configured resource, false otherwise
|
| 26 |
+
*/
|
| 27 |
+
function checkResourceAllowed({ requestedResource, configuredResource }) {
|
| 28 |
+
const requested = typeof requestedResource === 'string' ? new URL(requestedResource) : new URL(requestedResource.href);
|
| 29 |
+
const configured = typeof configuredResource === 'string' ? new URL(configuredResource) : new URL(configuredResource.href);
|
| 30 |
+
// Compare the origin (scheme, domain, and port)
|
| 31 |
+
if (requested.origin !== configured.origin) {
|
| 32 |
+
return false;
|
| 33 |
+
}
|
| 34 |
+
// Handle cases like requested=/foo and configured=/foo/
|
| 35 |
+
if (requested.pathname.length < configured.pathname.length) {
|
| 36 |
+
return false;
|
| 37 |
+
}
|
| 38 |
+
// Check if the requested path starts with the configured path
|
| 39 |
+
// Ensure both paths end with / for proper comparison
|
| 40 |
+
// This ensures that if we have paths like "/api" and "/api/users",
|
| 41 |
+
// we properly detect that "/api/users" is a subpath of "/api"
|
| 42 |
+
// By adding a trailing slash if missing, we avoid false positives
|
| 43 |
+
// where paths like "/api123" would incorrectly match "/api"
|
| 44 |
+
const requestedPath = requested.pathname.endsWith('/') ? requested.pathname : requested.pathname + '/';
|
| 45 |
+
const configuredPath = configured.pathname.endsWith('/') ? configured.pathname : configured.pathname + '/';
|
| 46 |
+
return requestedPath.startsWith(configuredPath);
|
| 47 |
+
}
|
| 48 |
+
//# sourceMappingURL=auth-utils.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth-utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"auth-utils.js","sourceRoot":"","sources":["../../../src/shared/auth-utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,4DAIC;AAWD,oDA8BC;AAlDD;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,GAAiB;IACtD,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/E,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,kBAAkB;IACzC,OAAO,WAAW,CAAC;AACvB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,EACjC,iBAAiB,EACjB,kBAAkB,EAIrB;IACG,MAAM,SAAS,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvH,MAAM,UAAU,GAAG,OAAO,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,kBAAkB,CAAC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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as z from 'zod/v4';
|
| 2 |
+
/**
|
| 3 |
+
* Reusable URL validation that disallows javascript: scheme
|
| 4 |
+
*/
|
| 5 |
+
export declare const SafeUrlSchema: z.ZodURL;
|
| 6 |
+
/**
|
| 7 |
+
* RFC 9728 OAuth Protected Resource Metadata
|
| 8 |
+
*/
|
| 9 |
+
export declare const OAuthProtectedResourceMetadataSchema: z.ZodObject<{
|
| 10 |
+
resource: z.ZodString;
|
| 11 |
+
authorization_servers: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
| 12 |
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
| 13 |
+
scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 14 |
+
bearer_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 15 |
+
resource_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 16 |
+
resource_name: z.ZodOptional<z.ZodString>;
|
| 17 |
+
resource_documentation: z.ZodOptional<z.ZodString>;
|
| 18 |
+
resource_policy_uri: z.ZodOptional<z.ZodString>;
|
| 19 |
+
resource_tos_uri: z.ZodOptional<z.ZodString>;
|
| 20 |
+
tls_client_certificate_bound_access_tokens: z.ZodOptional<z.ZodBoolean>;
|
| 21 |
+
authorization_details_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 22 |
+
dpop_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 23 |
+
dpop_bound_access_tokens_required: z.ZodOptional<z.ZodBoolean>;
|
| 24 |
+
}, z.core.$loose>;
|
| 25 |
+
/**
|
| 26 |
+
* RFC 8414 OAuth 2.0 Authorization Server Metadata
|
| 27 |
+
*/
|
| 28 |
+
export declare const OAuthMetadataSchema: z.ZodObject<{
|
| 29 |
+
issuer: z.ZodString;
|
| 30 |
+
authorization_endpoint: z.ZodURL;
|
| 31 |
+
token_endpoint: z.ZodURL;
|
| 32 |
+
registration_endpoint: z.ZodOptional<z.ZodURL>;
|
| 33 |
+
scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 34 |
+
response_types_supported: z.ZodArray<z.ZodString>;
|
| 35 |
+
response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 36 |
+
grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 37 |
+
token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 38 |
+
token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 39 |
+
service_documentation: z.ZodOptional<z.ZodURL>;
|
| 40 |
+
revocation_endpoint: z.ZodOptional<z.ZodURL>;
|
| 41 |
+
revocation_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 42 |
+
revocation_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 43 |
+
introspection_endpoint: z.ZodOptional<z.ZodString>;
|
| 44 |
+
introspection_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 45 |
+
introspection_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 46 |
+
code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 47 |
+
client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
|
| 48 |
+
}, z.core.$loose>;
|
| 49 |
+
/**
|
| 50 |
+
* OpenID Connect Discovery 1.0 Provider Metadata
|
| 51 |
+
* see: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
|
| 52 |
+
*/
|
| 53 |
+
export declare const OpenIdProviderMetadataSchema: z.ZodObject<{
|
| 54 |
+
issuer: z.ZodString;
|
| 55 |
+
authorization_endpoint: z.ZodURL;
|
| 56 |
+
token_endpoint: z.ZodURL;
|
| 57 |
+
userinfo_endpoint: z.ZodOptional<z.ZodURL>;
|
| 58 |
+
jwks_uri: z.ZodURL;
|
| 59 |
+
registration_endpoint: z.ZodOptional<z.ZodURL>;
|
| 60 |
+
scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 61 |
+
response_types_supported: z.ZodArray<z.ZodString>;
|
| 62 |
+
response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 63 |
+
grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 64 |
+
acr_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 65 |
+
subject_types_supported: z.ZodArray<z.ZodString>;
|
| 66 |
+
id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
|
| 67 |
+
id_token_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 68 |
+
id_token_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 69 |
+
userinfo_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 70 |
+
userinfo_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 71 |
+
userinfo_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 72 |
+
request_object_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 73 |
+
request_object_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 74 |
+
request_object_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 75 |
+
token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 76 |
+
token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 77 |
+
display_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 78 |
+
claim_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 79 |
+
claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 80 |
+
service_documentation: z.ZodOptional<z.ZodString>;
|
| 81 |
+
claims_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 82 |
+
ui_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 83 |
+
claims_parameter_supported: z.ZodOptional<z.ZodBoolean>;
|
| 84 |
+
request_parameter_supported: z.ZodOptional<z.ZodBoolean>;
|
| 85 |
+
request_uri_parameter_supported: z.ZodOptional<z.ZodBoolean>;
|
| 86 |
+
require_request_uri_registration: z.ZodOptional<z.ZodBoolean>;
|
| 87 |
+
op_policy_uri: z.ZodOptional<z.ZodURL>;
|
| 88 |
+
op_tos_uri: z.ZodOptional<z.ZodURL>;
|
| 89 |
+
client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
|
| 90 |
+
}, z.core.$loose>;
|
| 91 |
+
/**
|
| 92 |
+
* OpenID Connect Discovery metadata that may include OAuth 2.0 fields
|
| 93 |
+
* This schema represents the real-world scenario where OIDC providers
|
| 94 |
+
* return a mix of OpenID Connect and OAuth 2.0 metadata fields
|
| 95 |
+
*/
|
| 96 |
+
export declare const OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{
|
| 97 |
+
code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 98 |
+
issuer: z.ZodString;
|
| 99 |
+
authorization_endpoint: z.ZodURL;
|
| 100 |
+
token_endpoint: z.ZodURL;
|
| 101 |
+
userinfo_endpoint: z.ZodOptional<z.ZodURL>;
|
| 102 |
+
jwks_uri: z.ZodURL;
|
| 103 |
+
registration_endpoint: z.ZodOptional<z.ZodURL>;
|
| 104 |
+
scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 105 |
+
response_types_supported: z.ZodArray<z.ZodString>;
|
| 106 |
+
response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 107 |
+
grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 108 |
+
acr_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 109 |
+
subject_types_supported: z.ZodArray<z.ZodString>;
|
| 110 |
+
id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
|
| 111 |
+
id_token_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 112 |
+
id_token_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 113 |
+
userinfo_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 114 |
+
userinfo_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 115 |
+
userinfo_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 116 |
+
request_object_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 117 |
+
request_object_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 118 |
+
request_object_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 119 |
+
token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 120 |
+
token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 121 |
+
display_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 122 |
+
claim_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 123 |
+
claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 124 |
+
service_documentation: z.ZodOptional<z.ZodString>;
|
| 125 |
+
claims_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 126 |
+
ui_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 127 |
+
claims_parameter_supported: z.ZodOptional<z.ZodBoolean>;
|
| 128 |
+
request_parameter_supported: z.ZodOptional<z.ZodBoolean>;
|
| 129 |
+
request_uri_parameter_supported: z.ZodOptional<z.ZodBoolean>;
|
| 130 |
+
require_request_uri_registration: z.ZodOptional<z.ZodBoolean>;
|
| 131 |
+
op_policy_uri: z.ZodOptional<z.ZodURL>;
|
| 132 |
+
op_tos_uri: z.ZodOptional<z.ZodURL>;
|
| 133 |
+
client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
|
| 134 |
+
}, z.core.$strip>;
|
| 135 |
+
/**
|
| 136 |
+
* OAuth 2.1 token response
|
| 137 |
+
*/
|
| 138 |
+
export declare const OAuthTokensSchema: z.ZodObject<{
|
| 139 |
+
access_token: z.ZodString;
|
| 140 |
+
id_token: z.ZodOptional<z.ZodString>;
|
| 141 |
+
token_type: z.ZodString;
|
| 142 |
+
expires_in: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
| 143 |
+
scope: z.ZodOptional<z.ZodString>;
|
| 144 |
+
refresh_token: z.ZodOptional<z.ZodString>;
|
| 145 |
+
}, z.core.$strip>;
|
| 146 |
+
/**
|
| 147 |
+
* OAuth 2.1 error response
|
| 148 |
+
*/
|
| 149 |
+
export declare const OAuthErrorResponseSchema: z.ZodObject<{
|
| 150 |
+
error: z.ZodString;
|
| 151 |
+
error_description: z.ZodOptional<z.ZodString>;
|
| 152 |
+
error_uri: z.ZodOptional<z.ZodString>;
|
| 153 |
+
}, z.core.$strip>;
|
| 154 |
+
/**
|
| 155 |
+
* Optional version of SafeUrlSchema that allows empty string for retrocompatibility on tos_uri and logo_uri
|
| 156 |
+
*/
|
| 157 |
+
export declare const OptionalSafeUrlSchema: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
|
| 158 |
+
/**
|
| 159 |
+
* RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
|
| 160 |
+
*/
|
| 161 |
+
export declare const OAuthClientMetadataSchema: z.ZodObject<{
|
| 162 |
+
redirect_uris: z.ZodArray<z.ZodURL>;
|
| 163 |
+
token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
|
| 164 |
+
grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 165 |
+
response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 166 |
+
client_name: z.ZodOptional<z.ZodString>;
|
| 167 |
+
client_uri: z.ZodOptional<z.ZodURL>;
|
| 168 |
+
logo_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
|
| 169 |
+
scope: z.ZodOptional<z.ZodString>;
|
| 170 |
+
contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 171 |
+
tos_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
|
| 172 |
+
policy_uri: z.ZodOptional<z.ZodString>;
|
| 173 |
+
jwks_uri: z.ZodOptional<z.ZodURL>;
|
| 174 |
+
jwks: z.ZodOptional<z.ZodAny>;
|
| 175 |
+
software_id: z.ZodOptional<z.ZodString>;
|
| 176 |
+
software_version: z.ZodOptional<z.ZodString>;
|
| 177 |
+
software_statement: z.ZodOptional<z.ZodString>;
|
| 178 |
+
}, z.core.$strip>;
|
| 179 |
+
/**
|
| 180 |
+
* RFC 7591 OAuth 2.0 Dynamic Client Registration client information
|
| 181 |
+
*/
|
| 182 |
+
export declare const OAuthClientInformationSchema: z.ZodObject<{
|
| 183 |
+
client_id: z.ZodString;
|
| 184 |
+
client_secret: z.ZodOptional<z.ZodString>;
|
| 185 |
+
client_id_issued_at: z.ZodOptional<z.ZodNumber>;
|
| 186 |
+
client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
|
| 187 |
+
}, z.core.$strip>;
|
| 188 |
+
/**
|
| 189 |
+
* RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
|
| 190 |
+
*/
|
| 191 |
+
export declare const OAuthClientInformationFullSchema: z.ZodObject<{
|
| 192 |
+
redirect_uris: z.ZodArray<z.ZodURL>;
|
| 193 |
+
token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
|
| 194 |
+
grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 195 |
+
response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 196 |
+
client_name: z.ZodOptional<z.ZodString>;
|
| 197 |
+
client_uri: z.ZodOptional<z.ZodURL>;
|
| 198 |
+
logo_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
|
| 199 |
+
scope: z.ZodOptional<z.ZodString>;
|
| 200 |
+
contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
| 201 |
+
tos_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
|
| 202 |
+
policy_uri: z.ZodOptional<z.ZodString>;
|
| 203 |
+
jwks_uri: z.ZodOptional<z.ZodURL>;
|
| 204 |
+
jwks: z.ZodOptional<z.ZodAny>;
|
| 205 |
+
software_id: z.ZodOptional<z.ZodString>;
|
| 206 |
+
software_version: z.ZodOptional<z.ZodString>;
|
| 207 |
+
software_statement: z.ZodOptional<z.ZodString>;
|
| 208 |
+
client_id: z.ZodString;
|
| 209 |
+
client_secret: z.ZodOptional<z.ZodString>;
|
| 210 |
+
client_id_issued_at: z.ZodOptional<z.ZodNumber>;
|
| 211 |
+
client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
|
| 212 |
+
}, z.core.$strip>;
|
| 213 |
+
/**
|
| 214 |
+
* RFC 7591 OAuth 2.0 Dynamic Client Registration error response
|
| 215 |
+
*/
|
| 216 |
+
export declare const OAuthClientRegistrationErrorSchema: z.ZodObject<{
|
| 217 |
+
error: z.ZodString;
|
| 218 |
+
error_description: z.ZodOptional<z.ZodString>;
|
| 219 |
+
}, z.core.$strip>;
|
| 220 |
+
/**
|
| 221 |
+
* RFC 7009 OAuth 2.0 Token Revocation request
|
| 222 |
+
*/
|
| 223 |
+
export declare const OAuthTokenRevocationRequestSchema: z.ZodObject<{
|
| 224 |
+
token: z.ZodString;
|
| 225 |
+
token_type_hint: z.ZodOptional<z.ZodString>;
|
| 226 |
+
}, z.core.$strip>;
|
| 227 |
+
export type OAuthMetadata = z.infer<typeof OAuthMetadataSchema>;
|
| 228 |
+
export type OpenIdProviderMetadata = z.infer<typeof OpenIdProviderMetadataSchema>;
|
| 229 |
+
export type OpenIdProviderDiscoveryMetadata = z.infer<typeof OpenIdProviderDiscoveryMetadataSchema>;
|
| 230 |
+
export type OAuthTokens = z.infer<typeof OAuthTokensSchema>;
|
| 231 |
+
export type OAuthErrorResponse = z.infer<typeof OAuthErrorResponseSchema>;
|
| 232 |
+
export type OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>;
|
| 233 |
+
export type OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>;
|
| 234 |
+
export type OAuthClientInformationFull = z.infer<typeof OAuthClientInformationFullSchema>;
|
| 235 |
+
export type OAuthClientInformationMixed = OAuthClientInformation | OAuthClientInformationFull;
|
| 236 |
+
export type OAuthClientRegistrationError = z.infer<typeof OAuthClientRegistrationErrorSchema>;
|
| 237 |
+
export type OAuthTokenRevocationRequest = z.infer<typeof OAuthTokenRevocationRequestSchema>;
|
| 238 |
+
export type OAuthProtectedResourceMetadata = z.infer<typeof OAuthProtectedResourceMetadataSchema>;
|
| 239 |
+
export type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata;
|
| 240 |
+
//# sourceMappingURL=auth.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"auth.d.ts","sour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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
| 3 |
+
if (k2 === undefined) k2 = k;
|
| 4 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
| 5 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
| 6 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
| 7 |
+
}
|
| 8 |
+
Object.defineProperty(o, k2, desc);
|
| 9 |
+
}) : (function(o, m, k, k2) {
|
| 10 |
+
if (k2 === undefined) k2 = k;
|
| 11 |
+
o[k2] = m[k];
|
| 12 |
+
}));
|
| 13 |
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
| 14 |
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
| 15 |
+
}) : function(o, v) {
|
| 16 |
+
o["default"] = v;
|
| 17 |
+
});
|
| 18 |
+
var __importStar = (this && this.__importStar) || function (mod) {
|
| 19 |
+
if (mod && mod.__esModule) return mod;
|
| 20 |
+
var result = {};
|
| 21 |
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
| 22 |
+
__setModuleDefault(result, mod);
|
| 23 |
+
return result;
|
| 24 |
+
};
|
| 25 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 26 |
+
exports.OAuthTokenRevocationRequestSchema = exports.OAuthClientRegistrationErrorSchema = exports.OAuthClientInformationFullSchema = exports.OAuthClientInformationSchema = exports.OAuthClientMetadataSchema = exports.OptionalSafeUrlSchema = exports.OAuthErrorResponseSchema = exports.OAuthTokensSchema = exports.OpenIdProviderDiscoveryMetadataSchema = exports.OpenIdProviderMetadataSchema = exports.OAuthMetadataSchema = exports.OAuthProtectedResourceMetadataSchema = exports.SafeUrlSchema = void 0;
|
| 27 |
+
const z = __importStar(require("zod/v4"));
|
| 28 |
+
/**
|
| 29 |
+
* Reusable URL validation that disallows javascript: scheme
|
| 30 |
+
*/
|
| 31 |
+
exports.SafeUrlSchema = z
|
| 32 |
+
.url()
|
| 33 |
+
.superRefine((val, ctx) => {
|
| 34 |
+
if (!URL.canParse(val)) {
|
| 35 |
+
ctx.addIssue({
|
| 36 |
+
code: z.ZodIssueCode.custom,
|
| 37 |
+
message: 'URL must be parseable',
|
| 38 |
+
fatal: true
|
| 39 |
+
});
|
| 40 |
+
return z.NEVER;
|
| 41 |
+
}
|
| 42 |
+
})
|
| 43 |
+
.refine(url => {
|
| 44 |
+
const u = new URL(url);
|
| 45 |
+
return u.protocol !== 'javascript:' && u.protocol !== 'data:' && u.protocol !== 'vbscript:';
|
| 46 |
+
}, { message: 'URL cannot use javascript:, data:, or vbscript: scheme' });
|
| 47 |
+
/**
|
| 48 |
+
* RFC 9728 OAuth Protected Resource Metadata
|
| 49 |
+
*/
|
| 50 |
+
exports.OAuthProtectedResourceMetadataSchema = z.looseObject({
|
| 51 |
+
resource: z.string().url(),
|
| 52 |
+
authorization_servers: z.array(exports.SafeUrlSchema).optional(),
|
| 53 |
+
jwks_uri: z.string().url().optional(),
|
| 54 |
+
scopes_supported: z.array(z.string()).optional(),
|
| 55 |
+
bearer_methods_supported: z.array(z.string()).optional(),
|
| 56 |
+
resource_signing_alg_values_supported: z.array(z.string()).optional(),
|
| 57 |
+
resource_name: z.string().optional(),
|
| 58 |
+
resource_documentation: z.string().optional(),
|
| 59 |
+
resource_policy_uri: z.string().url().optional(),
|
| 60 |
+
resource_tos_uri: z.string().url().optional(),
|
| 61 |
+
tls_client_certificate_bound_access_tokens: z.boolean().optional(),
|
| 62 |
+
authorization_details_types_supported: z.array(z.string()).optional(),
|
| 63 |
+
dpop_signing_alg_values_supported: z.array(z.string()).optional(),
|
| 64 |
+
dpop_bound_access_tokens_required: z.boolean().optional()
|
| 65 |
+
});
|
| 66 |
+
/**
|
| 67 |
+
* RFC 8414 OAuth 2.0 Authorization Server Metadata
|
| 68 |
+
*/
|
| 69 |
+
exports.OAuthMetadataSchema = z.looseObject({
|
| 70 |
+
issuer: z.string(),
|
| 71 |
+
authorization_endpoint: exports.SafeUrlSchema,
|
| 72 |
+
token_endpoint: exports.SafeUrlSchema,
|
| 73 |
+
registration_endpoint: exports.SafeUrlSchema.optional(),
|
| 74 |
+
scopes_supported: z.array(z.string()).optional(),
|
| 75 |
+
response_types_supported: z.array(z.string()),
|
| 76 |
+
response_modes_supported: z.array(z.string()).optional(),
|
| 77 |
+
grant_types_supported: z.array(z.string()).optional(),
|
| 78 |
+
token_endpoint_auth_methods_supported: z.array(z.string()).optional(),
|
| 79 |
+
token_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),
|
| 80 |
+
service_documentation: exports.SafeUrlSchema.optional(),
|
| 81 |
+
revocation_endpoint: exports.SafeUrlSchema.optional(),
|
| 82 |
+
revocation_endpoint_auth_methods_supported: z.array(z.string()).optional(),
|
| 83 |
+
revocation_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),
|
| 84 |
+
introspection_endpoint: z.string().optional(),
|
| 85 |
+
introspection_endpoint_auth_methods_supported: z.array(z.string()).optional(),
|
| 86 |
+
introspection_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),
|
| 87 |
+
code_challenge_methods_supported: z.array(z.string()).optional(),
|
| 88 |
+
client_id_metadata_document_supported: z.boolean().optional()
|
| 89 |
+
});
|
| 90 |
+
/**
|
| 91 |
+
* OpenID Connect Discovery 1.0 Provider Metadata
|
| 92 |
+
* see: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
|
| 93 |
+
*/
|
| 94 |
+
exports.OpenIdProviderMetadataSchema = z.looseObject({
|
| 95 |
+
issuer: z.string(),
|
| 96 |
+
authorization_endpoint: exports.SafeUrlSchema,
|
| 97 |
+
token_endpoint: exports.SafeUrlSchema,
|
| 98 |
+
userinfo_endpoint: exports.SafeUrlSchema.optional(),
|
| 99 |
+
jwks_uri: exports.SafeUrlSchema,
|
| 100 |
+
registration_endpoint: exports.SafeUrlSchema.optional(),
|
| 101 |
+
scopes_supported: z.array(z.string()).optional(),
|
| 102 |
+
response_types_supported: z.array(z.string()),
|
| 103 |
+
response_modes_supported: z.array(z.string()).optional(),
|
| 104 |
+
grant_types_supported: z.array(z.string()).optional(),
|
| 105 |
+
acr_values_supported: z.array(z.string()).optional(),
|
| 106 |
+
subject_types_supported: z.array(z.string()),
|
| 107 |
+
id_token_signing_alg_values_supported: z.array(z.string()),
|
| 108 |
+
id_token_encryption_alg_values_supported: z.array(z.string()).optional(),
|
| 109 |
+
id_token_encryption_enc_values_supported: z.array(z.string()).optional(),
|
| 110 |
+
userinfo_signing_alg_values_supported: z.array(z.string()).optional(),
|
| 111 |
+
userinfo_encryption_alg_values_supported: z.array(z.string()).optional(),
|
| 112 |
+
userinfo_encryption_enc_values_supported: z.array(z.string()).optional(),
|
| 113 |
+
request_object_signing_alg_values_supported: z.array(z.string()).optional(),
|
| 114 |
+
request_object_encryption_alg_values_supported: z.array(z.string()).optional(),
|
| 115 |
+
request_object_encryption_enc_values_supported: z.array(z.string()).optional(),
|
| 116 |
+
token_endpoint_auth_methods_supported: z.array(z.string()).optional(),
|
| 117 |
+
token_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),
|
| 118 |
+
display_values_supported: z.array(z.string()).optional(),
|
| 119 |
+
claim_types_supported: z.array(z.string()).optional(),
|
| 120 |
+
claims_supported: z.array(z.string()).optional(),
|
| 121 |
+
service_documentation: z.string().optional(),
|
| 122 |
+
claims_locales_supported: z.array(z.string()).optional(),
|
| 123 |
+
ui_locales_supported: z.array(z.string()).optional(),
|
| 124 |
+
claims_parameter_supported: z.boolean().optional(),
|
| 125 |
+
request_parameter_supported: z.boolean().optional(),
|
| 126 |
+
request_uri_parameter_supported: z.boolean().optional(),
|
| 127 |
+
require_request_uri_registration: z.boolean().optional(),
|
| 128 |
+
op_policy_uri: exports.SafeUrlSchema.optional(),
|
| 129 |
+
op_tos_uri: exports.SafeUrlSchema.optional(),
|
| 130 |
+
client_id_metadata_document_supported: z.boolean().optional()
|
| 131 |
+
});
|
| 132 |
+
/**
|
| 133 |
+
* OpenID Connect Discovery metadata that may include OAuth 2.0 fields
|
| 134 |
+
* This schema represents the real-world scenario where OIDC providers
|
| 135 |
+
* return a mix of OpenID Connect and OAuth 2.0 metadata fields
|
| 136 |
+
*/
|
| 137 |
+
exports.OpenIdProviderDiscoveryMetadataSchema = z.object({
|
| 138 |
+
...exports.OpenIdProviderMetadataSchema.shape,
|
| 139 |
+
...exports.OAuthMetadataSchema.pick({
|
| 140 |
+
code_challenge_methods_supported: true
|
| 141 |
+
}).shape
|
| 142 |
+
});
|
| 143 |
+
/**
|
| 144 |
+
* OAuth 2.1 token response
|
| 145 |
+
*/
|
| 146 |
+
exports.OAuthTokensSchema = z
|
| 147 |
+
.object({
|
| 148 |
+
access_token: z.string(),
|
| 149 |
+
id_token: z.string().optional(), // Optional for OAuth 2.1, but necessary in OpenID Connect
|
| 150 |
+
token_type: z.string(),
|
| 151 |
+
expires_in: z.coerce.number().optional(),
|
| 152 |
+
scope: z.string().optional(),
|
| 153 |
+
refresh_token: z.string().optional()
|
| 154 |
+
})
|
| 155 |
+
.strip();
|
| 156 |
+
/**
|
| 157 |
+
* OAuth 2.1 error response
|
| 158 |
+
*/
|
| 159 |
+
exports.OAuthErrorResponseSchema = z.object({
|
| 160 |
+
error: z.string(),
|
| 161 |
+
error_description: z.string().optional(),
|
| 162 |
+
error_uri: z.string().optional()
|
| 163 |
+
});
|
| 164 |
+
/**
|
| 165 |
+
* Optional version of SafeUrlSchema that allows empty string for retrocompatibility on tos_uri and logo_uri
|
| 166 |
+
*/
|
| 167 |
+
exports.OptionalSafeUrlSchema = exports.SafeUrlSchema.optional().or(z.literal('').transform(() => undefined));
|
| 168 |
+
/**
|
| 169 |
+
* RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
|
| 170 |
+
*/
|
| 171 |
+
exports.OAuthClientMetadataSchema = z
|
| 172 |
+
.object({
|
| 173 |
+
redirect_uris: z.array(exports.SafeUrlSchema),
|
| 174 |
+
token_endpoint_auth_method: z.string().optional(),
|
| 175 |
+
grant_types: z.array(z.string()).optional(),
|
| 176 |
+
response_types: z.array(z.string()).optional(),
|
| 177 |
+
client_name: z.string().optional(),
|
| 178 |
+
client_uri: exports.SafeUrlSchema.optional(),
|
| 179 |
+
logo_uri: exports.OptionalSafeUrlSchema,
|
| 180 |
+
scope: z.string().optional(),
|
| 181 |
+
contacts: z.array(z.string()).optional(),
|
| 182 |
+
tos_uri: exports.OptionalSafeUrlSchema,
|
| 183 |
+
policy_uri: z.string().optional(),
|
| 184 |
+
jwks_uri: exports.SafeUrlSchema.optional(),
|
| 185 |
+
jwks: z.any().optional(),
|
| 186 |
+
software_id: z.string().optional(),
|
| 187 |
+
software_version: z.string().optional(),
|
| 188 |
+
software_statement: z.string().optional()
|
| 189 |
+
})
|
| 190 |
+
.strip();
|
| 191 |
+
/**
|
| 192 |
+
* RFC 7591 OAuth 2.0 Dynamic Client Registration client information
|
| 193 |
+
*/
|
| 194 |
+
exports.OAuthClientInformationSchema = z
|
| 195 |
+
.object({
|
| 196 |
+
client_id: z.string(),
|
| 197 |
+
client_secret: z.string().optional(),
|
| 198 |
+
client_id_issued_at: z.number().optional(),
|
| 199 |
+
client_secret_expires_at: z.number().optional()
|
| 200 |
+
})
|
| 201 |
+
.strip();
|
| 202 |
+
/**
|
| 203 |
+
* RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
|
| 204 |
+
*/
|
| 205 |
+
exports.OAuthClientInformationFullSchema = exports.OAuthClientMetadataSchema.merge(exports.OAuthClientInformationSchema);
|
| 206 |
+
/**
|
| 207 |
+
* RFC 7591 OAuth 2.0 Dynamic Client Registration error response
|
| 208 |
+
*/
|
| 209 |
+
exports.OAuthClientRegistrationErrorSchema = z
|
| 210 |
+
.object({
|
| 211 |
+
error: z.string(),
|
| 212 |
+
error_description: z.string().optional()
|
| 213 |
+
})
|
| 214 |
+
.strip();
|
| 215 |
+
/**
|
| 216 |
+
* RFC 7009 OAuth 2.0 Token Revocation request
|
| 217 |
+
*/
|
| 218 |
+
exports.OAuthTokenRevocationRequestSchema = z
|
| 219 |
+
.object({
|
| 220 |
+
token: z.string(),
|
| 221 |
+
token_type_hint: z.string().optional()
|
| 222 |
+
})
|
| 223 |
+
.strip();
|
| 224 |
+
//# sourceMappingURL=auth.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/shared/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA4B;AAE5B;;GAEG;AACU,QAAA,aAAa,GAAG,CAAC;KACzB,GAAG,EAAE;KACL,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACtB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,GAAG,CAAC,QAAQ,CAAC;YACT,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,uBAAuB;YAChC,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,CAAC,CAAC,KAAK,CAAC;IACnB,CAAC;AACL,CAAC,CAAC;KACD,MAAM,CACH,GAAG,CAAC,EAAE;IACF,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,QAAQ,KAAK,aAAa,IAAI,CAAC,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,CAAC,QAAQ,KAAK,WAAW,CAAC;AAChG,CAAC,EACD,EAAE,OAAO,EAAE,wDAAwD,EAAE,CACxE,CAAC;AAEN;;GAEG;AACU,QAAA,oCAAoC,GAAG,CAAC,C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1 |
+
import { BaseMetadata } from '../types.js';
|
| 2 |
+
/**
|
| 3 |
+
* Utilities for working with BaseMetadata objects.
|
| 4 |
+
*/
|
| 5 |
+
/**
|
| 6 |
+
* Gets the display name for an object with BaseMetadata.
|
| 7 |
+
* For tools, the precedence is: title → annotations.title → name
|
| 8 |
+
* For other objects: title → name
|
| 9 |
+
* This implements the spec requirement: "if no title is provided, name should be used for display purposes"
|
| 10 |
+
*/
|
| 11 |
+
export declare function getDisplayName(metadata: BaseMetadata | (BaseMetadata & {
|
| 12 |
+
annotations?: {
|
| 13 |
+
title?: string;
|
| 14 |
+
};
|
| 15 |
+
})): string;
|
| 16 |
+
//# sourceMappingURL=metadataUtils.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/metadataUtils.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"metadataUtils.d.ts","sourceRoot":"","sources":["../../../src/shared/metadataUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AAEH;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG;IAAE,WAAW,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,GAAG,MAAM,CAarH"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/metadataUtils.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.getDisplayName = getDisplayName;
|
| 4 |
+
/**
|
| 5 |
+
* Utilities for working with BaseMetadata objects.
|
| 6 |
+
*/
|
| 7 |
+
/**
|
| 8 |
+
* Gets the display name for an object with BaseMetadata.
|
| 9 |
+
* For tools, the precedence is: title → annotations.title → name
|
| 10 |
+
* For other objects: title → name
|
| 11 |
+
* This implements the spec requirement: "if no title is provided, name should be used for display purposes"
|
| 12 |
+
*/
|
| 13 |
+
function getDisplayName(metadata) {
|
| 14 |
+
// First check for title (not undefined and not empty string)
|
| 15 |
+
if (metadata.title !== undefined && metadata.title !== '') {
|
| 16 |
+
return metadata.title;
|
| 17 |
+
}
|
| 18 |
+
// Then check for annotations.title (only present in Tool objects)
|
| 19 |
+
if ('annotations' in metadata && metadata.annotations?.title) {
|
| 20 |
+
return metadata.annotations.title;
|
| 21 |
+
}
|
| 22 |
+
// Finally fall back to name
|
| 23 |
+
return metadata.name;
|
| 24 |
+
}
|
| 25 |
+
//# sourceMappingURL=metadataUtils.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/metadataUtils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"metadataUtils.js","sourceRoot":"","sources":["../../../src/shared/metadataUtils.ts"],"names":[],"mappings":";;AAYA,wCAaC;AAvBD;;GAEG;AAEH;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,QAA8E;IACzG,6DAA6D;IAC7D,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;QACxD,OAAO,QAAQ,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kEAAkE;IAClE,IAAI,aAAa,IAAI,QAAQ,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC;QAC3D,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC;IACtC,CAAC;IAED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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { AnySchema, AnyObjectSchema, SchemaOutput } from '../server/zod-compat.js';
|
| 2 |
+
import { ClientCapabilities, GetTaskRequest, GetTaskPayloadRequest, ListTasksResultSchema, CancelTaskResultSchema, JSONRPCRequest, Progress, RequestId, Result, ServerCapabilities, RequestMeta, RequestInfo, GetTaskResult, TaskCreationParams, RelatedTaskMetadata, Task, Request, Notification } from '../types.js';
|
| 3 |
+
import { Transport, TransportSendOptions } from './transport.js';
|
| 4 |
+
import { AuthInfo } from '../server/auth/types.js';
|
| 5 |
+
import { TaskStore, TaskMessageQueue, CreateTaskOptions } from '../experimental/tasks/interfaces.js';
|
| 6 |
+
import { ResponseMessage } from './responseMessage.js';
|
| 7 |
+
/**
|
| 8 |
+
* Callback for progress notifications.
|
| 9 |
+
*/
|
| 10 |
+
export type ProgressCallback = (progress: Progress) => void;
|
| 11 |
+
/**
|
| 12 |
+
* Additional initialization options.
|
| 13 |
+
*/
|
| 14 |
+
export type ProtocolOptions = {
|
| 15 |
+
/**
|
| 16 |
+
* Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities.
|
| 17 |
+
*
|
| 18 |
+
* Note that this DOES NOT affect checking of _local_ side capabilities, as it is considered a logic error to mis-specify those.
|
| 19 |
+
*
|
| 20 |
+
* Currently this defaults to false, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to true.
|
| 21 |
+
*/
|
| 22 |
+
enforceStrictCapabilities?: boolean;
|
| 23 |
+
/**
|
| 24 |
+
* An array of notification method names that should be automatically debounced.
|
| 25 |
+
* Any notifications with a method in this list will be coalesced if they
|
| 26 |
+
* occur in the same tick of the event loop.
|
| 27 |
+
* e.g., ['notifications/tools/list_changed']
|
| 28 |
+
*/
|
| 29 |
+
debouncedNotificationMethods?: string[];
|
| 30 |
+
/**
|
| 31 |
+
* Optional task storage implementation. If provided, enables task-related request handlers
|
| 32 |
+
* and provides task storage capabilities to request handlers.
|
| 33 |
+
*/
|
| 34 |
+
taskStore?: TaskStore;
|
| 35 |
+
/**
|
| 36 |
+
* Optional task message queue implementation for managing server-initiated messages
|
| 37 |
+
* that will be delivered through the tasks/result response stream.
|
| 38 |
+
*/
|
| 39 |
+
taskMessageQueue?: TaskMessageQueue;
|
| 40 |
+
/**
|
| 41 |
+
* Default polling interval (in milliseconds) for task status checks when no pollInterval
|
| 42 |
+
* is provided by the server. Defaults to 5000ms if not specified.
|
| 43 |
+
*/
|
| 44 |
+
defaultTaskPollInterval?: number;
|
| 45 |
+
/**
|
| 46 |
+
* Maximum number of messages that can be queued per task for side-channel delivery.
|
| 47 |
+
* If undefined, the queue size is unbounded.
|
| 48 |
+
* When the limit is exceeded, the TaskMessageQueue implementation's enqueue() method
|
| 49 |
+
* will throw an error. It's the implementation's responsibility to handle overflow
|
| 50 |
+
* appropriately (e.g., by failing the task, dropping messages, etc.).
|
| 51 |
+
*/
|
| 52 |
+
maxTaskQueueSize?: number;
|
| 53 |
+
};
|
| 54 |
+
/**
|
| 55 |
+
* The default request timeout, in miliseconds.
|
| 56 |
+
*/
|
| 57 |
+
export declare const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
| 58 |
+
/**
|
| 59 |
+
* Options that can be given per request.
|
| 60 |
+
*/
|
| 61 |
+
export type RequestOptions = {
|
| 62 |
+
/**
|
| 63 |
+
* If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.
|
| 64 |
+
*
|
| 65 |
+
* For task-augmented requests: progress notifications continue after CreateTaskResult is returned and stop automatically when the task reaches a terminal status.
|
| 66 |
+
*/
|
| 67 |
+
onprogress?: ProgressCallback;
|
| 68 |
+
/**
|
| 69 |
+
* Can be used to cancel an in-flight request. This will cause an AbortError to be raised from request().
|
| 70 |
+
*/
|
| 71 |
+
signal?: AbortSignal;
|
| 72 |
+
/**
|
| 73 |
+
* A timeout (in milliseconds) for this request. If exceeded, an McpError with code `RequestTimeout` will be raised from request().
|
| 74 |
+
*
|
| 75 |
+
* If not specified, `DEFAULT_REQUEST_TIMEOUT_MSEC` will be used as the timeout.
|
| 76 |
+
*/
|
| 77 |
+
timeout?: number;
|
| 78 |
+
/**
|
| 79 |
+
* If true, receiving a progress notification will reset the request timeout.
|
| 80 |
+
* This is useful for long-running operations that send periodic progress updates.
|
| 81 |
+
* Default: false
|
| 82 |
+
*/
|
| 83 |
+
resetTimeoutOnProgress?: boolean;
|
| 84 |
+
/**
|
| 85 |
+
* Maximum total time (in milliseconds) to wait for a response.
|
| 86 |
+
* If exceeded, an McpError with code `RequestTimeout` will be raised, regardless of progress notifications.
|
| 87 |
+
* If not specified, there is no maximum total timeout.
|
| 88 |
+
*/
|
| 89 |
+
maxTotalTimeout?: number;
|
| 90 |
+
/**
|
| 91 |
+
* If provided, augments the request with task creation parameters to enable call-now, fetch-later execution patterns.
|
| 92 |
+
*/
|
| 93 |
+
task?: TaskCreationParams;
|
| 94 |
+
/**
|
| 95 |
+
* If provided, associates this request with a related task.
|
| 96 |
+
*/
|
| 97 |
+
relatedTask?: RelatedTaskMetadata;
|
| 98 |
+
} & TransportSendOptions;
|
| 99 |
+
/**
|
| 100 |
+
* Options that can be given per notification.
|
| 101 |
+
*/
|
| 102 |
+
export type NotificationOptions = {
|
| 103 |
+
/**
|
| 104 |
+
* May be used to indicate to the transport which incoming request to associate this outgoing notification with.
|
| 105 |
+
*/
|
| 106 |
+
relatedRequestId?: RequestId;
|
| 107 |
+
/**
|
| 108 |
+
* If provided, associates this notification with a related task.
|
| 109 |
+
*/
|
| 110 |
+
relatedTask?: RelatedTaskMetadata;
|
| 111 |
+
};
|
| 112 |
+
/**
|
| 113 |
+
* Options that can be given per request.
|
| 114 |
+
*/
|
| 115 |
+
export type TaskRequestOptions = Omit<RequestOptions, 'relatedTask'>;
|
| 116 |
+
/**
|
| 117 |
+
* Request-scoped TaskStore interface.
|
| 118 |
+
*/
|
| 119 |
+
export interface RequestTaskStore {
|
| 120 |
+
/**
|
| 121 |
+
* Creates a new task with the given creation parameters.
|
| 122 |
+
* The implementation generates a unique taskId and createdAt timestamp.
|
| 123 |
+
*
|
| 124 |
+
* @param taskParams - The task creation parameters from the request
|
| 125 |
+
* @returns The created task object
|
| 126 |
+
*/
|
| 127 |
+
createTask(taskParams: CreateTaskOptions): Promise<Task>;
|
| 128 |
+
/**
|
| 129 |
+
* Gets the current status of a task.
|
| 130 |
+
*
|
| 131 |
+
* @param taskId - The task identifier
|
| 132 |
+
* @returns The task object
|
| 133 |
+
* @throws If the task does not exist
|
| 134 |
+
*/
|
| 135 |
+
getTask(taskId: string): Promise<Task>;
|
| 136 |
+
/**
|
| 137 |
+
* Stores the result of a task and sets its final status.
|
| 138 |
+
*
|
| 139 |
+
* @param taskId - The task identifier
|
| 140 |
+
* @param status - The final status: 'completed' for success, 'failed' for errors
|
| 141 |
+
* @param result - The result to store
|
| 142 |
+
*/
|
| 143 |
+
storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result): Promise<void>;
|
| 144 |
+
/**
|
| 145 |
+
* Retrieves the stored result of a task.
|
| 146 |
+
*
|
| 147 |
+
* @param taskId - The task identifier
|
| 148 |
+
* @returns The stored result
|
| 149 |
+
*/
|
| 150 |
+
getTaskResult(taskId: string): Promise<Result>;
|
| 151 |
+
/**
|
| 152 |
+
* Updates a task's status (e.g., to 'cancelled', 'failed', 'completed').
|
| 153 |
+
*
|
| 154 |
+
* @param taskId - The task identifier
|
| 155 |
+
* @param status - The new status
|
| 156 |
+
* @param statusMessage - Optional diagnostic message for failed tasks or other status information
|
| 157 |
+
*/
|
| 158 |
+
updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string): Promise<void>;
|
| 159 |
+
/**
|
| 160 |
+
* Lists tasks, optionally starting from a pagination cursor.
|
| 161 |
+
*
|
| 162 |
+
* @param cursor - Optional cursor for pagination
|
| 163 |
+
* @returns An object containing the tasks array and an optional nextCursor
|
| 164 |
+
*/
|
| 165 |
+
listTasks(cursor?: string): Promise<{
|
| 166 |
+
tasks: Task[];
|
| 167 |
+
nextCursor?: string;
|
| 168 |
+
}>;
|
| 169 |
+
}
|
| 170 |
+
/**
|
| 171 |
+
* Extra data given to request handlers.
|
| 172 |
+
*/
|
| 173 |
+
export type RequestHandlerExtra<SendRequestT extends Request, SendNotificationT extends Notification> = {
|
| 174 |
+
/**
|
| 175 |
+
* An abort signal used to communicate if the request was cancelled from the sender's side.
|
| 176 |
+
*/
|
| 177 |
+
signal: AbortSignal;
|
| 178 |
+
/**
|
| 179 |
+
* Information about a validated access token, provided to request handlers.
|
| 180 |
+
*/
|
| 181 |
+
authInfo?: AuthInfo;
|
| 182 |
+
/**
|
| 183 |
+
* The session ID from the transport, if available.
|
| 184 |
+
*/
|
| 185 |
+
sessionId?: string;
|
| 186 |
+
/**
|
| 187 |
+
* Metadata from the original request.
|
| 188 |
+
*/
|
| 189 |
+
_meta?: RequestMeta;
|
| 190 |
+
/**
|
| 191 |
+
* The JSON-RPC ID of the request being handled.
|
| 192 |
+
* This can be useful for tracking or logging purposes.
|
| 193 |
+
*/
|
| 194 |
+
requestId: RequestId;
|
| 195 |
+
taskId?: string;
|
| 196 |
+
taskStore?: RequestTaskStore;
|
| 197 |
+
taskRequestedTtl?: number;
|
| 198 |
+
/**
|
| 199 |
+
* The original HTTP request.
|
| 200 |
+
*/
|
| 201 |
+
requestInfo?: RequestInfo;
|
| 202 |
+
/**
|
| 203 |
+
* Sends a notification that relates to the current request being handled.
|
| 204 |
+
*
|
| 205 |
+
* This is used by certain transports to correctly associate related messages.
|
| 206 |
+
*/
|
| 207 |
+
sendNotification: (notification: SendNotificationT) => Promise<void>;
|
| 208 |
+
/**
|
| 209 |
+
* Sends a request that relates to the current request being handled.
|
| 210 |
+
*
|
| 211 |
+
* This is used by certain transports to correctly associate related messages.
|
| 212 |
+
*/
|
| 213 |
+
sendRequest: <U extends AnySchema>(request: SendRequestT, resultSchema: U, options?: TaskRequestOptions) => Promise<SchemaOutput<U>>;
|
| 214 |
+
/**
|
| 215 |
+
* Closes the SSE stream for this request, triggering client reconnection.
|
| 216 |
+
* Only available when using StreamableHTTPServerTransport with eventStore configured.
|
| 217 |
+
* Use this to implement polling behavior during long-running operations.
|
| 218 |
+
*/
|
| 219 |
+
closeSSEStream?: () => void;
|
| 220 |
+
/**
|
| 221 |
+
* Closes the standalone GET SSE stream, triggering client reconnection.
|
| 222 |
+
* Only available when using StreamableHTTPServerTransport with eventStore configured.
|
| 223 |
+
* Use this to implement polling behavior for server-initiated notifications.
|
| 224 |
+
*/
|
| 225 |
+
closeStandaloneSSEStream?: () => void;
|
| 226 |
+
};
|
| 227 |
+
/**
|
| 228 |
+
* Implements MCP protocol framing on top of a pluggable transport, including
|
| 229 |
+
* features like request/response linking, notifications, and progress.
|
| 230 |
+
*/
|
| 231 |
+
export declare abstract class Protocol<SendRequestT extends Request, SendNotificationT extends Notification, SendResultT extends Result> {
|
| 232 |
+
private _options?;
|
| 233 |
+
private _transport?;
|
| 234 |
+
private _requestMessageId;
|
| 235 |
+
private _requestHandlers;
|
| 236 |
+
private _requestHandlerAbortControllers;
|
| 237 |
+
private _notificationHandlers;
|
| 238 |
+
private _responseHandlers;
|
| 239 |
+
private _progressHandlers;
|
| 240 |
+
private _timeoutInfo;
|
| 241 |
+
private _pendingDebouncedNotifications;
|
| 242 |
+
private _taskProgressTokens;
|
| 243 |
+
private _taskStore?;
|
| 244 |
+
private _taskMessageQueue?;
|
| 245 |
+
private _requestResolvers;
|
| 246 |
+
/**
|
| 247 |
+
* Callback for when the connection is closed for any reason.
|
| 248 |
+
*
|
| 249 |
+
* This is invoked when close() is called as well.
|
| 250 |
+
*/
|
| 251 |
+
onclose?: () => void;
|
| 252 |
+
/**
|
| 253 |
+
* Callback for when an error occurs.
|
| 254 |
+
*
|
| 255 |
+
* Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.
|
| 256 |
+
*/
|
| 257 |
+
onerror?: (error: Error) => void;
|
| 258 |
+
/**
|
| 259 |
+
* A handler to invoke for any request types that do not have their own handler installed.
|
| 260 |
+
*/
|
| 261 |
+
fallbackRequestHandler?: (request: JSONRPCRequest, extra: RequestHandlerExtra<SendRequestT, SendNotificationT>) => Promise<SendResultT>;
|
| 262 |
+
/**
|
| 263 |
+
* A handler to invoke for any notification types that do not have their own handler installed.
|
| 264 |
+
*/
|
| 265 |
+
fallbackNotificationHandler?: (notification: Notification) => Promise<void>;
|
| 266 |
+
constructor(_options?: ProtocolOptions | undefined);
|
| 267 |
+
private _oncancel;
|
| 268 |
+
private _setupTimeout;
|
| 269 |
+
private _resetTimeout;
|
| 270 |
+
private _cleanupTimeout;
|
| 271 |
+
/**
|
| 272 |
+
* Attaches to the given transport, starts it, and starts listening for messages.
|
| 273 |
+
*
|
| 274 |
+
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
| 275 |
+
*/
|
| 276 |
+
connect(transport: Transport): Promise<void>;
|
| 277 |
+
private _onclose;
|
| 278 |
+
private _onerror;
|
| 279 |
+
private _onnotification;
|
| 280 |
+
private _onrequest;
|
| 281 |
+
private _onprogress;
|
| 282 |
+
private _onresponse;
|
| 283 |
+
get transport(): Transport | undefined;
|
| 284 |
+
/**
|
| 285 |
+
* Closes the connection.
|
| 286 |
+
*/
|
| 287 |
+
close(): Promise<void>;
|
| 288 |
+
/**
|
| 289 |
+
* A method to check if a capability is supported by the remote side, for the given method to be called.
|
| 290 |
+
*
|
| 291 |
+
* This should be implemented by subclasses.
|
| 292 |
+
*/
|
| 293 |
+
protected abstract assertCapabilityForMethod(method: SendRequestT['method']): void;
|
| 294 |
+
/**
|
| 295 |
+
* A method to check if a notification is supported by the local side, for the given method to be sent.
|
| 296 |
+
*
|
| 297 |
+
* This should be implemented by subclasses.
|
| 298 |
+
*/
|
| 299 |
+
protected abstract assertNotificationCapability(method: SendNotificationT['method']): void;
|
| 300 |
+
/**
|
| 301 |
+
* A method to check if a request handler is supported by the local side, for the given method to be handled.
|
| 302 |
+
*
|
| 303 |
+
* This should be implemented by subclasses.
|
| 304 |
+
*/
|
| 305 |
+
protected abstract assertRequestHandlerCapability(method: string): void;
|
| 306 |
+
/**
|
| 307 |
+
* A method to check if task creation is supported for the given request method.
|
| 308 |
+
*
|
| 309 |
+
* This should be implemented by subclasses.
|
| 310 |
+
*/
|
| 311 |
+
protected abstract assertTaskCapability(method: string): void;
|
| 312 |
+
/**
|
| 313 |
+
* A method to check if task handler is supported by the local side, for the given method to be handled.
|
| 314 |
+
*
|
| 315 |
+
* This should be implemented by subclasses.
|
| 316 |
+
*/
|
| 317 |
+
protected abstract assertTaskHandlerCapability(method: string): void;
|
| 318 |
+
/**
|
| 319 |
+
* Sends a request and returns an AsyncGenerator that yields response messages.
|
| 320 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 321 |
+
*
|
| 322 |
+
* @example
|
| 323 |
+
* ```typescript
|
| 324 |
+
* const stream = protocol.requestStream(request, resultSchema, options);
|
| 325 |
+
* for await (const message of stream) {
|
| 326 |
+
* switch (message.type) {
|
| 327 |
+
* case 'taskCreated':
|
| 328 |
+
* console.log('Task created:', message.task.taskId);
|
| 329 |
+
* break;
|
| 330 |
+
* case 'taskStatus':
|
| 331 |
+
* console.log('Task status:', message.task.status);
|
| 332 |
+
* break;
|
| 333 |
+
* case 'result':
|
| 334 |
+
* console.log('Final result:', message.result);
|
| 335 |
+
* break;
|
| 336 |
+
* case 'error':
|
| 337 |
+
* console.error('Error:', message.error);
|
| 338 |
+
* break;
|
| 339 |
+
* }
|
| 340 |
+
* }
|
| 341 |
+
* ```
|
| 342 |
+
*
|
| 343 |
+
* @experimental Use `client.experimental.tasks.requestStream()` to access this method.
|
| 344 |
+
*/
|
| 345 |
+
protected requestStream<T extends AnySchema>(request: SendRequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>;
|
| 346 |
+
/**
|
| 347 |
+
* Sends a request and waits for a response.
|
| 348 |
+
*
|
| 349 |
+
* Do not use this method to emit notifications! Use notification() instead.
|
| 350 |
+
*/
|
| 351 |
+
request<T extends AnySchema>(request: SendRequestT, resultSchema: T, options?: RequestOptions): Promise<SchemaOutput<T>>;
|
| 352 |
+
/**
|
| 353 |
+
* Gets the current status of a task.
|
| 354 |
+
*
|
| 355 |
+
* @experimental Use `client.experimental.tasks.getTask()` to access this method.
|
| 356 |
+
*/
|
| 357 |
+
protected getTask(params: GetTaskRequest['params'], options?: RequestOptions): Promise<GetTaskResult>;
|
| 358 |
+
/**
|
| 359 |
+
* Retrieves the result of a completed task.
|
| 360 |
+
*
|
| 361 |
+
* @experimental Use `client.experimental.tasks.getTaskResult()` to access this method.
|
| 362 |
+
*/
|
| 363 |
+
protected getTaskResult<T extends AnySchema>(params: GetTaskPayloadRequest['params'], resultSchema: T, options?: RequestOptions): Promise<SchemaOutput<T>>;
|
| 364 |
+
/**
|
| 365 |
+
* Lists tasks, optionally starting from a pagination cursor.
|
| 366 |
+
*
|
| 367 |
+
* @experimental Use `client.experimental.tasks.listTasks()` to access this method.
|
| 368 |
+
*/
|
| 369 |
+
protected listTasks(params?: {
|
| 370 |
+
cursor?: string;
|
| 371 |
+
}, options?: RequestOptions): Promise<SchemaOutput<typeof ListTasksResultSchema>>;
|
| 372 |
+
/**
|
| 373 |
+
* Cancels a specific task.
|
| 374 |
+
*
|
| 375 |
+
* @experimental Use `client.experimental.tasks.cancelTask()` to access this method.
|
| 376 |
+
*/
|
| 377 |
+
protected cancelTask(params: {
|
| 378 |
+
taskId: string;
|
| 379 |
+
}, options?: RequestOptions): Promise<SchemaOutput<typeof CancelTaskResultSchema>>;
|
| 380 |
+
/**
|
| 381 |
+
* Emits a notification, which is a one-way message that does not expect a response.
|
| 382 |
+
*/
|
| 383 |
+
notification(notification: SendNotificationT, options?: NotificationOptions): Promise<void>;
|
| 384 |
+
/**
|
| 385 |
+
* Registers a handler to invoke when this protocol object receives a request with the given method.
|
| 386 |
+
*
|
| 387 |
+
* Note that this will replace any previous request handler for the same method.
|
| 388 |
+
*/
|
| 389 |
+
setRequestHandler<T extends AnyObjectSchema>(requestSchema: T, handler: (request: SchemaOutput<T>, extra: RequestHandlerExtra<SendRequestT, SendNotificationT>) => SendResultT | Promise<SendResultT>): void;
|
| 390 |
+
/**
|
| 391 |
+
* Removes the request handler for the given method.
|
| 392 |
+
*/
|
| 393 |
+
removeRequestHandler(method: string): void;
|
| 394 |
+
/**
|
| 395 |
+
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
| 396 |
+
*/
|
| 397 |
+
assertCanSetRequestHandler(method: string): void;
|
| 398 |
+
/**
|
| 399 |
+
* Registers a handler to invoke when this protocol object receives a notification with the given method.
|
| 400 |
+
*
|
| 401 |
+
* Note that this will replace any previous notification handler for the same method.
|
| 402 |
+
*/
|
| 403 |
+
setNotificationHandler<T extends AnyObjectSchema>(notificationSchema: T, handler: (notification: SchemaOutput<T>) => void | Promise<void>): void;
|
| 404 |
+
/**
|
| 405 |
+
* Removes the notification handler for the given method.
|
| 406 |
+
*/
|
| 407 |
+
removeNotificationHandler(method: string): void;
|
| 408 |
+
/**
|
| 409 |
+
* Cleans up the progress handler associated with a task.
|
| 410 |
+
* This should be called when a task reaches a terminal status.
|
| 411 |
+
*/
|
| 412 |
+
private _cleanupTaskProgressHandler;
|
| 413 |
+
/**
|
| 414 |
+
* Enqueues a task-related message for side-channel delivery via tasks/result.
|
| 415 |
+
* @param taskId The task ID to associate the message with
|
| 416 |
+
* @param message The message to enqueue
|
| 417 |
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
| 418 |
+
* @throws Error if taskStore is not configured or if enqueue fails (e.g., queue overflow)
|
| 419 |
+
*
|
| 420 |
+
* Note: If enqueue fails, it's the TaskMessageQueue implementation's responsibility to handle
|
| 421 |
+
* the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer
|
| 422 |
+
* simply propagates the error.
|
| 423 |
+
*/
|
| 424 |
+
private _enqueueTaskMessage;
|
| 425 |
+
/**
|
| 426 |
+
* Clears the message queue for a task and rejects any pending request resolvers.
|
| 427 |
+
* @param taskId The task ID whose queue should be cleared
|
| 428 |
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
| 429 |
+
*/
|
| 430 |
+
private _clearTaskQueue;
|
| 431 |
+
/**
|
| 432 |
+
* Waits for a task update (new messages or status change) with abort signal support.
|
| 433 |
+
* Uses polling to check for updates at the task's configured poll interval.
|
| 434 |
+
* @param taskId The task ID to wait for
|
| 435 |
+
* @param signal Abort signal to cancel the wait
|
| 436 |
+
* @returns Promise that resolves when an update occurs or rejects if aborted
|
| 437 |
+
*/
|
| 438 |
+
private _waitForTaskUpdate;
|
| 439 |
+
private requestTaskStore;
|
| 440 |
+
}
|
| 441 |
+
export declare function mergeCapabilities(base: ServerCapabilities, additional: Partial<ServerCapabilities>): ServerCapabilities;
|
| 442 |
+
export declare function mergeCapabilities(base: ClientCapabilities, additional: Partial<ClientCapabilities>): ClientCapabilities;
|
| 443 |
+
//# sourceMappingURL=protocol.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAa,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAEH,kBAAkB,EAGlB,cAAc,EAGd,qBAAqB,EAGrB,qBAAqB,EAErB,sBAAsB,EAOtB,cAAc,EAId,QAAQ,EAIR,SAAS,EACT,MAAM,EACN,kBAAkB,EAClB,WAAW,EAEX,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EAEnB,IAAI,EAGJ,OAAO,EACP,YAAY,EAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAc,SAAS,EAAE,gBAAgB,EAAiB,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAEhI,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B;;;;;;OAMG;IACH,yBAAyB,CAAC,EAAE,OAAO,C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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.Protocol = exports.DEFAULT_REQUEST_TIMEOUT_MSEC = void 0;
|
| 4 |
+
exports.mergeCapabilities = mergeCapabilities;
|
| 5 |
+
const zod_compat_js_1 = require("../server/zod-compat.js");
|
| 6 |
+
const types_js_1 = require("../types.js");
|
| 7 |
+
const interfaces_js_1 = require("../experimental/tasks/interfaces.js");
|
| 8 |
+
const zod_json_schema_compat_js_1 = require("../server/zod-json-schema-compat.js");
|
| 9 |
+
/**
|
| 10 |
+
* The default request timeout, in miliseconds.
|
| 11 |
+
*/
|
| 12 |
+
exports.DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
| 13 |
+
/**
|
| 14 |
+
* Implements MCP protocol framing on top of a pluggable transport, including
|
| 15 |
+
* features like request/response linking, notifications, and progress.
|
| 16 |
+
*/
|
| 17 |
+
class Protocol {
|
| 18 |
+
constructor(_options) {
|
| 19 |
+
this._options = _options;
|
| 20 |
+
this._requestMessageId = 0;
|
| 21 |
+
this._requestHandlers = new Map();
|
| 22 |
+
this._requestHandlerAbortControllers = new Map();
|
| 23 |
+
this._notificationHandlers = new Map();
|
| 24 |
+
this._responseHandlers = new Map();
|
| 25 |
+
this._progressHandlers = new Map();
|
| 26 |
+
this._timeoutInfo = new Map();
|
| 27 |
+
this._pendingDebouncedNotifications = new Set();
|
| 28 |
+
// Maps task IDs to progress tokens to keep handlers alive after CreateTaskResult
|
| 29 |
+
this._taskProgressTokens = new Map();
|
| 30 |
+
this._requestResolvers = new Map();
|
| 31 |
+
this.setNotificationHandler(types_js_1.CancelledNotificationSchema, notification => {
|
| 32 |
+
this._oncancel(notification);
|
| 33 |
+
});
|
| 34 |
+
this.setNotificationHandler(types_js_1.ProgressNotificationSchema, notification => {
|
| 35 |
+
this._onprogress(notification);
|
| 36 |
+
});
|
| 37 |
+
this.setRequestHandler(types_js_1.PingRequestSchema,
|
| 38 |
+
// Automatic pong by default.
|
| 39 |
+
_request => ({}));
|
| 40 |
+
// Install task handlers if TaskStore is provided
|
| 41 |
+
this._taskStore = _options?.taskStore;
|
| 42 |
+
this._taskMessageQueue = _options?.taskMessageQueue;
|
| 43 |
+
if (this._taskStore) {
|
| 44 |
+
this.setRequestHandler(types_js_1.GetTaskRequestSchema, async (request, extra) => {
|
| 45 |
+
const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
| 46 |
+
if (!task) {
|
| 47 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, 'Failed to retrieve task: Task not found');
|
| 48 |
+
}
|
| 49 |
+
// Per spec: tasks/get responses SHALL NOT include related-task metadata
|
| 50 |
+
// as the taskId parameter is the source of truth
|
| 51 |
+
// @ts-expect-error SendResultT cannot contain GetTaskResult, but we include it in our derived types everywhere else
|
| 52 |
+
return {
|
| 53 |
+
...task
|
| 54 |
+
};
|
| 55 |
+
});
|
| 56 |
+
this.setRequestHandler(types_js_1.GetTaskPayloadRequestSchema, async (request, extra) => {
|
| 57 |
+
const handleTaskResult = async () => {
|
| 58 |
+
const taskId = request.params.taskId;
|
| 59 |
+
// Deliver queued messages
|
| 60 |
+
if (this._taskMessageQueue) {
|
| 61 |
+
let queuedMessage;
|
| 62 |
+
while ((queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId))) {
|
| 63 |
+
// Handle response and error messages by routing them to the appropriate resolver
|
| 64 |
+
if (queuedMessage.type === 'response' || queuedMessage.type === 'error') {
|
| 65 |
+
const message = queuedMessage.message;
|
| 66 |
+
const requestId = message.id;
|
| 67 |
+
// Lookup resolver in _requestResolvers map
|
| 68 |
+
const resolver = this._requestResolvers.get(requestId);
|
| 69 |
+
if (resolver) {
|
| 70 |
+
// Remove resolver from map after invocation
|
| 71 |
+
this._requestResolvers.delete(requestId);
|
| 72 |
+
// Invoke resolver with response or error
|
| 73 |
+
if (queuedMessage.type === 'response') {
|
| 74 |
+
resolver(message);
|
| 75 |
+
}
|
| 76 |
+
else {
|
| 77 |
+
// Convert JSONRPCError to McpError
|
| 78 |
+
const errorMessage = message;
|
| 79 |
+
const error = new types_js_1.McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data);
|
| 80 |
+
resolver(error);
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
else {
|
| 84 |
+
// Handle missing resolver gracefully with error logging
|
| 85 |
+
const messageType = queuedMessage.type === 'response' ? 'Response' : 'Error';
|
| 86 |
+
this._onerror(new Error(`${messageType} handler missing for request ${requestId}`));
|
| 87 |
+
}
|
| 88 |
+
// Continue to next message
|
| 89 |
+
continue;
|
| 90 |
+
}
|
| 91 |
+
// Send the message on the response stream by passing the relatedRequestId
|
| 92 |
+
// This tells the transport to write the message to the tasks/result response stream
|
| 93 |
+
await this._transport?.send(queuedMessage.message, { relatedRequestId: extra.requestId });
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
// Now check task status
|
| 97 |
+
const task = await this._taskStore.getTask(taskId, extra.sessionId);
|
| 98 |
+
if (!task) {
|
| 99 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
| 100 |
+
}
|
| 101 |
+
// Block if task is not terminal (we've already delivered all queued messages above)
|
| 102 |
+
if (!(0, interfaces_js_1.isTerminal)(task.status)) {
|
| 103 |
+
// Wait for status change or new messages
|
| 104 |
+
await this._waitForTaskUpdate(taskId, extra.signal);
|
| 105 |
+
// After waking up, recursively call to deliver any new messages or result
|
| 106 |
+
return await handleTaskResult();
|
| 107 |
+
}
|
| 108 |
+
// If task is terminal, return the result
|
| 109 |
+
if ((0, interfaces_js_1.isTerminal)(task.status)) {
|
| 110 |
+
const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
|
| 111 |
+
this._clearTaskQueue(taskId);
|
| 112 |
+
return {
|
| 113 |
+
...result,
|
| 114 |
+
_meta: {
|
| 115 |
+
...result._meta,
|
| 116 |
+
[types_js_1.RELATED_TASK_META_KEY]: {
|
| 117 |
+
taskId: taskId
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
};
|
| 121 |
+
}
|
| 122 |
+
return await handleTaskResult();
|
| 123 |
+
};
|
| 124 |
+
return await handleTaskResult();
|
| 125 |
+
});
|
| 126 |
+
this.setRequestHandler(types_js_1.ListTasksRequestSchema, async (request, extra) => {
|
| 127 |
+
try {
|
| 128 |
+
const { tasks, nextCursor } = await this._taskStore.listTasks(request.params?.cursor, extra.sessionId);
|
| 129 |
+
// @ts-expect-error SendResultT cannot contain ListTasksResult, but we include it in our derived types everywhere else
|
| 130 |
+
return {
|
| 131 |
+
tasks,
|
| 132 |
+
nextCursor,
|
| 133 |
+
_meta: {}
|
| 134 |
+
};
|
| 135 |
+
}
|
| 136 |
+
catch (error) {
|
| 137 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Failed to list tasks: ${error instanceof Error ? error.message : String(error)}`);
|
| 138 |
+
}
|
| 139 |
+
});
|
| 140 |
+
this.setRequestHandler(types_js_1.CancelTaskRequestSchema, async (request, extra) => {
|
| 141 |
+
try {
|
| 142 |
+
// Get the current task to check if it's in a terminal state, in case the implementation is not atomic
|
| 143 |
+
const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
| 144 |
+
if (!task) {
|
| 145 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Task not found: ${request.params.taskId}`);
|
| 146 |
+
}
|
| 147 |
+
// Reject cancellation of terminal tasks
|
| 148 |
+
if ((0, interfaces_js_1.isTerminal)(task.status)) {
|
| 149 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
|
| 150 |
+
}
|
| 151 |
+
await this._taskStore.updateTaskStatus(request.params.taskId, 'cancelled', 'Client cancelled task execution.', extra.sessionId);
|
| 152 |
+
this._clearTaskQueue(request.params.taskId);
|
| 153 |
+
const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
| 154 |
+
if (!cancelledTask) {
|
| 155 |
+
// Task was deleted during cancellation (e.g., cleanup happened)
|
| 156 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
|
| 157 |
+
}
|
| 158 |
+
return {
|
| 159 |
+
_meta: {},
|
| 160 |
+
...cancelledTask
|
| 161 |
+
};
|
| 162 |
+
}
|
| 163 |
+
catch (error) {
|
| 164 |
+
// Re-throw McpError as-is
|
| 165 |
+
if (error instanceof types_js_1.McpError) {
|
| 166 |
+
throw error;
|
| 167 |
+
}
|
| 168 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, `Failed to cancel task: ${error instanceof Error ? error.message : String(error)}`);
|
| 169 |
+
}
|
| 170 |
+
});
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
async _oncancel(notification) {
|
| 174 |
+
if (!notification.params.requestId) {
|
| 175 |
+
return;
|
| 176 |
+
}
|
| 177 |
+
// Handle request cancellation
|
| 178 |
+
const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
|
| 179 |
+
controller?.abort(notification.params.reason);
|
| 180 |
+
}
|
| 181 |
+
_setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
|
| 182 |
+
this._timeoutInfo.set(messageId, {
|
| 183 |
+
timeoutId: setTimeout(onTimeout, timeout),
|
| 184 |
+
startTime: Date.now(),
|
| 185 |
+
timeout,
|
| 186 |
+
maxTotalTimeout,
|
| 187 |
+
resetTimeoutOnProgress,
|
| 188 |
+
onTimeout
|
| 189 |
+
});
|
| 190 |
+
}
|
| 191 |
+
_resetTimeout(messageId) {
|
| 192 |
+
const info = this._timeoutInfo.get(messageId);
|
| 193 |
+
if (!info)
|
| 194 |
+
return false;
|
| 195 |
+
const totalElapsed = Date.now() - info.startTime;
|
| 196 |
+
if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {
|
| 197 |
+
this._timeoutInfo.delete(messageId);
|
| 198 |
+
throw types_js_1.McpError.fromError(types_js_1.ErrorCode.RequestTimeout, 'Maximum total timeout exceeded', {
|
| 199 |
+
maxTotalTimeout: info.maxTotalTimeout,
|
| 200 |
+
totalElapsed
|
| 201 |
+
});
|
| 202 |
+
}
|
| 203 |
+
clearTimeout(info.timeoutId);
|
| 204 |
+
info.timeoutId = setTimeout(info.onTimeout, info.timeout);
|
| 205 |
+
return true;
|
| 206 |
+
}
|
| 207 |
+
_cleanupTimeout(messageId) {
|
| 208 |
+
const info = this._timeoutInfo.get(messageId);
|
| 209 |
+
if (info) {
|
| 210 |
+
clearTimeout(info.timeoutId);
|
| 211 |
+
this._timeoutInfo.delete(messageId);
|
| 212 |
+
}
|
| 213 |
+
}
|
| 214 |
+
/**
|
| 215 |
+
* Attaches to the given transport, starts it, and starts listening for messages.
|
| 216 |
+
*
|
| 217 |
+
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
| 218 |
+
*/
|
| 219 |
+
async connect(transport) {
|
| 220 |
+
if (this._transport) {
|
| 221 |
+
throw new Error('Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.');
|
| 222 |
+
}
|
| 223 |
+
this._transport = transport;
|
| 224 |
+
const _onclose = this.transport?.onclose;
|
| 225 |
+
this._transport.onclose = () => {
|
| 226 |
+
_onclose?.();
|
| 227 |
+
this._onclose();
|
| 228 |
+
};
|
| 229 |
+
const _onerror = this.transport?.onerror;
|
| 230 |
+
this._transport.onerror = (error) => {
|
| 231 |
+
_onerror?.(error);
|
| 232 |
+
this._onerror(error);
|
| 233 |
+
};
|
| 234 |
+
const _onmessage = this._transport?.onmessage;
|
| 235 |
+
this._transport.onmessage = (message, extra) => {
|
| 236 |
+
_onmessage?.(message, extra);
|
| 237 |
+
if ((0, types_js_1.isJSONRPCResultResponse)(message) || (0, types_js_1.isJSONRPCErrorResponse)(message)) {
|
| 238 |
+
this._onresponse(message);
|
| 239 |
+
}
|
| 240 |
+
else if ((0, types_js_1.isJSONRPCRequest)(message)) {
|
| 241 |
+
this._onrequest(message, extra);
|
| 242 |
+
}
|
| 243 |
+
else if ((0, types_js_1.isJSONRPCNotification)(message)) {
|
| 244 |
+
this._onnotification(message);
|
| 245 |
+
}
|
| 246 |
+
else {
|
| 247 |
+
this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));
|
| 248 |
+
}
|
| 249 |
+
};
|
| 250 |
+
await this._transport.start();
|
| 251 |
+
}
|
| 252 |
+
_onclose() {
|
| 253 |
+
const responseHandlers = this._responseHandlers;
|
| 254 |
+
this._responseHandlers = new Map();
|
| 255 |
+
this._progressHandlers.clear();
|
| 256 |
+
this._taskProgressTokens.clear();
|
| 257 |
+
this._pendingDebouncedNotifications.clear();
|
| 258 |
+
for (const info of this._timeoutInfo.values()) {
|
| 259 |
+
clearTimeout(info.timeoutId);
|
| 260 |
+
}
|
| 261 |
+
this._timeoutInfo.clear();
|
| 262 |
+
// Abort all in-flight request handlers so they stop sending messages
|
| 263 |
+
for (const controller of this._requestHandlerAbortControllers.values()) {
|
| 264 |
+
controller.abort();
|
| 265 |
+
}
|
| 266 |
+
this._requestHandlerAbortControllers.clear();
|
| 267 |
+
const error = types_js_1.McpError.fromError(types_js_1.ErrorCode.ConnectionClosed, 'Connection closed');
|
| 268 |
+
this._transport = undefined;
|
| 269 |
+
this.onclose?.();
|
| 270 |
+
for (const handler of responseHandlers.values()) {
|
| 271 |
+
handler(error);
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
_onerror(error) {
|
| 275 |
+
this.onerror?.(error);
|
| 276 |
+
}
|
| 277 |
+
_onnotification(notification) {
|
| 278 |
+
const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler;
|
| 279 |
+
// Ignore notifications not being subscribed to.
|
| 280 |
+
if (handler === undefined) {
|
| 281 |
+
return;
|
| 282 |
+
}
|
| 283 |
+
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
| 284 |
+
Promise.resolve()
|
| 285 |
+
.then(() => handler(notification))
|
| 286 |
+
.catch(error => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
|
| 287 |
+
}
|
| 288 |
+
_onrequest(request, extra) {
|
| 289 |
+
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
| 290 |
+
// Capture the current transport at request time to ensure responses go to the correct client
|
| 291 |
+
const capturedTransport = this._transport;
|
| 292 |
+
// Extract taskId from request metadata if present (needed early for method not found case)
|
| 293 |
+
const relatedTaskId = request.params?._meta?.[types_js_1.RELATED_TASK_META_KEY]?.taskId;
|
| 294 |
+
if (handler === undefined) {
|
| 295 |
+
const errorResponse = {
|
| 296 |
+
jsonrpc: '2.0',
|
| 297 |
+
id: request.id,
|
| 298 |
+
error: {
|
| 299 |
+
code: types_js_1.ErrorCode.MethodNotFound,
|
| 300 |
+
message: 'Method not found'
|
| 301 |
+
}
|
| 302 |
+
};
|
| 303 |
+
// Queue or send the error response based on whether this is a task-related request
|
| 304 |
+
if (relatedTaskId && this._taskMessageQueue) {
|
| 305 |
+
this._enqueueTaskMessage(relatedTaskId, {
|
| 306 |
+
type: 'error',
|
| 307 |
+
message: errorResponse,
|
| 308 |
+
timestamp: Date.now()
|
| 309 |
+
}, capturedTransport?.sessionId).catch(error => this._onerror(new Error(`Failed to enqueue error response: ${error}`)));
|
| 310 |
+
}
|
| 311 |
+
else {
|
| 312 |
+
capturedTransport
|
| 313 |
+
?.send(errorResponse)
|
| 314 |
+
.catch(error => this._onerror(new Error(`Failed to send an error response: ${error}`)));
|
| 315 |
+
}
|
| 316 |
+
return;
|
| 317 |
+
}
|
| 318 |
+
const abortController = new AbortController();
|
| 319 |
+
this._requestHandlerAbortControllers.set(request.id, abortController);
|
| 320 |
+
const taskCreationParams = (0, types_js_1.isTaskAugmentedRequestParams)(request.params) ? request.params.task : undefined;
|
| 321 |
+
const taskStore = this._taskStore ? this.requestTaskStore(request, capturedTransport?.sessionId) : undefined;
|
| 322 |
+
const fullExtra = {
|
| 323 |
+
signal: abortController.signal,
|
| 324 |
+
sessionId: capturedTransport?.sessionId,
|
| 325 |
+
_meta: request.params?._meta,
|
| 326 |
+
sendNotification: async (notification) => {
|
| 327 |
+
if (abortController.signal.aborted)
|
| 328 |
+
return;
|
| 329 |
+
// Include related-task metadata if this request is part of a task
|
| 330 |
+
const notificationOptions = { relatedRequestId: request.id };
|
| 331 |
+
if (relatedTaskId) {
|
| 332 |
+
notificationOptions.relatedTask = { taskId: relatedTaskId };
|
| 333 |
+
}
|
| 334 |
+
await this.notification(notification, notificationOptions);
|
| 335 |
+
},
|
| 336 |
+
sendRequest: async (r, resultSchema, options) => {
|
| 337 |
+
if (abortController.signal.aborted) {
|
| 338 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.ConnectionClosed, 'Request was cancelled');
|
| 339 |
+
}
|
| 340 |
+
// Include related-task metadata if this request is part of a task
|
| 341 |
+
const requestOptions = { ...options, relatedRequestId: request.id };
|
| 342 |
+
if (relatedTaskId && !requestOptions.relatedTask) {
|
| 343 |
+
requestOptions.relatedTask = { taskId: relatedTaskId };
|
| 344 |
+
}
|
| 345 |
+
// Set task status to input_required when sending a request within a task context
|
| 346 |
+
// Use the taskId from options (explicit) or fall back to relatedTaskId (inherited)
|
| 347 |
+
const effectiveTaskId = requestOptions.relatedTask?.taskId ?? relatedTaskId;
|
| 348 |
+
if (effectiveTaskId && taskStore) {
|
| 349 |
+
await taskStore.updateTaskStatus(effectiveTaskId, 'input_required');
|
| 350 |
+
}
|
| 351 |
+
return await this.request(r, resultSchema, requestOptions);
|
| 352 |
+
},
|
| 353 |
+
authInfo: extra?.authInfo,
|
| 354 |
+
requestId: request.id,
|
| 355 |
+
requestInfo: extra?.requestInfo,
|
| 356 |
+
taskId: relatedTaskId,
|
| 357 |
+
taskStore: taskStore,
|
| 358 |
+
taskRequestedTtl: taskCreationParams?.ttl,
|
| 359 |
+
closeSSEStream: extra?.closeSSEStream,
|
| 360 |
+
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
| 361 |
+
};
|
| 362 |
+
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
| 363 |
+
Promise.resolve()
|
| 364 |
+
.then(() => {
|
| 365 |
+
// If this request asked for task creation, check capability first
|
| 366 |
+
if (taskCreationParams) {
|
| 367 |
+
// Check if the request method supports task creation
|
| 368 |
+
this.assertTaskHandlerCapability(request.method);
|
| 369 |
+
}
|
| 370 |
+
})
|
| 371 |
+
.then(() => handler(request, fullExtra))
|
| 372 |
+
.then(async (result) => {
|
| 373 |
+
if (abortController.signal.aborted) {
|
| 374 |
+
// Request was cancelled
|
| 375 |
+
return;
|
| 376 |
+
}
|
| 377 |
+
const response = {
|
| 378 |
+
result,
|
| 379 |
+
jsonrpc: '2.0',
|
| 380 |
+
id: request.id
|
| 381 |
+
};
|
| 382 |
+
// Queue or send the response based on whether this is a task-related request
|
| 383 |
+
if (relatedTaskId && this._taskMessageQueue) {
|
| 384 |
+
await this._enqueueTaskMessage(relatedTaskId, {
|
| 385 |
+
type: 'response',
|
| 386 |
+
message: response,
|
| 387 |
+
timestamp: Date.now()
|
| 388 |
+
}, capturedTransport?.sessionId);
|
| 389 |
+
}
|
| 390 |
+
else {
|
| 391 |
+
await capturedTransport?.send(response);
|
| 392 |
+
}
|
| 393 |
+
}, async (error) => {
|
| 394 |
+
if (abortController.signal.aborted) {
|
| 395 |
+
// Request was cancelled
|
| 396 |
+
return;
|
| 397 |
+
}
|
| 398 |
+
const errorResponse = {
|
| 399 |
+
jsonrpc: '2.0',
|
| 400 |
+
id: request.id,
|
| 401 |
+
error: {
|
| 402 |
+
code: Number.isSafeInteger(error['code']) ? error['code'] : types_js_1.ErrorCode.InternalError,
|
| 403 |
+
message: error.message ?? 'Internal error',
|
| 404 |
+
...(error['data'] !== undefined && { data: error['data'] })
|
| 405 |
+
}
|
| 406 |
+
};
|
| 407 |
+
// Queue or send the error response based on whether this is a task-related request
|
| 408 |
+
if (relatedTaskId && this._taskMessageQueue) {
|
| 409 |
+
await this._enqueueTaskMessage(relatedTaskId, {
|
| 410 |
+
type: 'error',
|
| 411 |
+
message: errorResponse,
|
| 412 |
+
timestamp: Date.now()
|
| 413 |
+
}, capturedTransport?.sessionId);
|
| 414 |
+
}
|
| 415 |
+
else {
|
| 416 |
+
await capturedTransport?.send(errorResponse);
|
| 417 |
+
}
|
| 418 |
+
})
|
| 419 |
+
.catch(error => this._onerror(new Error(`Failed to send response: ${error}`)))
|
| 420 |
+
.finally(() => {
|
| 421 |
+
// Only delete if the stored controller is still ours; after close()+connect(),
|
| 422 |
+
// a new connection may have reused the same request ID with a different controller.
|
| 423 |
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
| 424 |
+
this._requestHandlerAbortControllers.delete(request.id);
|
| 425 |
+
}
|
| 426 |
+
});
|
| 427 |
+
}
|
| 428 |
+
_onprogress(notification) {
|
| 429 |
+
const { progressToken, ...params } = notification.params;
|
| 430 |
+
const messageId = Number(progressToken);
|
| 431 |
+
const handler = this._progressHandlers.get(messageId);
|
| 432 |
+
if (!handler) {
|
| 433 |
+
this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));
|
| 434 |
+
return;
|
| 435 |
+
}
|
| 436 |
+
const responseHandler = this._responseHandlers.get(messageId);
|
| 437 |
+
const timeoutInfo = this._timeoutInfo.get(messageId);
|
| 438 |
+
if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {
|
| 439 |
+
try {
|
| 440 |
+
this._resetTimeout(messageId);
|
| 441 |
+
}
|
| 442 |
+
catch (error) {
|
| 443 |
+
// Clean up if maxTotalTimeout was exceeded
|
| 444 |
+
this._responseHandlers.delete(messageId);
|
| 445 |
+
this._progressHandlers.delete(messageId);
|
| 446 |
+
this._cleanupTimeout(messageId);
|
| 447 |
+
responseHandler(error);
|
| 448 |
+
return;
|
| 449 |
+
}
|
| 450 |
+
}
|
| 451 |
+
handler(params);
|
| 452 |
+
}
|
| 453 |
+
_onresponse(response) {
|
| 454 |
+
const messageId = Number(response.id);
|
| 455 |
+
// Check if this is a response to a queued request
|
| 456 |
+
const resolver = this._requestResolvers.get(messageId);
|
| 457 |
+
if (resolver) {
|
| 458 |
+
this._requestResolvers.delete(messageId);
|
| 459 |
+
if ((0, types_js_1.isJSONRPCResultResponse)(response)) {
|
| 460 |
+
resolver(response);
|
| 461 |
+
}
|
| 462 |
+
else {
|
| 463 |
+
const error = new types_js_1.McpError(response.error.code, response.error.message, response.error.data);
|
| 464 |
+
resolver(error);
|
| 465 |
+
}
|
| 466 |
+
return;
|
| 467 |
+
}
|
| 468 |
+
const handler = this._responseHandlers.get(messageId);
|
| 469 |
+
if (handler === undefined) {
|
| 470 |
+
this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));
|
| 471 |
+
return;
|
| 472 |
+
}
|
| 473 |
+
this._responseHandlers.delete(messageId);
|
| 474 |
+
this._cleanupTimeout(messageId);
|
| 475 |
+
// Keep progress handler alive for CreateTaskResult responses
|
| 476 |
+
let isTaskResponse = false;
|
| 477 |
+
if ((0, types_js_1.isJSONRPCResultResponse)(response) && response.result && typeof response.result === 'object') {
|
| 478 |
+
const result = response.result;
|
| 479 |
+
if (result.task && typeof result.task === 'object') {
|
| 480 |
+
const task = result.task;
|
| 481 |
+
if (typeof task.taskId === 'string') {
|
| 482 |
+
isTaskResponse = true;
|
| 483 |
+
this._taskProgressTokens.set(task.taskId, messageId);
|
| 484 |
+
}
|
| 485 |
+
}
|
| 486 |
+
}
|
| 487 |
+
if (!isTaskResponse) {
|
| 488 |
+
this._progressHandlers.delete(messageId);
|
| 489 |
+
}
|
| 490 |
+
if ((0, types_js_1.isJSONRPCResultResponse)(response)) {
|
| 491 |
+
handler(response);
|
| 492 |
+
}
|
| 493 |
+
else {
|
| 494 |
+
const error = types_js_1.McpError.fromError(response.error.code, response.error.message, response.error.data);
|
| 495 |
+
handler(error);
|
| 496 |
+
}
|
| 497 |
+
}
|
| 498 |
+
get transport() {
|
| 499 |
+
return this._transport;
|
| 500 |
+
}
|
| 501 |
+
/**
|
| 502 |
+
* Closes the connection.
|
| 503 |
+
*/
|
| 504 |
+
async close() {
|
| 505 |
+
await this._transport?.close();
|
| 506 |
+
}
|
| 507 |
+
/**
|
| 508 |
+
* Sends a request and returns an AsyncGenerator that yields response messages.
|
| 509 |
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
| 510 |
+
*
|
| 511 |
+
* @example
|
| 512 |
+
* ```typescript
|
| 513 |
+
* const stream = protocol.requestStream(request, resultSchema, options);
|
| 514 |
+
* for await (const message of stream) {
|
| 515 |
+
* switch (message.type) {
|
| 516 |
+
* case 'taskCreated':
|
| 517 |
+
* console.log('Task created:', message.task.taskId);
|
| 518 |
+
* break;
|
| 519 |
+
* case 'taskStatus':
|
| 520 |
+
* console.log('Task status:', message.task.status);
|
| 521 |
+
* break;
|
| 522 |
+
* case 'result':
|
| 523 |
+
* console.log('Final result:', message.result);
|
| 524 |
+
* break;
|
| 525 |
+
* case 'error':
|
| 526 |
+
* console.error('Error:', message.error);
|
| 527 |
+
* break;
|
| 528 |
+
* }
|
| 529 |
+
* }
|
| 530 |
+
* ```
|
| 531 |
+
*
|
| 532 |
+
* @experimental Use `client.experimental.tasks.requestStream()` to access this method.
|
| 533 |
+
*/
|
| 534 |
+
async *requestStream(request, resultSchema, options) {
|
| 535 |
+
const { task } = options ?? {};
|
| 536 |
+
// For non-task requests, just yield the result
|
| 537 |
+
if (!task) {
|
| 538 |
+
try {
|
| 539 |
+
const result = await this.request(request, resultSchema, options);
|
| 540 |
+
yield { type: 'result', result };
|
| 541 |
+
}
|
| 542 |
+
catch (error) {
|
| 543 |
+
yield {
|
| 544 |
+
type: 'error',
|
| 545 |
+
error: error instanceof types_js_1.McpError ? error : new types_js_1.McpError(types_js_1.ErrorCode.InternalError, String(error))
|
| 546 |
+
};
|
| 547 |
+
}
|
| 548 |
+
return;
|
| 549 |
+
}
|
| 550 |
+
// For task-augmented requests, we need to poll for status
|
| 551 |
+
// First, make the request to create the task
|
| 552 |
+
let taskId;
|
| 553 |
+
try {
|
| 554 |
+
// Send the request and get the CreateTaskResult
|
| 555 |
+
const createResult = await this.request(request, types_js_1.CreateTaskResultSchema, options);
|
| 556 |
+
// Extract taskId from the result
|
| 557 |
+
if (createResult.task) {
|
| 558 |
+
taskId = createResult.task.taskId;
|
| 559 |
+
yield { type: 'taskCreated', task: createResult.task };
|
| 560 |
+
}
|
| 561 |
+
else {
|
| 562 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, 'Task creation did not return a task');
|
| 563 |
+
}
|
| 564 |
+
// Poll for task completion
|
| 565 |
+
while (true) {
|
| 566 |
+
// Get current task status
|
| 567 |
+
const task = await this.getTask({ taskId }, options);
|
| 568 |
+
yield { type: 'taskStatus', task };
|
| 569 |
+
// Check if task is terminal
|
| 570 |
+
if ((0, interfaces_js_1.isTerminal)(task.status)) {
|
| 571 |
+
if (task.status === 'completed') {
|
| 572 |
+
// Get the final result
|
| 573 |
+
const result = await this.getTaskResult({ taskId }, resultSchema, options);
|
| 574 |
+
yield { type: 'result', result };
|
| 575 |
+
}
|
| 576 |
+
else if (task.status === 'failed') {
|
| 577 |
+
yield {
|
| 578 |
+
type: 'error',
|
| 579 |
+
error: new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Task ${taskId} failed`)
|
| 580 |
+
};
|
| 581 |
+
}
|
| 582 |
+
else if (task.status === 'cancelled') {
|
| 583 |
+
yield {
|
| 584 |
+
type: 'error',
|
| 585 |
+
error: new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Task ${taskId} was cancelled`)
|
| 586 |
+
};
|
| 587 |
+
}
|
| 588 |
+
return;
|
| 589 |
+
}
|
| 590 |
+
// When input_required, call tasks/result to deliver queued messages
|
| 591 |
+
// (elicitation, sampling) via SSE and block until terminal
|
| 592 |
+
if (task.status === 'input_required') {
|
| 593 |
+
const result = await this.getTaskResult({ taskId }, resultSchema, options);
|
| 594 |
+
yield { type: 'result', result };
|
| 595 |
+
return;
|
| 596 |
+
}
|
| 597 |
+
// Wait before polling again
|
| 598 |
+
const pollInterval = task.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;
|
| 599 |
+
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
| 600 |
+
// Check if cancelled
|
| 601 |
+
options?.signal?.throwIfAborted();
|
| 602 |
+
}
|
| 603 |
+
}
|
| 604 |
+
catch (error) {
|
| 605 |
+
yield {
|
| 606 |
+
type: 'error',
|
| 607 |
+
error: error instanceof types_js_1.McpError ? error : new types_js_1.McpError(types_js_1.ErrorCode.InternalError, String(error))
|
| 608 |
+
};
|
| 609 |
+
}
|
| 610 |
+
}
|
| 611 |
+
/**
|
| 612 |
+
* Sends a request and waits for a response.
|
| 613 |
+
*
|
| 614 |
+
* Do not use this method to emit notifications! Use notification() instead.
|
| 615 |
+
*/
|
| 616 |
+
request(request, resultSchema, options) {
|
| 617 |
+
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
| 618 |
+
// Send the request
|
| 619 |
+
return new Promise((resolve, reject) => {
|
| 620 |
+
const earlyReject = (error) => {
|
| 621 |
+
reject(error);
|
| 622 |
+
};
|
| 623 |
+
if (!this._transport) {
|
| 624 |
+
earlyReject(new Error('Not connected'));
|
| 625 |
+
return;
|
| 626 |
+
}
|
| 627 |
+
if (this._options?.enforceStrictCapabilities === true) {
|
| 628 |
+
try {
|
| 629 |
+
this.assertCapabilityForMethod(request.method);
|
| 630 |
+
// If task creation is requested, also check task capabilities
|
| 631 |
+
if (task) {
|
| 632 |
+
this.assertTaskCapability(request.method);
|
| 633 |
+
}
|
| 634 |
+
}
|
| 635 |
+
catch (e) {
|
| 636 |
+
earlyReject(e);
|
| 637 |
+
return;
|
| 638 |
+
}
|
| 639 |
+
}
|
| 640 |
+
options?.signal?.throwIfAborted();
|
| 641 |
+
const messageId = this._requestMessageId++;
|
| 642 |
+
const jsonrpcRequest = {
|
| 643 |
+
...request,
|
| 644 |
+
jsonrpc: '2.0',
|
| 645 |
+
id: messageId
|
| 646 |
+
};
|
| 647 |
+
if (options?.onprogress) {
|
| 648 |
+
this._progressHandlers.set(messageId, options.onprogress);
|
| 649 |
+
jsonrpcRequest.params = {
|
| 650 |
+
...request.params,
|
| 651 |
+
_meta: {
|
| 652 |
+
...(request.params?._meta || {}),
|
| 653 |
+
progressToken: messageId
|
| 654 |
+
}
|
| 655 |
+
};
|
| 656 |
+
}
|
| 657 |
+
// Augment with task creation parameters if provided
|
| 658 |
+
if (task) {
|
| 659 |
+
jsonrpcRequest.params = {
|
| 660 |
+
...jsonrpcRequest.params,
|
| 661 |
+
task: task
|
| 662 |
+
};
|
| 663 |
+
}
|
| 664 |
+
// Augment with related task metadata if relatedTask is provided
|
| 665 |
+
if (relatedTask) {
|
| 666 |
+
jsonrpcRequest.params = {
|
| 667 |
+
...jsonrpcRequest.params,
|
| 668 |
+
_meta: {
|
| 669 |
+
...(jsonrpcRequest.params?._meta || {}),
|
| 670 |
+
[types_js_1.RELATED_TASK_META_KEY]: relatedTask
|
| 671 |
+
}
|
| 672 |
+
};
|
| 673 |
+
}
|
| 674 |
+
const cancel = (reason) => {
|
| 675 |
+
this._responseHandlers.delete(messageId);
|
| 676 |
+
this._progressHandlers.delete(messageId);
|
| 677 |
+
this._cleanupTimeout(messageId);
|
| 678 |
+
this._transport
|
| 679 |
+
?.send({
|
| 680 |
+
jsonrpc: '2.0',
|
| 681 |
+
method: 'notifications/cancelled',
|
| 682 |
+
params: {
|
| 683 |
+
requestId: messageId,
|
| 684 |
+
reason: String(reason)
|
| 685 |
+
}
|
| 686 |
+
}, { relatedRequestId, resumptionToken, onresumptiontoken })
|
| 687 |
+
.catch(error => this._onerror(new Error(`Failed to send cancellation: ${error}`)));
|
| 688 |
+
// Wrap the reason in an McpError if it isn't already
|
| 689 |
+
const error = reason instanceof types_js_1.McpError ? reason : new types_js_1.McpError(types_js_1.ErrorCode.RequestTimeout, String(reason));
|
| 690 |
+
reject(error);
|
| 691 |
+
};
|
| 692 |
+
this._responseHandlers.set(messageId, response => {
|
| 693 |
+
if (options?.signal?.aborted) {
|
| 694 |
+
return;
|
| 695 |
+
}
|
| 696 |
+
if (response instanceof Error) {
|
| 697 |
+
return reject(response);
|
| 698 |
+
}
|
| 699 |
+
try {
|
| 700 |
+
const parseResult = (0, zod_compat_js_1.safeParse)(resultSchema, response.result);
|
| 701 |
+
if (!parseResult.success) {
|
| 702 |
+
// Type guard: if success is false, error is guaranteed to exist
|
| 703 |
+
reject(parseResult.error);
|
| 704 |
+
}
|
| 705 |
+
else {
|
| 706 |
+
resolve(parseResult.data);
|
| 707 |
+
}
|
| 708 |
+
}
|
| 709 |
+
catch (error) {
|
| 710 |
+
reject(error);
|
| 711 |
+
}
|
| 712 |
+
});
|
| 713 |
+
options?.signal?.addEventListener('abort', () => {
|
| 714 |
+
cancel(options?.signal?.reason);
|
| 715 |
+
});
|
| 716 |
+
const timeout = options?.timeout ?? exports.DEFAULT_REQUEST_TIMEOUT_MSEC;
|
| 717 |
+
const timeoutHandler = () => cancel(types_js_1.McpError.fromError(types_js_1.ErrorCode.RequestTimeout, 'Request timed out', { timeout }));
|
| 718 |
+
this._setupTimeout(messageId, timeout, options?.maxTotalTimeout, timeoutHandler, options?.resetTimeoutOnProgress ?? false);
|
| 719 |
+
// Queue request if related to a task
|
| 720 |
+
const relatedTaskId = relatedTask?.taskId;
|
| 721 |
+
if (relatedTaskId) {
|
| 722 |
+
// Store the response resolver for this request so responses can be routed back
|
| 723 |
+
const responseResolver = (response) => {
|
| 724 |
+
const handler = this._responseHandlers.get(messageId);
|
| 725 |
+
if (handler) {
|
| 726 |
+
handler(response);
|
| 727 |
+
}
|
| 728 |
+
else {
|
| 729 |
+
// Log error when resolver is missing, but don't fail
|
| 730 |
+
this._onerror(new Error(`Response handler missing for side-channeled request ${messageId}`));
|
| 731 |
+
}
|
| 732 |
+
};
|
| 733 |
+
this._requestResolvers.set(messageId, responseResolver);
|
| 734 |
+
this._enqueueTaskMessage(relatedTaskId, {
|
| 735 |
+
type: 'request',
|
| 736 |
+
message: jsonrpcRequest,
|
| 737 |
+
timestamp: Date.now()
|
| 738 |
+
}).catch(error => {
|
| 739 |
+
this._cleanupTimeout(messageId);
|
| 740 |
+
reject(error);
|
| 741 |
+
});
|
| 742 |
+
// Don't send through transport - queued messages are delivered via tasks/result only
|
| 743 |
+
// This prevents duplicate delivery for bidirectional transports
|
| 744 |
+
}
|
| 745 |
+
else {
|
| 746 |
+
// No related task - send through transport normally
|
| 747 |
+
this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch(error => {
|
| 748 |
+
this._cleanupTimeout(messageId);
|
| 749 |
+
reject(error);
|
| 750 |
+
});
|
| 751 |
+
}
|
| 752 |
+
});
|
| 753 |
+
}
|
| 754 |
+
/**
|
| 755 |
+
* Gets the current status of a task.
|
| 756 |
+
*
|
| 757 |
+
* @experimental Use `client.experimental.tasks.getTask()` to access this method.
|
| 758 |
+
*/
|
| 759 |
+
async getTask(params, options) {
|
| 760 |
+
// @ts-expect-error SendRequestT cannot directly contain GetTaskRequest, but we ensure all type instantiations contain it anyways
|
| 761 |
+
return this.request({ method: 'tasks/get', params }, types_js_1.GetTaskResultSchema, options);
|
| 762 |
+
}
|
| 763 |
+
/**
|
| 764 |
+
* Retrieves the result of a completed task.
|
| 765 |
+
*
|
| 766 |
+
* @experimental Use `client.experimental.tasks.getTaskResult()` to access this method.
|
| 767 |
+
*/
|
| 768 |
+
async getTaskResult(params, resultSchema, options) {
|
| 769 |
+
// @ts-expect-error SendRequestT cannot directly contain GetTaskPayloadRequest, but we ensure all type instantiations contain it anyways
|
| 770 |
+
return this.request({ method: 'tasks/result', params }, resultSchema, options);
|
| 771 |
+
}
|
| 772 |
+
/**
|
| 773 |
+
* Lists tasks, optionally starting from a pagination cursor.
|
| 774 |
+
*
|
| 775 |
+
* @experimental Use `client.experimental.tasks.listTasks()` to access this method.
|
| 776 |
+
*/
|
| 777 |
+
async listTasks(params, options) {
|
| 778 |
+
// @ts-expect-error SendRequestT cannot directly contain ListTasksRequest, but we ensure all type instantiations contain it anyways
|
| 779 |
+
return this.request({ method: 'tasks/list', params }, types_js_1.ListTasksResultSchema, options);
|
| 780 |
+
}
|
| 781 |
+
/**
|
| 782 |
+
* Cancels a specific task.
|
| 783 |
+
*
|
| 784 |
+
* @experimental Use `client.experimental.tasks.cancelTask()` to access this method.
|
| 785 |
+
*/
|
| 786 |
+
async cancelTask(params, options) {
|
| 787 |
+
// @ts-expect-error SendRequestT cannot directly contain CancelTaskRequest, but we ensure all type instantiations contain it anyways
|
| 788 |
+
return this.request({ method: 'tasks/cancel', params }, types_js_1.CancelTaskResultSchema, options);
|
| 789 |
+
}
|
| 790 |
+
/**
|
| 791 |
+
* Emits a notification, which is a one-way message that does not expect a response.
|
| 792 |
+
*/
|
| 793 |
+
async notification(notification, options) {
|
| 794 |
+
if (!this._transport) {
|
| 795 |
+
throw new Error('Not connected');
|
| 796 |
+
}
|
| 797 |
+
this.assertNotificationCapability(notification.method);
|
| 798 |
+
// Queue notification if related to a task
|
| 799 |
+
const relatedTaskId = options?.relatedTask?.taskId;
|
| 800 |
+
if (relatedTaskId) {
|
| 801 |
+
// Build the JSONRPC notification with metadata
|
| 802 |
+
const jsonrpcNotification = {
|
| 803 |
+
...notification,
|
| 804 |
+
jsonrpc: '2.0',
|
| 805 |
+
params: {
|
| 806 |
+
...notification.params,
|
| 807 |
+
_meta: {
|
| 808 |
+
...(notification.params?._meta || {}),
|
| 809 |
+
[types_js_1.RELATED_TASK_META_KEY]: options.relatedTask
|
| 810 |
+
}
|
| 811 |
+
}
|
| 812 |
+
};
|
| 813 |
+
await this._enqueueTaskMessage(relatedTaskId, {
|
| 814 |
+
type: 'notification',
|
| 815 |
+
message: jsonrpcNotification,
|
| 816 |
+
timestamp: Date.now()
|
| 817 |
+
});
|
| 818 |
+
// Don't send through transport - queued messages are delivered via tasks/result only
|
| 819 |
+
// This prevents duplicate delivery for bidirectional transports
|
| 820 |
+
return;
|
| 821 |
+
}
|
| 822 |
+
const debouncedMethods = this._options?.debouncedNotificationMethods ?? [];
|
| 823 |
+
// A notification can only be debounced if it's in the list AND it's "simple"
|
| 824 |
+
// (i.e., has no parameters and no related request ID or related task that could be lost).
|
| 825 |
+
const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !options?.relatedRequestId && !options?.relatedTask;
|
| 826 |
+
if (canDebounce) {
|
| 827 |
+
// If a notification of this type is already scheduled, do nothing.
|
| 828 |
+
if (this._pendingDebouncedNotifications.has(notification.method)) {
|
| 829 |
+
return;
|
| 830 |
+
}
|
| 831 |
+
// Mark this notification type as pending.
|
| 832 |
+
this._pendingDebouncedNotifications.add(notification.method);
|
| 833 |
+
// Schedule the actual send to happen in the next microtask.
|
| 834 |
+
// This allows all synchronous calls in the current event loop tick to be coalesced.
|
| 835 |
+
Promise.resolve().then(() => {
|
| 836 |
+
// Un-mark the notification so the next one can be scheduled.
|
| 837 |
+
this._pendingDebouncedNotifications.delete(notification.method);
|
| 838 |
+
// SAFETY CHECK: If the connection was closed while this was pending, abort.
|
| 839 |
+
if (!this._transport) {
|
| 840 |
+
return;
|
| 841 |
+
}
|
| 842 |
+
let jsonrpcNotification = {
|
| 843 |
+
...notification,
|
| 844 |
+
jsonrpc: '2.0'
|
| 845 |
+
};
|
| 846 |
+
// Augment with related task metadata if relatedTask is provided
|
| 847 |
+
if (options?.relatedTask) {
|
| 848 |
+
jsonrpcNotification = {
|
| 849 |
+
...jsonrpcNotification,
|
| 850 |
+
params: {
|
| 851 |
+
...jsonrpcNotification.params,
|
| 852 |
+
_meta: {
|
| 853 |
+
...(jsonrpcNotification.params?._meta || {}),
|
| 854 |
+
[types_js_1.RELATED_TASK_META_KEY]: options.relatedTask
|
| 855 |
+
}
|
| 856 |
+
}
|
| 857 |
+
};
|
| 858 |
+
}
|
| 859 |
+
// Send the notification, but don't await it here to avoid blocking.
|
| 860 |
+
// Handle potential errors with a .catch().
|
| 861 |
+
this._transport?.send(jsonrpcNotification, options).catch(error => this._onerror(error));
|
| 862 |
+
});
|
| 863 |
+
// Return immediately.
|
| 864 |
+
return;
|
| 865 |
+
}
|
| 866 |
+
let jsonrpcNotification = {
|
| 867 |
+
...notification,
|
| 868 |
+
jsonrpc: '2.0'
|
| 869 |
+
};
|
| 870 |
+
// Augment with related task metadata if relatedTask is provided
|
| 871 |
+
if (options?.relatedTask) {
|
| 872 |
+
jsonrpcNotification = {
|
| 873 |
+
...jsonrpcNotification,
|
| 874 |
+
params: {
|
| 875 |
+
...jsonrpcNotification.params,
|
| 876 |
+
_meta: {
|
| 877 |
+
...(jsonrpcNotification.params?._meta || {}),
|
| 878 |
+
[types_js_1.RELATED_TASK_META_KEY]: options.relatedTask
|
| 879 |
+
}
|
| 880 |
+
}
|
| 881 |
+
};
|
| 882 |
+
}
|
| 883 |
+
await this._transport.send(jsonrpcNotification, options);
|
| 884 |
+
}
|
| 885 |
+
/**
|
| 886 |
+
* Registers a handler to invoke when this protocol object receives a request with the given method.
|
| 887 |
+
*
|
| 888 |
+
* Note that this will replace any previous request handler for the same method.
|
| 889 |
+
*/
|
| 890 |
+
setRequestHandler(requestSchema, handler) {
|
| 891 |
+
const method = (0, zod_json_schema_compat_js_1.getMethodLiteral)(requestSchema);
|
| 892 |
+
this.assertRequestHandlerCapability(method);
|
| 893 |
+
this._requestHandlers.set(method, (request, extra) => {
|
| 894 |
+
const parsed = (0, zod_json_schema_compat_js_1.parseWithCompat)(requestSchema, request);
|
| 895 |
+
return Promise.resolve(handler(parsed, extra));
|
| 896 |
+
});
|
| 897 |
+
}
|
| 898 |
+
/**
|
| 899 |
+
* Removes the request handler for the given method.
|
| 900 |
+
*/
|
| 901 |
+
removeRequestHandler(method) {
|
| 902 |
+
this._requestHandlers.delete(method);
|
| 903 |
+
}
|
| 904 |
+
/**
|
| 905 |
+
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
| 906 |
+
*/
|
| 907 |
+
assertCanSetRequestHandler(method) {
|
| 908 |
+
if (this._requestHandlers.has(method)) {
|
| 909 |
+
throw new Error(`A request handler for ${method} already exists, which would be overridden`);
|
| 910 |
+
}
|
| 911 |
+
}
|
| 912 |
+
/**
|
| 913 |
+
* Registers a handler to invoke when this protocol object receives a notification with the given method.
|
| 914 |
+
*
|
| 915 |
+
* Note that this will replace any previous notification handler for the same method.
|
| 916 |
+
*/
|
| 917 |
+
setNotificationHandler(notificationSchema, handler) {
|
| 918 |
+
const method = (0, zod_json_schema_compat_js_1.getMethodLiteral)(notificationSchema);
|
| 919 |
+
this._notificationHandlers.set(method, notification => {
|
| 920 |
+
const parsed = (0, zod_json_schema_compat_js_1.parseWithCompat)(notificationSchema, notification);
|
| 921 |
+
return Promise.resolve(handler(parsed));
|
| 922 |
+
});
|
| 923 |
+
}
|
| 924 |
+
/**
|
| 925 |
+
* Removes the notification handler for the given method.
|
| 926 |
+
*/
|
| 927 |
+
removeNotificationHandler(method) {
|
| 928 |
+
this._notificationHandlers.delete(method);
|
| 929 |
+
}
|
| 930 |
+
/**
|
| 931 |
+
* Cleans up the progress handler associated with a task.
|
| 932 |
+
* This should be called when a task reaches a terminal status.
|
| 933 |
+
*/
|
| 934 |
+
_cleanupTaskProgressHandler(taskId) {
|
| 935 |
+
const progressToken = this._taskProgressTokens.get(taskId);
|
| 936 |
+
if (progressToken !== undefined) {
|
| 937 |
+
this._progressHandlers.delete(progressToken);
|
| 938 |
+
this._taskProgressTokens.delete(taskId);
|
| 939 |
+
}
|
| 940 |
+
}
|
| 941 |
+
/**
|
| 942 |
+
* Enqueues a task-related message for side-channel delivery via tasks/result.
|
| 943 |
+
* @param taskId The task ID to associate the message with
|
| 944 |
+
* @param message The message to enqueue
|
| 945 |
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
| 946 |
+
* @throws Error if taskStore is not configured or if enqueue fails (e.g., queue overflow)
|
| 947 |
+
*
|
| 948 |
+
* Note: If enqueue fails, it's the TaskMessageQueue implementation's responsibility to handle
|
| 949 |
+
* the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer
|
| 950 |
+
* simply propagates the error.
|
| 951 |
+
*/
|
| 952 |
+
async _enqueueTaskMessage(taskId, message, sessionId) {
|
| 953 |
+
// Task message queues are only used when taskStore is configured
|
| 954 |
+
if (!this._taskStore || !this._taskMessageQueue) {
|
| 955 |
+
throw new Error('Cannot enqueue task message: taskStore and taskMessageQueue are not configured');
|
| 956 |
+
}
|
| 957 |
+
const maxQueueSize = this._options?.maxTaskQueueSize;
|
| 958 |
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
| 959 |
+
}
|
| 960 |
+
/**
|
| 961 |
+
* Clears the message queue for a task and rejects any pending request resolvers.
|
| 962 |
+
* @param taskId The task ID whose queue should be cleared
|
| 963 |
+
* @param sessionId Optional session ID for binding the operation to a specific session
|
| 964 |
+
*/
|
| 965 |
+
async _clearTaskQueue(taskId, sessionId) {
|
| 966 |
+
if (this._taskMessageQueue) {
|
| 967 |
+
// Reject any pending request resolvers
|
| 968 |
+
const messages = await this._taskMessageQueue.dequeueAll(taskId, sessionId);
|
| 969 |
+
for (const message of messages) {
|
| 970 |
+
if (message.type === 'request' && (0, types_js_1.isJSONRPCRequest)(message.message)) {
|
| 971 |
+
// Extract request ID from the message
|
| 972 |
+
const requestId = message.message.id;
|
| 973 |
+
const resolver = this._requestResolvers.get(requestId);
|
| 974 |
+
if (resolver) {
|
| 975 |
+
resolver(new types_js_1.McpError(types_js_1.ErrorCode.InternalError, 'Task cancelled or completed'));
|
| 976 |
+
this._requestResolvers.delete(requestId);
|
| 977 |
+
}
|
| 978 |
+
else {
|
| 979 |
+
// Log error when resolver is missing during cleanup for better observability
|
| 980 |
+
this._onerror(new Error(`Resolver missing for request ${requestId} during task ${taskId} cleanup`));
|
| 981 |
+
}
|
| 982 |
+
}
|
| 983 |
+
}
|
| 984 |
+
}
|
| 985 |
+
}
|
| 986 |
+
/**
|
| 987 |
+
* Waits for a task update (new messages or status change) with abort signal support.
|
| 988 |
+
* Uses polling to check for updates at the task's configured poll interval.
|
| 989 |
+
* @param taskId The task ID to wait for
|
| 990 |
+
* @param signal Abort signal to cancel the wait
|
| 991 |
+
* @returns Promise that resolves when an update occurs or rejects if aborted
|
| 992 |
+
*/
|
| 993 |
+
async _waitForTaskUpdate(taskId, signal) {
|
| 994 |
+
// Get the task's poll interval, falling back to default
|
| 995 |
+
let interval = this._options?.defaultTaskPollInterval ?? 1000;
|
| 996 |
+
try {
|
| 997 |
+
const task = await this._taskStore?.getTask(taskId);
|
| 998 |
+
if (task?.pollInterval) {
|
| 999 |
+
interval = task.pollInterval;
|
| 1000 |
+
}
|
| 1001 |
+
}
|
| 1002 |
+
catch {
|
| 1003 |
+
// Use default interval if task lookup fails
|
| 1004 |
+
}
|
| 1005 |
+
return new Promise((resolve, reject) => {
|
| 1006 |
+
if (signal.aborted) {
|
| 1007 |
+
reject(new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, 'Request cancelled'));
|
| 1008 |
+
return;
|
| 1009 |
+
}
|
| 1010 |
+
// Wait for the poll interval, then resolve so caller can check for updates
|
| 1011 |
+
const timeoutId = setTimeout(resolve, interval);
|
| 1012 |
+
// Clean up timeout and reject if aborted
|
| 1013 |
+
signal.addEventListener('abort', () => {
|
| 1014 |
+
clearTimeout(timeoutId);
|
| 1015 |
+
reject(new types_js_1.McpError(types_js_1.ErrorCode.InvalidRequest, 'Request cancelled'));
|
| 1016 |
+
}, { once: true });
|
| 1017 |
+
});
|
| 1018 |
+
}
|
| 1019 |
+
requestTaskStore(request, sessionId) {
|
| 1020 |
+
const taskStore = this._taskStore;
|
| 1021 |
+
if (!taskStore) {
|
| 1022 |
+
throw new Error('No task store configured');
|
| 1023 |
+
}
|
| 1024 |
+
return {
|
| 1025 |
+
createTask: async (taskParams) => {
|
| 1026 |
+
if (!request) {
|
| 1027 |
+
throw new Error('No request provided');
|
| 1028 |
+
}
|
| 1029 |
+
return await taskStore.createTask(taskParams, request.id, {
|
| 1030 |
+
method: request.method,
|
| 1031 |
+
params: request.params
|
| 1032 |
+
}, sessionId);
|
| 1033 |
+
},
|
| 1034 |
+
getTask: async (taskId) => {
|
| 1035 |
+
const task = await taskStore.getTask(taskId, sessionId);
|
| 1036 |
+
if (!task) {
|
| 1037 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, 'Failed to retrieve task: Task not found');
|
| 1038 |
+
}
|
| 1039 |
+
return task;
|
| 1040 |
+
},
|
| 1041 |
+
storeTaskResult: async (taskId, status, result) => {
|
| 1042 |
+
await taskStore.storeTaskResult(taskId, status, result, sessionId);
|
| 1043 |
+
// Get updated task state and send notification
|
| 1044 |
+
const task = await taskStore.getTask(taskId, sessionId);
|
| 1045 |
+
if (task) {
|
| 1046 |
+
const notification = types_js_1.TaskStatusNotificationSchema.parse({
|
| 1047 |
+
method: 'notifications/tasks/status',
|
| 1048 |
+
params: task
|
| 1049 |
+
});
|
| 1050 |
+
await this.notification(notification);
|
| 1051 |
+
if ((0, interfaces_js_1.isTerminal)(task.status)) {
|
| 1052 |
+
this._cleanupTaskProgressHandler(taskId);
|
| 1053 |
+
// Don't clear queue here - it will be cleared after delivery via tasks/result
|
| 1054 |
+
}
|
| 1055 |
+
}
|
| 1056 |
+
},
|
| 1057 |
+
getTaskResult: taskId => {
|
| 1058 |
+
return taskStore.getTaskResult(taskId, sessionId);
|
| 1059 |
+
},
|
| 1060 |
+
updateTaskStatus: async (taskId, status, statusMessage) => {
|
| 1061 |
+
// Check if task exists
|
| 1062 |
+
const task = await taskStore.getTask(taskId, sessionId);
|
| 1063 |
+
if (!task) {
|
| 1064 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Task "${taskId}" not found - it may have been cleaned up`);
|
| 1065 |
+
}
|
| 1066 |
+
// Don't allow transitions from terminal states
|
| 1067 |
+
if ((0, interfaces_js_1.isTerminal)(task.status)) {
|
| 1068 |
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Cannot update task "${taskId}" from terminal status "${task.status}" to "${status}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);
|
| 1069 |
+
}
|
| 1070 |
+
await taskStore.updateTaskStatus(taskId, status, statusMessage, sessionId);
|
| 1071 |
+
// Get updated task state and send notification
|
| 1072 |
+
const updatedTask = await taskStore.getTask(taskId, sessionId);
|
| 1073 |
+
if (updatedTask) {
|
| 1074 |
+
const notification = types_js_1.TaskStatusNotificationSchema.parse({
|
| 1075 |
+
method: 'notifications/tasks/status',
|
| 1076 |
+
params: updatedTask
|
| 1077 |
+
});
|
| 1078 |
+
await this.notification(notification);
|
| 1079 |
+
if ((0, interfaces_js_1.isTerminal)(updatedTask.status)) {
|
| 1080 |
+
this._cleanupTaskProgressHandler(taskId);
|
| 1081 |
+
// Don't clear queue here - it will be cleared after delivery via tasks/result
|
| 1082 |
+
}
|
| 1083 |
+
}
|
| 1084 |
+
},
|
| 1085 |
+
listTasks: cursor => {
|
| 1086 |
+
return taskStore.listTasks(cursor, sessionId);
|
| 1087 |
+
}
|
| 1088 |
+
};
|
| 1089 |
+
}
|
| 1090 |
+
}
|
| 1091 |
+
exports.Protocol = Protocol;
|
| 1092 |
+
function isPlainObject(value) {
|
| 1093 |
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
| 1094 |
+
}
|
| 1095 |
+
function mergeCapabilities(base, additional) {
|
| 1096 |
+
const result = { ...base };
|
| 1097 |
+
for (const key in additional) {
|
| 1098 |
+
const k = key;
|
| 1099 |
+
const addValue = additional[k];
|
| 1100 |
+
if (addValue === undefined)
|
| 1101 |
+
continue;
|
| 1102 |
+
const baseValue = result[k];
|
| 1103 |
+
if (isPlainObject(baseValue) && isPlainObject(addValue)) {
|
| 1104 |
+
result[k] = { ...baseValue, ...addValue };
|
| 1105 |
+
}
|
| 1106 |
+
else {
|
| 1107 |
+
result[k] = addValue;
|
| 1108 |
+
}
|
| 1109 |
+
}
|
| 1110 |
+
return result;
|
| 1111 |
+
}
|
| 1112 |
+
//# sourceMappingURL=protocol.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/shared/protocol.ts"],"names":[],"mappings":";;;AAmoDA,8CAcC;AAjpDD,2DAA8F;AAC9F,0CA6CqB;AAGrB,uEAAgI;AAChI,mFAAwF;AAoDxF;;GAEG;AACU,QAAA,4BAA4B,GAAG,KAAK,CAAC;AAkNlD;;;GAGG;AACH,MAAsB,QAAQ;IA8C1B,YAAoB,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;QA5CtC,sBAAiB,GAAG,CAAC,CAAC;QACtB,qBAAgB,GAGpB,IAAI,GAAG,EAAE,CAAC;QACN,oCAA+B,GAAoC,IAAI,GAAG,EAAE,CAAC;QAC7E,0BAAqB,GAAsE,IAAI,GAAG,EAAE,CAAC;QACrG,sBAAiB,GAAmE,IAAI,GAAG,EAAE,CAAC;QAC9F,sBAAiB,GAAkC,IAAI,GAAG,EAAE,CAAC;QAC7D,iBAAY,GAA6B,IAAI,GAAG,EAAE,CAAC;QACnD,mCAA8B,GAAG,IAAI,GAAG,EAAU,CAAC;QAE3D,iFAAiF;QACzE,wBAAmB,GAAwB,IAAI,GAAG,EAAE,CAAC;QAKrD,sBAAiB,GAAsE,IAAI,GAAG,EAAE,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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Result, Task, McpError } from '../types.js';
|
| 2 |
+
/**
|
| 3 |
+
* Base message type
|
| 4 |
+
*/
|
| 5 |
+
export interface BaseResponseMessage {
|
| 6 |
+
type: string;
|
| 7 |
+
}
|
| 8 |
+
/**
|
| 9 |
+
* Task status update message
|
| 10 |
+
*/
|
| 11 |
+
export interface TaskStatusMessage extends BaseResponseMessage {
|
| 12 |
+
type: 'taskStatus';
|
| 13 |
+
task: Task;
|
| 14 |
+
}
|
| 15 |
+
/**
|
| 16 |
+
* Task created message (first message for task-augmented requests)
|
| 17 |
+
*/
|
| 18 |
+
export interface TaskCreatedMessage extends BaseResponseMessage {
|
| 19 |
+
type: 'taskCreated';
|
| 20 |
+
task: Task;
|
| 21 |
+
}
|
| 22 |
+
/**
|
| 23 |
+
* Final result message (terminal)
|
| 24 |
+
*/
|
| 25 |
+
export interface ResultMessage<T extends Result> extends BaseResponseMessage {
|
| 26 |
+
type: 'result';
|
| 27 |
+
result: T;
|
| 28 |
+
}
|
| 29 |
+
/**
|
| 30 |
+
* Error message (terminal)
|
| 31 |
+
*/
|
| 32 |
+
export interface ErrorMessage extends BaseResponseMessage {
|
| 33 |
+
type: 'error';
|
| 34 |
+
error: McpError;
|
| 35 |
+
}
|
| 36 |
+
/**
|
| 37 |
+
* Union type representing all possible messages that can be yielded during request processing.
|
| 38 |
+
* Note: Progress notifications are handled through the existing onprogress callback mechanism.
|
| 39 |
+
* Side-channeled messages (server requests/notifications) are handled through registered handlers.
|
| 40 |
+
*/
|
| 41 |
+
export type ResponseMessage<T extends Result> = TaskStatusMessage | TaskCreatedMessage | ResultMessage<T> | ErrorMessage;
|
| 42 |
+
export type AsyncGeneratorValue<T> = T extends AsyncGenerator<infer U> ? U : never;
|
| 43 |
+
export declare function toArrayAsync<T extends AsyncGenerator<unknown>>(it: T): Promise<AsyncGeneratorValue<T>[]>;
|
| 44 |
+
export declare function takeResult<T extends Result, U extends AsyncGenerator<ResponseMessage<T>>>(it: U): Promise<T>;
|
| 45 |
+
//# sourceMappingURL=responseMessage.d.ts.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/responseMessage.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"responseMessage.d.ts","sourceRoot":"","sources":["../../../src/shared/responseMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC1D,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC3D,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,mBAAmB;IACxE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,CAAC,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACrD,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,QAAQ,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,GAAG,kBAAkB,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC;AAEzH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEnF,wBAAsB,YAAY,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAO9G;AAED,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUlH"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/responseMessage.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.toArrayAsync = toArrayAsync;
|
| 4 |
+
exports.takeResult = takeResult;
|
| 5 |
+
async function toArrayAsync(it) {
|
| 6 |
+
const arr = [];
|
| 7 |
+
for await (const o of it) {
|
| 8 |
+
arr.push(o);
|
| 9 |
+
}
|
| 10 |
+
return arr;
|
| 11 |
+
}
|
| 12 |
+
async function takeResult(it) {
|
| 13 |
+
for await (const o of it) {
|
| 14 |
+
if (o.type === 'result') {
|
| 15 |
+
return o.result;
|
| 16 |
+
}
|
| 17 |
+
else if (o.type === 'error') {
|
| 18 |
+
throw o.error;
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
throw new Error('No result in stream.');
|
| 22 |
+
}
|
| 23 |
+
//# sourceMappingURL=responseMessage.js.map
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/responseMessage.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"responseMessage.js","sourceRoot":"","sources":["../../../src/shared/responseMessage.ts"],"names":[],"mappings":";;AAkDA,oCAOC;AAED,gCAUC;AAnBM,KAAK,UAAU,YAAY,CAAoC,EAAK;IACvE,MAAM,GAAG,GAA6B,EAAE,CAAC;IACzC,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACvB,GAAG,CAAC,IAAI,CAAC,CAA2B,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAEM,KAAK,UAAU,UAAU,CAAiE,EAAK;IAClG,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,OAAO,CAAC,CAAC,MAAM,CAAC;QACpB,CAAC;aAAM,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,MAAM,CAAC,CAAC,KAAK,CAAC;QAClB,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAC5C,CAAC"}
|
loan-advisor-chatgpt-app/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { JSONRPCMessage } from '../types.js';
|
| 2 |
+
/**
|
| 3 |
+
* Buffers a continuous stdio stream into discrete JSON-RPC messages.
|
| 4 |
+
*/
|
| 5 |
+
export declare class ReadBuffer {
|
| 6 |
+
private _buffer?;
|
| 7 |
+
append(chunk: Buffer): void;
|
| 8 |
+
readMessage(): JSONRPCMessage | null;
|
| 9 |
+
clear(): void;
|
| 10 |
+
}
|
| 11 |
+
export declare function deserializeMessage(line: string): JSONRPCMessage;
|
| 12 |
+
export declare function serializeMessage(message: JSONRPCMessage): string;
|
| 13 |
+
//# sourceMappingURL=stdio.d.ts.map
|