poe-code 3.0.437 → 3.0.438
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -37,6 +37,8 @@ export interface HttpServer extends Omit<Server, "tool" | "registerTool"> {
|
|
|
37
37
|
}
|
|
38
38
|
export interface HttpToolContext {
|
|
39
39
|
request: AuthenticatedIncomingMessage;
|
|
40
|
+
sessionId?: string;
|
|
41
|
+
auth?: RequestAuthInfo;
|
|
40
42
|
}
|
|
41
43
|
export type HttpToolHandler<T = Record<string, unknown>, TOut = ToolReturn> = (args: T, context: HttpToolContext) => Promise<TOut | CallToolResult> | TOut | CallToolResult;
|
|
42
44
|
export declare function createProtectedResourceMetadataDocument(options: ProtectedResourceMetadataOptions): Record<string, unknown>;
|
|
@@ -94,7 +94,11 @@ export function createHttpServer(options) {
|
|
|
94
94
|
supportResourceSubscriptions: supportsSessions
|
|
95
95
|
});
|
|
96
96
|
const transport = new StreamableHttpTransport(server, options, async (req, callback) => requestContextStorage.run({
|
|
97
|
-
request: req
|
|
97
|
+
request: req,
|
|
98
|
+
sessionId: Array.isArray(req.headers["mcp-session-id"])
|
|
99
|
+
? req.headers["mcp-session-id"][0]
|
|
100
|
+
: req.headers["mcp-session-id"],
|
|
101
|
+
auth: req.auth
|
|
98
102
|
}, callback));
|
|
99
103
|
const protectedResourceMetadataBody = options.oauth === undefined
|
|
100
104
|
? undefined
|
|
@@ -103,7 +107,7 @@ export function createHttpServer(options) {
|
|
|
103
107
|
const registerTool = server.tool.bind(server);
|
|
104
108
|
const registerRichTool = server.registerTool.bind(server);
|
|
105
109
|
const defaultContext = {
|
|
106
|
-
request: {}
|
|
110
|
+
request: { headers: {}, socket: {} }
|
|
107
111
|
};
|
|
108
112
|
const authorizeHttpRequest = async (req, res, protectedResourcePath) => {
|
|
109
113
|
if (options.oauth === undefined || req.method === "OPTIONS") {
|