@topolo/mcp 0.13.2 → 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.
Files changed (2) hide show
  1. package/dist/index.js +8 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4968,6 +4968,10 @@ function audienceFor(context) {
4968
4968
  }
4969
4969
  return `app_topolo_${service.replace(/-/g, "_")}`;
4970
4970
  }
4971
+ function scopeFor(context, audience) {
4972
+ if (context.service === "auth" && context.path === "/api/auth/me") return "app_topolo_auth:identity";
4973
+ return `${audience}:actions:execute`;
4974
+ }
4971
4975
  function responseData(value) {
4972
4976
  if (!value || typeof value !== "object") return {};
4973
4977
  const record2 = value;
@@ -4985,22 +4989,24 @@ async function resolveExternalAgentInstallationCredential(environment, installat
4985
4989
  const fetchImpl = options.fetch ?? fetch;
4986
4990
  const now = options.now ?? Date.now;
4987
4991
  const authBaseUrl = resolveServiceUrl("auth", options.serviceUrls);
4988
- const tokenUrl = new URL("/api/developer-oauth/token", authBaseUrl).toString();
4992
+ const tokenUrl = new URL("/oauth/token", authBaseUrl).toString();
4989
4993
  const cache = /* @__PURE__ */ new Map();
4990
4994
  const credentialProvider = async (context) => {
4991
4995
  const audience = audienceFor(context);
4996
+ const scope = scopeFor(context, audience);
4992
4997
  const resource = context.resource ?? {
4993
4998
  resourceType: "organization",
4994
4999
  resourceId: stored.installation.organizationId
4995
5000
  };
4996
5001
  const boundTaskId = context.taskId?.trim() || taskId;
4997
- const key = JSON.stringify({ audience, taskId: boundTaskId, resource });
5002
+ const key = JSON.stringify({ audience, scope, taskId: boundTaskId, resource });
4998
5003
  const cached = cache.get(key);
4999
5004
  if (cached && cached.expiresAt - 15e3 > now()) return cached.credential;
5000
5005
  const body = new URLSearchParams({
5001
5006
  grant_type: "client_credentials",
5002
5007
  client_id: stored.installation.clientId,
5003
5008
  client_secret: stored.secret.clientSecret,
5009
+ scope,
5004
5010
  audience,
5005
5011
  task_id: boundTaskId,
5006
5012
  resource_type: resource.resourceType,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@topolo/mcp",
3
3
  "packageManager": "pnpm@10.17.1",
4
- "version": "0.13.2",
5
- "topoloPublishedVersion": "0.13.2",
4
+ "version": "0.13.3",
5
+ "topoloPublishedVersion": "0.13.3",
6
6
  "description": "Model Context Protocol server for the Topolo platform. Exposes scope-gated tools that third-party agents (Claude, Codex, etc.) can call natively.",
7
7
  "license": "UNLICENSED",
8
8
  "author": "Topolo",