@ian-pascoe/pi-mcp 0.3.1 → 0.3.2

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.
@@ -9488,7 +9488,7 @@ var McpAuthStore = class {
9488
9488
  import { execFile as execFileCallback } from "node:child_process";
9489
9489
  import { randomBytes, timingSafeEqual } from "node:crypto";
9490
9490
  import { createServer } from "node:http";
9491
- import { auth, resourceUrlFromServerUrl } from "@modelcontextprotocol/client";
9491
+ import { auth, checkResourceAllowed, resourceUrlFromServerUrl } from "@modelcontextprotocol/client";
9492
9492
  var McpOAuthPersistenceError = class extends Error {
9493
9493
  constructor(operation) {
9494
9494
  super(`MCP OAuth persistence failed during ${operation}`);
@@ -9703,7 +9703,10 @@ var McpOAuthProvider = class {
9703
9703
  return void 0;
9704
9704
  }
9705
9705
  const resource = discovery.protectedResourceMetadata?.resource;
9706
- if (resource !== void 0 && (typeof resource !== "string" || !URL.canParse(resource) || new URL(resource).href !== resourceUrlFromServerUrl(this.options.serverUrl).href)) {
9706
+ if (resource !== void 0 && (typeof resource !== "string" || !URL.canParse(resource) || !checkResourceAllowed({
9707
+ configuredResource: resource,
9708
+ requestedResource: resourceUrlFromServerUrl(this.options.serverUrl)
9709
+ }))) {
9707
9710
  return void 0;
9708
9711
  }
9709
9712
  const resourceMetadataUrl = discovery.resourceMetadataUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ian-pascoe/pi-mcp",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "private": false,
5
5
  "description": "A complete Model Context Protocol Host for Pi",
6
6
  "keywords": [
package/src/mcp-oauth.ts CHANGED
@@ -12,7 +12,7 @@ import type {
12
12
  StoredOAuthClientInformation,
13
13
  StoredOAuthTokens,
14
14
  } from "@modelcontextprotocol/client";
15
- import { auth, resourceUrlFromServerUrl } from "@modelcontextprotocol/client";
15
+ import { auth, checkResourceAllowed, resourceUrlFromServerUrl } from "@modelcontextprotocol/client";
16
16
  import { type McpAuthBinding, type McpAuthEntry, McpAuthStore } from "./mcp-auth-store.js";
17
17
  import type { McpStoreJsonObject, McpStoreJsonValue } from "./mcp-settings-store.js";
18
18
 
@@ -384,7 +384,10 @@ export class McpOAuthProvider implements OAuthClientProvider {
384
384
  resource !== undefined &&
385
385
  (typeof resource !== "string" ||
386
386
  !URL.canParse(resource) ||
387
- new URL(resource).href !== resourceUrlFromServerUrl(this.options.serverUrl).href)
387
+ !checkResourceAllowed({
388
+ configuredResource: resource,
389
+ requestedResource: resourceUrlFromServerUrl(this.options.serverUrl),
390
+ }))
388
391
  ) {
389
392
  return undefined;
390
393
  }