Skip to content

Commit e0f85ac

Browse files
authored
feat: mcp gateway schema types (auth, outbound auth, OAuth credentials) (#375)
* ci: add feat/gateway-integration branch to workflow triggers (#376) * feat: mcp gateway schema types (auth, outbound auth, OAuth credentials) * fix: address CR feedback — scopes optional, specific validation errors
1 parent fe1283a commit e0f85ac

File tree

12 files changed

+118
-23
lines changed

12 files changed

+118
-23
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Build and Test
22

33
on:
44
push:
5-
branches: ['main']
5+
branches: ['main', 'feat/gateway-integration']
66
pull_request:
7-
branches: ['main']
7+
branches: ['main', 'feat/gateway-integration']
88

99
permissions:
1010
contents: read

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: CodeQL
22

33
on:
44
push:
5-
branches: ['main']
5+
branches: ['main', 'feat/gateway-integration']
66
pull_request:
7-
branches: ['main']
7+
branches: ['main', 'feat/gateway-integration']
88
pull_request_target:
9-
branches: ['main']
9+
branches: ['main', 'feat/gateway-integration']
1010

1111
# Cancel in-progress runs when a new commit is pushed
1212
concurrency:

.github/workflows/e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
description: 'AWS region for deployment'
77
default: 'us-east-1'
88
pull_request_target:
9-
branches: [main]
9+
branches: [main, feat/gateway-integration]
1010

1111
permissions:
1212
id-token: write # OIDC — lets GitHub assume an AWS IAM role via short-lived token (no stored keys)

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Quality and Safety Checks
22

33
on:
44
push:
5-
branches: ['main']
5+
branches: ['main', 'feat/gateway-integration']
66
pull_request:
7-
branches: ['main']
7+
branches: ['main', 'feat/gateway-integration']
88

99
permissions:
1010
contents: read

.github/workflows/pr-size.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: PR Size Check and Label
44
# Safe because this workflow only reads PR metadata — it never checks out untrusted code.
55
on:
66
pull_request_target:
7-
branches: [main]
7+
branches: [main, feat/gateway-integration]
88

99
jobs:
1010
label-size:

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Validate PR Title
22

33
on:
44
pull_request_target:
5-
branches: [main]
5+
branches: [main, feat/gateway-integration]
66
types: [opened, edited, synchronize, reopened]
77

88
jobs:

src/cli/operations/mcp/create-mcp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export async function getExistingToolNames(): Promise<string[]> {
126126
// Gateway targets
127127
for (const gateway of mcpSpec.agentCoreGateways) {
128128
for (const target of gateway.targets) {
129-
for (const toolDef of target.toolDefinitions) {
129+
for (const toolDef of target.toolDefinitions ?? []) {
130130
toolNames.push(toolDef.name);
131131
}
132132
}
@@ -256,7 +256,7 @@ export async function createToolFromWizard(config: AddMcpToolConfig): Promise<Cr
256256
// Check for duplicate tool names
257257
for (const toolDef of toolDefs) {
258258
for (const existingTarget of gateway.targets) {
259-
if (existingTarget.toolDefinitions.some(t => t.name === toolDef.name)) {
259+
if ((existingTarget.toolDefinitions ?? []).some(t => t.name === toolDef.name)) {
260260
throw new Error(`Tool "${toolDef.name}" already exists in gateway "${gateway.name}".`);
261261
}
262262
}

src/cli/operations/remove/remove-mcp-tool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export async function previewRemoveMcpTool(tool: RemovableMcpTool): Promise<Remo
109109
}
110110

111111
// Tool definitions in mcp-defs
112-
for (const toolDef of target.toolDefinitions) {
112+
for (const toolDef of target.toolDefinitions ?? []) {
113113
if (mcpDefs.tools[toolDef.name]) {
114114
summary.push(`Removing tool definition: ${toolDef.name}`);
115115
}
@@ -179,7 +179,7 @@ function computeRemovedToolMcpDefs(
179179
const gateway = mcpSpec.agentCoreGateways.find(g => g.name === tool.gatewayName);
180180
const target = gateway?.targets.find(t => t.name === tool.name);
181181
if (target) {
182-
for (const toolDef of target.toolDefinitions) {
182+
for (const toolDef of target.toolDefinitions ?? []) {
183183
toolNamesToRemove.push(toolDef.name);
184184
}
185185
}

src/cli/tui/screens/mcp/useAddGatewayWizard.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useCallback, useMemo, useState } from 'react';
55
/** Maps authorizer type to the next step after authorizer selection */
66
const AUTHORIZER_NEXT_STEP: Record<GatewayAuthorizerType, AddGatewayStep> = {
77
NONE: 'agents',
8+
AWS_IAM: 'agents',
89
CUSTOM_JWT: 'jwt-config',
910
};
1011

src/schema/schemas/__tests__/mcp.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ describe('AgentCoreGatewayTargetSchema', () => {
261261
name: 'myTarget',
262262
targetType: 'lambda',
263263
toolDefinitions: [validToolDef],
264+
compute: {
265+
host: 'Lambda',
266+
implementation: { language: 'Python', path: 'tools', handler: 'h' },
267+
pythonVersion: 'PYTHON_3_12',
268+
},
264269
});
265270
expect(result.success).toBe(true);
266271
});
@@ -270,6 +275,11 @@ describe('AgentCoreGatewayTargetSchema', () => {
270275
name: 'myTarget',
271276
targetType: 'lambda',
272277
toolDefinitions: [],
278+
compute: {
279+
host: 'Lambda',
280+
implementation: { language: 'Python', path: 'tools', handler: 'h' },
281+
pythonVersion: 'PYTHON_3_12',
282+
},
273283
});
274284
expect(result.success).toBe(false);
275285
});
@@ -303,6 +313,11 @@ describe('AgentCoreGatewaySchema', () => {
303313
name: 'target1',
304314
targetType: 'lambda',
305315
toolDefinitions: [validToolDef],
316+
compute: {
317+
host: 'Lambda',
318+
implementation: { language: 'Python', path: 'tools', handler: 'h' },
319+
pythonVersion: 'PYTHON_3_12',
320+
},
306321
},
307322
],
308323
};
@@ -387,7 +402,18 @@ describe('AgentCoreMcpSpecSchema', () => {
387402
agentCoreGateways: [
388403
{
389404
name: 'gw1',
390-
targets: [{ name: 't1', targetType: 'lambda', toolDefinitions: [validToolDef] }],
405+
targets: [
406+
{
407+
name: 't1',
408+
targetType: 'lambda',
409+
toolDefinitions: [validToolDef],
410+
compute: {
411+
host: 'Lambda',
412+
implementation: { language: 'Python', path: 'tools', handler: 'h' },
413+
pythonVersion: 'PYTHON_3_12',
414+
},
415+
},
416+
],
391417
},
392418
],
393419
});

0 commit comments

Comments
 (0)