Skip to content
Draft
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 @@ -6903,6 +6903,7 @@ description = "AgentCore MCP Server"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"aws-opentelemetry-distro",
"mcp >= 1.19.0",
]

Expand Down
1 change: 1 addition & 0 deletions src/assets/python/mcp/standalone/base/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description = "AgentCore MCP Server"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"aws-opentelemetry-distro",
"mcp >= 1.19.0",
]

Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/import/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function toAgentEnvSpec(agent: ParsedStarterToolkitConfig['agents'][0]): AgentEn
runtimeVersion: (agent.runtimeVersion ?? 'PYTHON_3_12') as any,
protocol: agent.protocol,
networkMode: agent.networkMode,
instrumentation: { enableOtel: agent.protocol === 'MCP' ? false : agent.enableOtel },
instrumentation: { enableOtel: agent.enableOtel },
};
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any */

Expand Down
20 changes: 20 additions & 0 deletions src/cli/operations/agent/generate/__tests__/schema-mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ describe('mapGenerateConfigToRenderConfig', () => {
const result = await mapGenerateConfigToRenderConfig(config, []);
expect(result.memoryProviders[0]!.strategies).toEqual(['SEMANTIC', 'USER_PREFERENCE', 'SUMMARIZATION', 'EPISODIC']);
});

it('enables OTel for MCP Python and disables it for MCP TypeScript', async () => {
const python = await mapGenerateConfigToRenderConfig({ ...baseConfig, protocol: 'MCP', language: 'Python' }, []);
const typescript = await mapGenerateConfigToRenderConfig(
{ ...baseConfig, protocol: 'MCP', language: 'TypeScript' },
[]
);
expect(python.enableOtel).toBe(true);
expect(typescript.enableOtel).toBe(false);
});
});

describe('mapGenerateConfigToAgent protocol mode', () => {
Expand All @@ -205,6 +215,16 @@ describe('mapGenerateConfigToAgent protocol mode', () => {
expect(result).not.toHaveProperty('modelProvider');
});

it('does not force OTel off for MCP Python (schema default enables it)', () => {
const result = mapGenerateConfigToAgent({ ...baseConfig, protocol: 'MCP', language: 'Python' });
expect(result).not.toHaveProperty('instrumentation');
});

it('keeps OTel off for MCP TypeScript', () => {
const result = mapGenerateConfigToAgent({ ...baseConfig, protocol: 'MCP', language: 'TypeScript' });
expect(result.instrumentation).toEqual({ enableOtel: false });
});

it('sets protocol to HTTP explicitly', () => {
const httpConfig: GenerateConfig = {
...baseConfig,
Expand Down
4 changes: 2 additions & 2 deletions src/cli/operations/agent/generate/schema-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export function mapGenerateConfigToAgent(config: GenerateConfig): AgentEnvSpec {
}
: {}),
...buildFilesystemConfigurations(config.sessionStorageMountPath, config.efsAccessPoints, config.s3AccessPoints),
...(protocol === 'MCP' && { instrumentation: { enableOtel: false } }),
...(protocol === 'MCP' && config.language === 'TypeScript' && { instrumentation: { enableOtel: false } }),
};
}

Expand Down Expand Up @@ -269,7 +269,7 @@ export async function mapGenerateConfigToRenderConfig(
): Promise<AgentRenderConfig> {
const isMcp = config.protocol === 'MCP';
const gatewayProviders = isMcp ? [] : await mapGatewaysToGatewayProviders();
const enableOtel = !isMcp && config.language !== 'TypeScript';
const enableOtel = config.language !== 'TypeScript';

return {
name: config.projectName,
Expand Down
Loading