fix(descope): Fixes two bugs in the Descope plugin, updates relevant docs - #611
Draft
joshwertheim wants to merge 4 commits into
Draft
fix(descope): Fixes two bugs in the Descope plugin, updates relevant docs#611joshwertheim wants to merge 4 commits into
joshwertheim wants to merge 4 commits into
Conversation
Unfortunately when the original branch was merged, perhaps due to a faulty rebase an earlier change was left in. When tested end-to-end, a cached working build was used rather than a newly built copy of the plugin. So verification of everything working as expected before OK'ing the branch's PR as ready for review wasn't complete... Detailed notes for this commit: Bug fixes (packages/plugins/descope/src/provider.ts): 1. descopeMiddleware(config, sdk) changes to descopeMiddleware(sdk) - an arity mismatch (function took 1 param, was called with 2) that made tsc fail to compile, and when emitted anyway, silently bound the wrong value to sdk, breaking JWT validation for every request. 2. `parseProjectId` now handles Agentic Identity Hub issuer URLs (https://api.descope.com/v1/apps/agentic/<projectId>/<mcpServerId>) by locating the segment after "agentic", instead of always grabbing segments[0] (which returned "v1" for this URL shape) — confirmed against Descope's own docs. Falls back to segments[0] for the legacy plain issuer URL format. New config option (packages/plugins/descope/src/types.ts, provider.ts): * Added optional projectId?: string to DescopeConfig. When provided, it's used directly (config.projectId ?? parseProjectId(config.issuerURL)), letting callers skip URL parsing entirely. Example updated (examples/descope-http/): 1. src/middleware.ts - now passes projectId: process.env.DESCOPE_PROJECT_ID. 2. .env.example - added DESCOPE_PROJECT_ID=your-project-id. 3. README.md - updated the .env setup snippet to the correct Agentic Identity Hub issuer URL shape, added DESCOPE_PROJECT_ID, and a note that it's optional (falls back to parsing). Docs updated (packages/plugins/descope/README.md, apps/website/content/docs/integrations/descope.mdx): 1. Both READMEs' API reference tables/config option lists now document projectId. 2. Both READMEs' quick-start code snippets and .env examples updated to include DESCOPE_PROJECT_ID and the correct issuer URL shape. 3. Website docs: fixed scopesSupported: process.env.SCOPES_SUPPORTED changes to process.env.SCOPES_SUPPORTED?.split(","), since scopesSupported is typed as string[] but the env var is a comma-separated string.
Contributor
|
@joshwertheim is attempting to deploy a commit to the xmcp Team on Vercel. A member of the Team first needs to authorize it. |
…claims into permissions scopesSupported now falls back to fetching scopes_supported from Descope's OIDC discovery document instead of a hardcoded default when the config option is omitted. session.permissions now merges the RBAC permissions claim with the OAuth scope claim so Agentic Identity Hub policy grants show up alongside RBAC role/tenant grants.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two bugs in the
@xmcp-dev/descopeplugin that together broke JWT authentication for any project using the modern Agentic Identity Hub setup flow: a middleware call with a mismatched argument count that dropped the real Descope SDK client, and a project-ID parser that misread the newer/v1/apps/agentic/<projectId>/<mcpServerId>issuer URL format. Adds an optionalprojectIdconfig field so callers can bypass URL parsing entirely, and updates the plugin README, thedescope-httpexample, and the website docs to match. This includes fixing a stale legacy-format issuer URL placeholder and an unrelatedscopesSupportedstring/array type mismatch found along the way.Verified the new changes with a live end-to-end test using the included
descope-httpexample and called thewhoamitool with the following result:Type of Change
Affected Packages
xmcp(core framework)create-xmcp-appinit-xmcpContributor Checklist
AGENTS.mdand the scoped rules for the areas I touched.REVIEW_RULES.mdfor logging, timers, config shape, wrappers, compiler/loader changes, and stale examples.Screenshots/Examples
Related Issues
https://github.com/descope/etc/issues/16798