@fruggr/zendesk-mcp-server 3.2.1 → 3.3.1

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.
@@ -30,9 +30,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
30
  SOFTWARE.
31
31
  ```
32
32
 
33
- ## @modelcontextprotocol/core@2.2.0
33
+ ## @modelcontextprotocol/core@2.3.1
34
34
 
35
- License: MIT
35
+ License: Apache-2.0
36
36
 
37
37
  ```
38
38
  The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
@@ -253,9 +253,9 @@ CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
253
253
  the full license text.
254
254
  ```
255
255
 
256
- ## @modelcontextprotocol/node@2.1.0
256
+ ## @modelcontextprotocol/node@2.1.1
257
257
 
258
- License: MIT
258
+ License: Apache-2.0
259
259
 
260
260
  ```
261
261
  The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
@@ -476,9 +476,9 @@ CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
476
476
  the full license text.
477
477
  ```
478
478
 
479
- ## @modelcontextprotocol/server@2.2.0
479
+ ## @modelcontextprotocol/server@2.3.1
480
480
 
481
- License: MIT
481
+ License: Apache-2.0
482
482
 
483
483
  ```
484
484
  The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
@@ -2629,7 +2629,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2629
2629
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2630
2630
  ```
2631
2631
 
2632
- ## mdast-util-find-and-replace@3.0.2
2632
+ ## mdast-util-find-and-replace@3.0.3
2633
2633
 
2634
2634
  License: MIT
2635
2635
 
@@ -2658,7 +2658,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2658
2658
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2659
2659
  ```
2660
2660
 
2661
- ## mdast-util-from-markdown@2.0.3
2661
+ ## mdast-util-from-markdown@2.1.0
2662
2662
 
2663
2663
  License: MIT
2664
2664
 
@@ -2920,7 +2920,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2920
2920
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2921
2921
  ```
2922
2922
 
2923
- ## mdast-util-to-markdown@2.1.3
2923
+ ## mdast-util-to-markdown@2.2.0
2924
2924
 
2925
2925
  License: MIT
2926
2926
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { _ as __toESM, a as REQUEST_TIMEOUT_MS, c as getOAuthUrls, d as createStartupError, f as errnoCode, g as __require, h as __exportAll, i as zendeskGet, l as WebStandardStreamableHTTPServerTransport, m as __commonJSMin, o as deadlineSignal, r as silentLogger, t as createMcpServer, u as STARTUP_DOCS } from "./index.js";
3
- import { d as escapeHtml, l as requestedScope, n as configDir, o as generateCodeChallenge, s as generateCodeVerifier, u as supportedScopes } from "./token-persistence-BeetFqPF.js";
2
+ import { _ as __commonJSMin, a as verifyBearerToken, b as __toESM, c as zendeskGet, f as getOAuthUrls, h as errnoCode, i as WebStandardStreamableHTTPServerTransport, l as REQUEST_TIMEOUT_MS, m as createStartupError, o as OAuthError, p as STARTUP_DOCS, r as silentLogger, s as OAuthErrorCode, t as createMcpServer, u as deadlineSignal, v as __exportAll, y as __require } from "./index.js";
3
+ import { d as escapeHtml, l as requestedScope, n as configDir, o as generateCodeChallenge, s as generateCodeVerifier, u as supportedScopes } from "./token-persistence-BUHh23BM.js";
4
4
  import * as util$1 from "node:util";
5
5
  import { format, inspect } from "node:util";
6
6
  import * as crypto$2 from "node:crypto";
@@ -16,7 +16,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
16
16
  import { accessSync, chmodSync, constants, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
17
17
  import { Http2ServerRequest, constants as constants$1 } from "http2";
18
18
  import crypto$1 from "crypto";
19
- //#region node_modules/.pnpm/@hono+node-server@1.19.17_hono@4.13.12/node_modules/@hono/node-server/dist/index.mjs
19
+ //#region node_modules/.pnpm/@hono+node-server@1.19.17_hono@4.13.13/node_modules/@hono/node-server/dist/index.mjs
20
20
  var RequestError = class extends Error {
21
21
  constructor(message, options) {
22
22
  super(message, options);
@@ -504,7 +504,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
504
504
  };
505
505
  };
506
506
  //#endregion
507
- //#region node_modules/.pnpm/@modelcontextprotocol+node@2.1.0_@modelcontextprotocol+server@2.2.0_hono@4.13.12/node_modules/@modelcontextprotocol/node/dist/index.mjs
507
+ //#region node_modules/.pnpm/@modelcontextprotocol+node@2.1.1_@modelcontextprotocol+server@2.3.1/node_modules/@modelcontextprotocol/node/dist/index.mjs
508
508
  /**
509
509
  * Server transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification.
510
510
  * It supports both SSE streaming and direct HTTP responses.
@@ -543,8 +543,12 @@ var getRequestListener = (fetchCallback, options = {}) => {
543
543
  *
544
544
  * @example Using with a pre-parsed request body (e.g. Express)
545
545
  * ```ts source="./streamableHttp.examples.ts#NodeStreamableHTTPServerTransport_express"
546
- * app.post('/mcp', (req, res) => {
547
- * transport.handleRequest(req, res, req.body);
546
+ * app.post('/mcp', async (req, res) => {
547
+ * // Stateless example: create a server and a transport per request.
548
+ * const server = new McpServer({ name: 'my-server', version: '1.0.0' });
549
+ * const transport = new NodeStreamableHTTPServerTransport({ sessionIdGenerator: undefined });
550
+ * await server.connect(transport);
551
+ * await transport.handleRequest(req, res, req.body);
548
552
  * });
549
553
  * ```
550
554
  */
@@ -36178,16 +36182,16 @@ const resolveMasterSecret = (input, logger = silentLogger) => {
36178
36182
  //#endregion
36179
36183
  //#region src/auth/server/authorization-server.ts
36180
36184
  const decoder = new TextDecoder();
36181
- const asVerified = (claims, issuer, resource) => {
36182
- const audiences = Array.isArray(claims.aud) ? claims.aud : [claims.aud];
36183
- if (!(claims.iss === issuer && audiences.includes(resource) && typeof claims.exp === "number" && claims.exp * 1e3 > Date.now() && typeof claims.zd === "string" && typeof claims.gid === "string")) return void 0;
36185
+ const asVerified = (claims, issuer) => {
36186
+ if (!(claims.iss === issuer && typeof claims.exp === "number" && typeof claims.zd === "string" && typeof claims.gid === "string")) return void 0;
36184
36187
  return {
36185
36188
  zendeskAccessToken: claims.zd,
36186
36189
  grantId: claims.gid,
36187
36190
  clientId: String(claims.client_id),
36188
36191
  subject: String(claims.sub),
36189
36192
  canWrite: typeof claims.scope === "string" && claims.scope.split(" ").includes("write"),
36190
- expiresAt: claims.exp
36193
+ expiresAt: claims.exp,
36194
+ resource: typeof claims.aud === "string" ? claims.aud : void 0
36191
36195
  };
36192
36196
  };
36193
36197
  const createAuthorizationServer = (options) => {
@@ -36252,7 +36256,7 @@ const createAuthorizationServer = (options) => {
36252
36256
  const keySet = ring.find((set) => set.accessToken.kid === kid);
36253
36257
  if (!keySet) return void 0;
36254
36258
  const { plaintext } = await compactDecrypt(bearer, keySet.accessToken.key);
36255
- return asVerified(JSON.parse(decoder.decode(plaintext)), issuer, resource);
36259
+ return asVerified(JSON.parse(decoder.decode(plaintext)), issuer);
36256
36260
  };
36257
36261
  return {
36258
36262
  issuer,
@@ -36414,11 +36418,36 @@ const resolvePublicUrl = (config, logger = silentLogger) => {
36414
36418
  return `http://${config.host}:${config.port}`;
36415
36419
  };
36416
36420
  const MISSING_BEARER_MESSAGE = "Missing or invalid access token. Sign in through this server: its OAuth authorization server is named in the protected resource metadata.";
36417
- const extractBearer = (request) => {
36421
+ const SPACES = / +/;
36422
+ /**
36423
+ * The access token on this request, or `undefined` when it must be refused.
36424
+ * The SDK parses the header and checks the audience against our `/mcp`
36425
+ * resource (`expectedResource`) and the expiry; decrypting and every other
36426
+ * claim stay with the authorization server.
36427
+ */
36428
+ const authenticate = async (request, as) => {
36418
36429
  const header = request.headers["authorization"];
36419
- if (typeof header !== "string") return void 0;
36420
- if (!header.toLowerCase().startsWith("bearer ")) return void 0;
36421
- return header.slice(7).trim();
36430
+ const verifier = { verifyAccessToken: async (bearer) => {
36431
+ const token = await as.verifyAccessToken(bearer);
36432
+ if (!token) throw new OAuthError(OAuthErrorCode.InvalidToken, "Invalid access token");
36433
+ return {
36434
+ token: bearer,
36435
+ clientId: token.clientId,
36436
+ scopes: [],
36437
+ expiresAt: token.expiresAt,
36438
+ ...token.resource && URL.canParse(token.resource) && { resource: new URL(token.resource) },
36439
+ extra: { verified: token }
36440
+ };
36441
+ } };
36442
+ try {
36443
+ const normalized = typeof header === "string" ? header.replace(SPACES, " ") : void 0;
36444
+ return (await verifyBearerToken(normalized, {
36445
+ verifier,
36446
+ expectedResource: new URL(as.resource)
36447
+ })).extra?.["verified"];
36448
+ } catch {
36449
+ return;
36450
+ }
36422
36451
  };
36423
36452
  const PROTECTED_RESOURCE_PATHS = ["/.well-known/oauth-protected-resource/mcp", "/.well-known/oauth-protected-resource"];
36424
36453
  const sendJson = (res, status, body) => {
@@ -36572,8 +36601,7 @@ const startHttpTransport = async (config, logger = silentLogger, options = {}) =
36572
36601
  await transport.handleRequest(req, res, body);
36573
36602
  };
36574
36603
  const handleMcpRequest = async (req, res, as) => {
36575
- const bearer = extractBearer(req);
36576
- const token = bearer ? await as.verifyAccessToken(bearer) : void 0;
36604
+ const token = await authenticate(req, as);
36577
36605
  if (!token) {
36578
36606
  sendUnauthorized(res, as.issuer);
36579
36607
  return;