Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ async function main() {
const stackName = toStackName(spec.name, target.name);

// Extract credentials from deployed state for this target
const targetState = (deployedState as Record<string, unknown>)?.targets as Record<string, Record<string, unknown>> | undefined;
const targetState = (deployedState as Record<string, unknown>)?.targets as
| Record<string, Record<string, unknown>>
| undefined;
const targetResources = targetState?.[target.name]?.resources as Record<string, unknown> | undefined;
const credentials = targetResources?.credentials as Record<string, { credentialProviderArn: string; clientSecretArn?: string }> | undefined;
const credentials = targetResources?.credentials as
| Record<string, { credentialProviderArn: string; clientSecretArn?: string }>
| undefined;

new AgentCoreStack(app, stackName, {
spec,
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/add/__tests__/add-gateway-target.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';

// MCP Tool feature is disabled (coming soon) - skip all tests
// Gateway Target feature is disabled (coming soon) - skip all tests
describe.skip('add gateway-target command', () => {
let testDir: string;
let projectDir: string;
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/add/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export async function handleAddGateway(options: ValidatedAddGatewayOptions): Pro
}
}

// MCP Tool handler
// Gateway Target handler
export function buildGatewayTargetConfig(options: ValidatedAddGatewayTargetOptions): AddGatewayTargetConfig {
const sourcePath = `${APP_DIR}/${MCP_APP_SUBDIR}/${options.name}`;

Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/add/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function handleAddGatewayTargetCLI(options: AddGatewayTargetOptions): Prom
if (options.json) {
console.log(JSON.stringify(result));
} else if (result.success) {
console.log(`Added MCP tool '${result.toolName}'`);
console.log(`Added gateway target '${result.toolName}'`);
if (result.sourcePath) {
console.log(`Tool code: ${result.sourcePath}`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/add/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface AddGatewayResult {
error?: string;
}

// MCP Tool types
// Gateway Target types
export interface AddGatewayTargetOptions {
name?: string;
description?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/add/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export function validateAddGatewayOptions(options: AddGatewayOptions): Validatio
return { valid: true };
}

// MCP Tool validation
// Gateway Target validation
export async function validateAddGatewayTargetOptions(options: AddGatewayTargetOptions): Promise<ValidationResult> {
if (!options.name) {
return { valid: false, error: '--name is required' };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';

// MCP Tool feature is disabled (coming soon) - skip all tests
// Gateway Target feature is disabled (coming soon) - skip all tests
describe.skip('remove gateway-target command', () => {
let testDir: string;
let projectDir: string;
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/remove/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ export async function handleRemove(options: ValidatedRemoveOptions): Promise<Rem
case 'gateway-target': {
const tools = await getRemovableGatewayTargets();
const tool = tools.find(t => t.name === name);
if (!tool) return { success: false, error: `MCP tool '${name}' not found` };
if (!tool) return { success: false, error: `Gateway target '${name}' not found` };
const result = await removeGatewayTarget(tool);
if (!result.ok) return { success: false, error: result.error };
return {
success: true,
resourceType,
resourceName: name,
message: `Removed MCP tool '${name}'`,
message: `Removed gateway target '${name}'`,
note: SOURCE_CODE_NOTE,
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/remove/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const registerRemove = (program: Command) => {
registerResourceRemove(removeCommand, 'memory', 'memory', 'Remove a memory provider from the project');
registerResourceRemove(removeCommand, 'identity', 'identity', 'Remove an identity provider from the project');

registerResourceRemove(removeCommand, 'gateway-target', 'gateway-target', 'Remove an MCP tool from the project');
registerResourceRemove(removeCommand, 'gateway-target', 'gateway-target', 'Remove a gateway target from the project');

registerResourceRemove(removeCommand, 'gateway', 'gateway', 'Remove a gateway from the project');

Expand Down
8 changes: 4 additions & 4 deletions src/cli/operations/mcp/create-mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function readMcpDefs(filePath: string): Promise<AgentCoreCliMcpDefs> {
const parsed = JSON.parse(raw) as unknown;
const result = AgentCoreCliMcpDefsSchema.safeParse(parsed);
if (!result.success) {
throw new Error('Invalid mcp-defs.json. Fix it before adding a new MCP tool.');
throw new Error('Invalid mcp-defs.json. Fix it before adding a new gateway target.');
}
return result.data;
}
Expand Down Expand Up @@ -211,7 +211,7 @@ export async function createGatewayFromWizard(config: AddGatewayConfig): Promise

function validateGatewayTargetLanguage(language: string): asserts language is 'Python' | 'TypeScript' | 'Other' {
if (language !== 'Python' && language !== 'TypeScript' && language !== 'Other') {
throw new Error(`MCP tools for language "${language}" are not yet supported.`);
throw new Error(`Gateway targets for language "${language}" are not yet supported.`);
}
}

Expand Down Expand Up @@ -288,7 +288,7 @@ export async function createExternalGatewayTarget(config: AddGatewayTargetConfig
}

/**
* Create an MCP tool (behind gateway only).
* Create a gateway target (behind gateway only).
*/
export async function createToolFromWizard(config: AddGatewayTargetConfig): Promise<CreateToolResult> {
validateGatewayTargetLanguage(config.language);
Expand Down Expand Up @@ -400,7 +400,7 @@ export async function createToolFromWizard(config: AddGatewayTargetConfig): Prom
throw new Error(`MCP saved, but failed to update mcp-defs.json: ${message}`);
}

// Render MCP tool project template
// Render gateway target project template
// Resolve absolute path from project root
const configRoot = requireConfigRoot();
const projectRoot = dirname(configRoot);
Expand Down
8 changes: 4 additions & 4 deletions src/cli/operations/remove/remove-gateway-target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { rm } from 'fs/promises';
import { join } from 'path';

/**
* Represents an MCP tool that can be removed.
* Represents a gateway target that can be removed.
*/
export interface RemovableGatewayTarget {
name: string;
Expand All @@ -15,7 +15,7 @@ export interface RemovableGatewayTarget {
}

/**
* Get list of MCP tools available for removal.
* Get list of gateway targets available for removal.
*/
export async function getRemovableGatewayTargets(): Promise<RemovableGatewayTarget[]> {
try {
Expand Down Expand Up @@ -44,7 +44,7 @@ export async function getRemovableGatewayTargets(): Promise<RemovableGatewayTarg
}

/**
* Compute the preview of what will be removed when removing an MCP tool.
* Compute the preview of what will be removed when removing a gateway target.
*/
export async function previewRemoveGatewayTarget(tool: RemovableGatewayTarget): Promise<RemovalPreview> {
const configIO = new ConfigIO();
Expand Down Expand Up @@ -150,7 +150,7 @@ function computeRemovedToolMcpDefs(
}

/**
* Remove an MCP tool from the project.
* Remove a gateway target from the project.
*/
export async function removeGatewayTarget(tool: RemovableGatewayTarget): Promise<RemovalResult> {
try {
Expand Down
6 changes: 3 additions & 3 deletions src/cli/templates/GatewayTargetRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const LAMBDA_TEMPLATE_TOOLS: ToolDefinition[] = [
*/
export function getTemplateToolDefinitions(toolName: string, host: ComputeHost): ToolDefinition[] {
if (host === 'Lambda') {
// Prefix template tool names with the MCP tool name to avoid conflicts
// Prefix template tool names with the gateway target name to avoid conflicts
// when adding multiple Lambda tools to the same project
return LAMBDA_TEMPLATE_TOOLS.map(tool => ({
...tool,
Expand All @@ -62,7 +62,7 @@ export function getTemplateToolDefinitions(toolName: string, host: ComputeHost):
}

/**
* Renders an MCP tool project template to the specified output directory.
* Renders a gateway target project template to the specified output directory.
* @param toolName - Name of the tool (used for {{ Name }} substitution)
* @param outputDir - Target directory for the project
* @param language - Target language ('Python' or 'TypeScript')
Expand All @@ -75,7 +75,7 @@ export async function renderGatewayTargetTemplate(
host: ComputeHost = 'AgentCoreRuntime'
): Promise<void> {
if (language !== 'Python') {
throw new Error(`MCP tool templates for ${language} are not yet supported.`);
throw new Error(`Gateway target templates for ${language} are not yet supported.`);
}

// Select template based on compute host
Expand Down
2 changes: 1 addition & 1 deletion src/cli/tui/hooks/useCreateMcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function useCreateGatewayTarget() {
setStatus({ state: 'success', result });
return { ok: true as const, result };
} catch (err) {
const message = err instanceof Error ? err.message : 'Failed to create MCP tool.';
const message = err instanceof Error ? err.message : 'Failed to create gateway target.';
setStatus({ state: 'error', error: message });
return { ok: false as const, error: message };
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/tui/screens/add/AddFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export function AddFlow(props: AddFlowProps) {
);
}

// MCP Tool wizard - now uses AddGatewayTargetFlow with mode selection
// Gateway Target wizard - uses AddGatewayTargetFlow
if (flow.name === 'tool-wizard') {
return (
<AddGatewayTargetFlow
Expand Down
4 changes: 2 additions & 2 deletions src/cli/tui/screens/add/AddScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const ADD_RESOURCES = [
{ id: 'agent', title: 'Agent', description: 'New or existing agent code' },
{ id: 'memory', title: 'Memory', description: 'Persistent context storage' },
{ id: 'identity', title: 'Identity', description: 'API key credential providers' },
{ id: 'gateway', title: 'Gateway', description: 'Route and manage MCP tools' },
{ id: 'gateway-target', title: 'MCP Tool', description: 'Extend agent capabilities' },
{ id: 'gateway', title: 'Gateway', description: 'Route and manage gateway targets' },
{ id: 'gateway-target', title: 'Gateway Target', description: 'Extend agent capabilities' },
] as const;

export type AddResourceType = (typeof ADD_RESOURCES)[number]['id'];
Expand Down
2 changes: 1 addition & 1 deletion src/cli/tui/screens/add/__tests__/AddScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('AddScreen', () => {
const { lastFrame } = render(<AddScreen onSelect={onSelect} onExit={onExit} hasAgents={true} />);

expect(lastFrame()).toContain('Gateway');
expect(lastFrame()).toContain('MCP Tool');
expect(lastFrame()).toContain('Gateway Target');
expect(lastFrame()).not.toContain('Add an agent first');
});
});
Loading
Loading