mcporter invalid_scope: hardcoded mcp:tools OAuth scope breaks OIDC MCP servers
mcporter 0.7.3 fails with
invalid_scopeagainst OIDC MCP servers such as Granola MCP, which only support standard scopes likeopenid,email,profile, andoffline_access. mcporter hardcodes themcp:toolsOAuth scope and offers no per-server override. How can I make the OAuth flow succeed?Originally asked on GitHub: https://github.com/openclaw/mcporter/issues/85
3 answers
Fixed on the main branch (maintainer comment dated 2026-04-18); the thread names no released version, and the issue is closed as completed. For mcporter 0.7.3, the thread's workaround is to patch the hardcoded scope in
oauth.jsline 63:diff- scope: 'mcp:tools', + scope: definition.oauthScope ?? '',Why it fails:
PersistentOAuthClientProviderhardcodesscope: 'mcp:tools'in its client metadata. The MCP SDK'sauthInternal()falls back to that value when the server'sWWW-Authenticateheader is missing (the reporter notes AWS API Gateway remaps it tox-amzn-remapped-www-authenticate) and the protected resource metadata has noscopes_supported. Granola's authorization server advertisesscopes_supported: ["email", "offline_access", "openid", "profile"], none of which includemcp:tools, so it rejects the request withinvalid_scopeand mcporter showsOAuth error: invalid_scope.Fix on main (per the maintainer):
oauth.tsomits the scope by default so the SDK can derive it from server/auth metadata, and the config supportsoauthScope(normalized fromoauth_scope) for explicit provider scopes. Covered bytests/oauth-session.test.tsandtests/config-normalize.test.ts. If you're on main and a server needs a specific scope, setoauthScopein your mcporter config instead of patching the SDK.General advice: OAuth scopes define what permissions the token gets, so only request the scopes your MCP provider actually requires.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Reproduction from the issue body:
mcporter auth granola --resetwith mcporter 0.7.3 and SDK 1.25.3 against Granola MCP. The browser opened, Granola's auth server returnedinvalid_scope(the hardcodedmcp:toolsscope is not in its advertised scopes), and mcporter reportedOAuth error: invalid_scope.Source: https://github.com/openclaw/mcporter/issues/85 (opens external site)
Did this work for you?What @steipete tried on GitHub (Worked)
Maintainer states the fix is on main:
oauth.tsno longer hardcodesmcp:toolsand omits scope by default so the SDK derives it from server/auth metadata, withoauthScope/oauth_scopeconfig support; tests added inoauth-session.test.tsandconfig-normalize.test.ts, issue closed as completed.Source: https://github.com/openclaw/mcporter/issues/85#issuecomment-4274645156 (opens external site)
Did this work for you?
Related questions
- mcporter generate-cli fails: esbuild Could not resolve commander/mcporter
- mcporter auth linear returns 401 SSE error; workaround using mcp-remote
- How to fix mcporter Notion MCP auth error 'SSE error: Non-200 status code (401)'?
- mcporter auth on headless server: OAuth URL never printed, CLI just waits
- mcporter OAuth auth fails with 401 before browser opens (Notion/Linear MCP)