@ttoss/http-server-mcp 0.13.1 → 0.13.3

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/dist/index.cjs CHANGED
@@ -10,7 +10,7 @@ let zod = require("zod");
10
10
  let _modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk/server/mcp.js");
11
11
 
12
12
  //#region src/index.ts
13
- const requestContextStore = new node_async_hooks.AsyncLocalStorage();
13
+ var requestContextStore = new node_async_hooks.AsyncLocalStorage();
14
14
  /**
15
15
  * Generic HTTP helper for use inside MCP tool handlers.
16
16
  *
@@ -64,7 +64,7 @@ const requestContextStore = new node_async_hooks.AsyncLocalStorage();
64
64
  * });
65
65
  * ```
66
66
  */
67
- const apiCall = async (method, url, options) => {
67
+ var apiCall = async (method, url, options) => {
68
68
  const context = requestContextStore.getStore();
69
69
  let resolvedUrl = url;
70
70
  if (url.startsWith("/")) {
@@ -101,7 +101,7 @@ const apiCall = async (method, url, options) => {
101
101
  * Returns the verified JWT payload for the current MCP request.
102
102
  * Only available inside a tool handler when `auth` is configured on the router.
103
103
  */
104
- const getIdentity = () => {
104
+ var getIdentity = () => {
105
105
  return requestContextStore.getStore()?.identity;
106
106
  };
107
107
  /**
@@ -119,13 +119,13 @@ const getIdentity = () => {
119
119
  * });
120
120
  * ```
121
121
  */
122
- const checkScopes = required => {
122
+ var checkScopes = required => {
123
123
  const tokenScopes = (getIdentity()?.scope ?? "").split(" ");
124
124
  if (required.filter(s => {
125
125
  return !tokenScopes.includes(s);
126
126
  }).length > 0) throw new Error(`Insufficient scopes. Required: ${required.join(", ")}`);
127
127
  };
128
- const buildTokenVerifier = auth => {
128
+ var buildTokenVerifier = auth => {
129
129
  if (auth.cognitoUserPool) {
130
130
  const v = _ttoss_auth_core_amazon_cognito.CognitoJwtVerifier.create({
131
131
  tokenUse: "access",
@@ -138,7 +138,7 @@ const buildTokenVerifier = auth => {
138
138
  if (auth.verifyToken) return auth.verifyToken;
139
139
  throw new Error("McpAuthOptions requires either cognitoUserPool or verifyToken");
140
140
  };
141
- const registerAuthRoutes = (router, path, auth, tokenVerifier) => {
141
+ var registerAuthRoutes = (router, path, auth, tokenVerifier) => {
142
142
  router.use(path, async (ctx, next) => {
143
143
  const authHeader = ctx.headers.authorization;
144
144
  const token = authHeader?.startsWith("Bearer ") ? authHeader.slice(7) : "";
@@ -208,7 +208,7 @@ const registerAuthRoutes = (router, path, auth, tokenVerifier) => {
208
208
  * app.listen(3000);
209
209
  * ```
210
210
  */
211
- const createMcpRouter = (server, options = {}) => {
211
+ var createMcpRouter = (server, options = {}) => {
212
212
  const {
213
213
  path = "/mcp",
214
214
  sessionIdGenerator,
@@ -296,8 +296,8 @@ const createMcpRouter = (server, options = {}) => {
296
296
  });
297
297
  return router;
298
298
  };
299
- const rawSchemaRegistryMap = /* @__PURE__ */new WeakMap();
300
- const patchedServerSet = /* @__PURE__ */new WeakSet();
299
+ var rawSchemaRegistryMap = /* @__PURE__ */new WeakMap();
300
+ var patchedServerSet = /* @__PURE__ */new WeakSet();
301
301
  /**
302
302
  * Registers a tool on an MCP server using a **plain JSON Schema** object for
303
303
  * `inputSchema` instead of a Zod shape.
@@ -339,7 +339,7 @@ const patchedServerSet = /* @__PURE__ */new WeakSet();
339
339
  * });
340
340
  * ```
341
341
  */
342
- const registerToolFromSchema = (server, params) => {
342
+ var registerToolFromSchema = (server, params) => {
343
343
  const {
344
344
  name,
345
345
  description,
package/dist/index.d.cts CHANGED
@@ -1007,4 +1007,4 @@ interface RegisterToolFromSchemaParams {
1007
1007
  */
1008
1008
  declare const registerToolFromSchema: (server: McpServer$1, params: RegisterToolFromSchemaParams) => void;
1009
1009
  //#endregion
1010
- export { ApiCallOptions, CognitoUserPoolConfig, JsonObjectSchema, McpAuthOptions, McpRouterOptions, type McpServer, RegisterToolFromSchemaParams, apiCall, checkScopes, createMcpRouter, getIdentity, registerToolFromSchema, z };
1010
+ export { ApiCallOptions, CognitoUserPoolConfig, JsonObjectSchema, McpAuthOptions, McpRouterOptions, McpServer, RegisterToolFromSchemaParams, apiCall, checkScopes, createMcpRouter, getIdentity, registerToolFromSchema, z };
package/dist/index.d.mts CHANGED
@@ -1007,4 +1007,4 @@ interface RegisterToolFromSchemaParams {
1007
1007
  */
1008
1008
  declare const registerToolFromSchema: (server: McpServer$1, params: RegisterToolFromSchemaParams) => void;
1009
1009
  //#endregion
1010
- export { ApiCallOptions, CognitoUserPoolConfig, JsonObjectSchema, McpAuthOptions, McpRouterOptions, type McpServer, RegisterToolFromSchemaParams, apiCall, checkScopes, createMcpRouter, getIdentity, registerToolFromSchema, z };
1010
+ export { ApiCallOptions, CognitoUserPoolConfig, JsonObjectSchema, McpAuthOptions, McpRouterOptions, McpServer, RegisterToolFromSchemaParams, apiCall, checkScopes, createMcpRouter, getIdentity, registerToolFromSchema, z };
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { z, z as z$1 } from "zod";
7
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8
8
 
9
9
  //#region src/index.ts
10
- const requestContextStore = new AsyncLocalStorage();
10
+ var requestContextStore = new AsyncLocalStorage();
11
11
  /**
12
12
  * Generic HTTP helper for use inside MCP tool handlers.
13
13
  *
@@ -61,7 +61,7 @@ const requestContextStore = new AsyncLocalStorage();
61
61
  * });
62
62
  * ```
63
63
  */
64
- const apiCall = async (method, url, options) => {
64
+ var apiCall = async (method, url, options) => {
65
65
  const context = requestContextStore.getStore();
66
66
  let resolvedUrl = url;
67
67
  if (url.startsWith("/")) {
@@ -98,7 +98,7 @@ const apiCall = async (method, url, options) => {
98
98
  * Returns the verified JWT payload for the current MCP request.
99
99
  * Only available inside a tool handler when `auth` is configured on the router.
100
100
  */
101
- const getIdentity = () => {
101
+ var getIdentity = () => {
102
102
  return requestContextStore.getStore()?.identity;
103
103
  };
104
104
  /**
@@ -116,13 +116,13 @@ const getIdentity = () => {
116
116
  * });
117
117
  * ```
118
118
  */
119
- const checkScopes = required => {
119
+ var checkScopes = required => {
120
120
  const tokenScopes = (getIdentity()?.scope ?? "").split(" ");
121
121
  if (required.filter(s => {
122
122
  return !tokenScopes.includes(s);
123
123
  }).length > 0) throw new Error(`Insufficient scopes. Required: ${required.join(", ")}`);
124
124
  };
125
- const buildTokenVerifier = auth => {
125
+ var buildTokenVerifier = auth => {
126
126
  if (auth.cognitoUserPool) {
127
127
  const v = CognitoJwtVerifier.create({
128
128
  tokenUse: "access",
@@ -135,7 +135,7 @@ const buildTokenVerifier = auth => {
135
135
  if (auth.verifyToken) return auth.verifyToken;
136
136
  throw new Error("McpAuthOptions requires either cognitoUserPool or verifyToken");
137
137
  };
138
- const registerAuthRoutes = (router, path, auth, tokenVerifier) => {
138
+ var registerAuthRoutes = (router, path, auth, tokenVerifier) => {
139
139
  router.use(path, async (ctx, next) => {
140
140
  const authHeader = ctx.headers.authorization;
141
141
  const token = authHeader?.startsWith("Bearer ") ? authHeader.slice(7) : "";
@@ -205,7 +205,7 @@ const registerAuthRoutes = (router, path, auth, tokenVerifier) => {
205
205
  * app.listen(3000);
206
206
  * ```
207
207
  */
208
- const createMcpRouter = (server, options = {}) => {
208
+ var createMcpRouter = (server, options = {}) => {
209
209
  const {
210
210
  path = "/mcp",
211
211
  sessionIdGenerator,
@@ -293,8 +293,8 @@ const createMcpRouter = (server, options = {}) => {
293
293
  });
294
294
  return router;
295
295
  };
296
- const rawSchemaRegistryMap = /* @__PURE__ */new WeakMap();
297
- const patchedServerSet = /* @__PURE__ */new WeakSet();
296
+ var rawSchemaRegistryMap = /* @__PURE__ */new WeakMap();
297
+ var patchedServerSet = /* @__PURE__ */new WeakSet();
298
298
  /**
299
299
  * Registers a tool on an MCP server using a **plain JSON Schema** object for
300
300
  * `inputSchema` instead of a Zod shape.
@@ -336,7 +336,7 @@ const patchedServerSet = /* @__PURE__ */new WeakSet();
336
336
  * });
337
337
  * ```
338
338
  */
339
- const registerToolFromSchema = (server, params) => {
339
+ var registerToolFromSchema = (server, params) => {
340
340
  const {
341
341
  name,
342
342
  description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/http-server-mcp",
3
- "version": "0.13.1",
3
+ "version": "0.13.3",
4
4
  "description": "Model Context Protocol (MCP) server integration for @ttoss/http-server",
5
5
  "keywords": [
6
6
  "ai",
@@ -35,15 +35,15 @@
35
35
  "dependencies": {
36
36
  "@modelcontextprotocol/sdk": "^1.29.0",
37
37
  "zod": "^4.3.6",
38
- "@ttoss/auth-core": "^0.4.14",
39
- "@ttoss/http-server": "^0.5.15"
38
+ "@ttoss/auth-core": "^0.4.16",
39
+ "@ttoss/http-server": "^0.5.17"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/koa": "^3.0.2",
43
43
  "jest": "^30.3.0",
44
44
  "supertest": "^7.2.2",
45
45
  "tsdown": "^0.22.0",
46
- "@ttoss/config": "^1.37.13"
46
+ "@ttoss/config": "^1.37.15"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@modelcontextprotocol/sdk": "^1.0.0"