Skip to content

Commit 138cee9

Browse files
committed
fix: correct managed OAuth credential name lookup for gateway MCP clients
The managed OAuth credential is created with the suffix '-oauth' (e.g. 'my-gateway-oauth') but was being looked up with '-agent-oauth' in schema-mapper.ts and displayed with '-agent-oauth' in AddGatewayScreen. This mismatch caused the credential lookup to fail silently, resulting in an empty provider_name in the generated @requires_access_token decorator. The agent runtime then crashed with: ParamValidationError: Invalid length for parameter resourceCredentialProviderName, value: 0, valid min length: 1
1 parent 73156a4 commit 138cee9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/cli/operations/agent/generate/schema-mapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ async function mapGatewaysToGatewayProviders(): Promise<GatewayProviderRenderCon
199199

200200
if (gateway.authorizerType === 'CUSTOM_JWT' && gateway.authorizerConfiguration?.customJwtAuthorizer) {
201201
const jwtConfig = gateway.authorizerConfiguration.customJwtAuthorizer;
202-
const credName = `${gateway.name}-agent-oauth`;
202+
const credName = `${gateway.name}-oauth`;
203203
const credential = project.credentials.find(c => c.name === credName);
204204

205205
if (credential) {

src/cli/tui/screens/mcp/AddGatewayScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export function AddGatewayScreen({ onComplete, onExit, existingGateways, unassig
272272
? [{ label: 'Allowed Scopes', value: wizard.config.jwtConfig.allowedScopes.join(', ') }]
273273
: []),
274274
...(wizard.config.jwtConfig.agentClientId
275-
? [{ label: 'Agent Credential', value: `${wizard.config.name}-agent-oauth` }]
275+
? [{ label: 'Agent Credential', value: `${wizard.config.name}-oauth` }]
276276
: []),
277277
]
278278
: []),

0 commit comments

Comments
 (0)