Skip to content

Commit 6d6d2cf

Browse files
committed
revert agentcore usecase
1 parent 212a542 commit 6d6d2cf

File tree

20 files changed

+390
-155
lines changed

20 files changed

+390
-155
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"_comment": "MCP Server Configuration",
3+
"_metadata_info": {
4+
"description": "Each server can include a 'metadata' object with 'category' and 'description' fields",
5+
"category_examples": [
6+
"AWS",
7+
"AI/ML",
8+
"Utility",
9+
"Search",
10+
"Development",
11+
"Other"
12+
]
13+
},
14+
"mcpServers": {
15+
"time": {
16+
"command": "uvx",
17+
"args": ["mcp-server-time"],
18+
"metadata": {
19+
"category": "Utility",
20+
"description": "Provides current time and date functionality"
21+
}
22+
},
23+
"aws-knowledge-mcp-server": {
24+
"command": "npx",
25+
"args": ["mcp-remote", "https://knowledge-mcp.global.api.aws"],
26+
"metadata": {
27+
"category": "AWS",
28+
"description": "AWS Knowledge Base MCP server for enterprise knowledge access"
29+
}
30+
},
31+
"awslabs.aws-documentation-mcp-server": {
32+
"command": "uvx",
33+
"args": ["awslabs.aws-documentation-mcp-server@latest"],
34+
"metadata": {
35+
"category": "AWS",
36+
"description": "Access AWS documentation and guides"
37+
}
38+
},
39+
"awslabs.cdk-mcp-server": {
40+
"command": "uvx",
41+
"args": ["awslabs.cdk-mcp-server@latest"],
42+
"metadata": {
43+
"category": "AWS",
44+
"description": "AWS CDK code generation and assistance"
45+
}
46+
},
47+
"awslabs.aws-diagram-mcp-server": {
48+
"command": "uvx",
49+
"args": ["awslabs.aws-diagram-mcp-server@latest"],
50+
"metadata": {
51+
"category": "AWS",
52+
"description": "Generate AWS architecture diagrams"
53+
}
54+
},
55+
"awslabs.nova-canvas-mcp-server": {
56+
"command": "uvx",
57+
"args": ["awslabs.nova-canvas-mcp-server@latest"],
58+
"env": {
59+
"AWS_REGION": "us-east-1"
60+
},
61+
"metadata": {
62+
"category": "AI/ML",
63+
"description": "Amazon Nova Canvas image generation"
64+
}
65+
},
66+
"tavily-search": {
67+
"command": "npx",
68+
"args": [
69+
"-y",
70+
"mcp-remote",
71+
"https://mcp.tavily.com/mcp/?tavilyApiKey=<key>"
72+
],
73+
"metadata": {
74+
"category": "Search",
75+
"description": "Web search and research capabilities powered by Tavily"
76+
}
77+
}
78+
}
79+
}

packages/cdk/cdk.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"inlineAgents": false,
6464
"mcpEnabled": false,
6565
"flows": [],
66+
"agentBuilderEnabled": false,
6667
"createGenericAgentCoreRuntime": false,
6768
"agentCoreExternalRuntimes": [],
6869
"allowedIpV4AddressRanges": null,

packages/cdk/lambda-python/generic-agent-core-runtime/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COPY pyproject.toml .python-version uv.lock ./
2121
RUN uv sync
2222

2323
# Copy application files
24-
COPY app.py mcp.json ./
24+
COPY app.py ./
2525
COPY src/ ./src/
2626

2727
# Expose port 8080 as required by AgentCore

packages/cdk/lambda-python/generic-agent-core-runtime/docker-compose.yml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ services:
2121
- PYTHONUNBUFFERED=1
2222
- LOG_LEVEL=INFO
2323

24-
# Code Interpreter settings (optional)
25-
- CODE_INTERPRETER_REGION=${AWS_REGION:-us-east-1}
26-
27-
# Browser tool settings (optional)
28-
- STRANDS_BROWSER_HEADLESS=true
29-
- STRANDS_BROWSER_WIDTH=1280
30-
- STRANDS_BROWSER_HEIGHT=800
3124
- DISPLAY=:99
3225
- CHROMIUM_PATH=/usr/bin/chromium
3326
volumes:
@@ -45,19 +38,3 @@ services:
4538
retries: 3
4639
start_period: 40s
4740
restart: unless-stopped
48-
49-
# Optional: Add a simple test client
50-
test-client:
51-
image: curlimages/curl:latest
52-
depends_on:
53-
- generic-agent-core-runtime
54-
command: >
55-
sh -c "
56-
echo 'Waiting for service to be ready...' &&
57-
sleep 10 &&
58-
echo 'Testing health endpoint...' &&
59-
curl -f http://generic-agent-core-runtime:8080/ping &&
60-
echo 'Health check passed!'
61-
"
62-
profiles:
63-
- test

packages/cdk/lambda-python/generic-agent-core-runtime/src/tools.py

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,29 @@ def set_session_info(self, session_id: str, trace_id: str):
4040
self.trace_id = trace_id
4141

4242
def load_mcp_tools(self) -> list[Any]:
43-
"""Load MCP tools from mcp.json"""
43+
"""Load MCP tools from environment variable or mcp.json file"""
4444
if self.mcp_tools is not None:
4545
return self.mcp_tools
4646

4747
try:
48-
# Load MCP configuration from mcp.json file
49-
mcp_config_path = "mcp.json"
50-
if not os.path.exists(mcp_config_path):
51-
logger.warning(f"MCP configuration file not found at {mcp_config_path}")
52-
self.mcp_tools = []
53-
return self.mcp_tools
48+
# First try to load from environment variable
49+
mcp_servers_env = os.environ.get("MCP_SERVERS")
50+
if mcp_servers_env:
51+
logger.info("Loading MCP configuration from environment variable")
52+
mcp_servers = json.loads(mcp_servers_env)
53+
else:
54+
# Fallback to mcp.json file
55+
logger.info("Loading MCP configuration from mcp.json file")
56+
mcp_config_path = "mcp.json"
57+
if not os.path.exists(mcp_config_path):
58+
logger.warning(f"MCP configuration file not found at {mcp_config_path}")
59+
self.mcp_tools = []
60+
return self.mcp_tools
61+
62+
with open(mcp_config_path) as f:
63+
mcp_config = json.load(f)
64+
mcp_servers = mcp_config.get("mcpServers", {})
5465

55-
with open(mcp_config_path) as f:
56-
mcp_config = json.load(f)
57-
58-
mcp_servers = mcp_config.get("mcpServers", {})
5966
mcp_clients = []
6067
uv_env = get_uv_environment()
6168

@@ -86,27 +93,32 @@ def load_mcp_tools(self) -> list[Any]:
8693
return self.mcp_tools
8794

8895
def load_mcp_tools_by_names(self, server_names: list[str]) -> list[Any]:
89-
"""Load MCP tools from environment variable by server names"""
96+
"""Load MCP tools from environment variable or mcp.json by server names"""
9097
if not server_names:
9198
return []
9299

93100
try:
94-
# Load MCP configuration from mcp.json file
95-
# Try multiple possible paths
96-
mcp_config_path = "mcp.json"
97-
98-
logger.info(f"Loading MCP configuration from: {mcp_config_path}")
99-
with open(mcp_config_path) as f:
100-
mcp_config = json.load(f)
101+
# First try to load from environment variable
102+
mcp_servers_env = os.environ.get("MCP_SERVERS")
103+
if mcp_servers_env:
104+
logger.info("Loading MCP configuration from environment variable")
105+
available_servers = json.loads(mcp_servers_env)
106+
else:
107+
# Fallback to mcp.json file
108+
logger.info("Loading MCP configuration from mcp.json file")
109+
mcp_config_path = "mcp.json"
110+
logger.info(f"Loading MCP configuration from: {mcp_config_path}")
111+
with open(mcp_config_path) as f:
112+
mcp_config = json.load(f)
113+
available_servers = mcp_config.get("mcpServers", {})
101114

102-
available_servers = mcp_config.get("mcpServers", {})
103115
logger.info(f"Found {len(available_servers)} available MCP servers")
104116
mcp_clients = []
105117
uv_env = get_uv_environment()
106118

107119
for server_name in server_names:
108120
if server_name not in available_servers:
109-
logger.warning(f"MCP server '{server_name}' not found in mcp.json")
121+
logger.warning(f"MCP server '{server_name}' not found in configuration")
110122
continue
111123

112124
server_config = available_servers[server_name]

packages/cdk/lib/agent-core-stack.ts

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,39 @@ export class AgentCoreStack extends Stack {
1616

1717
const params = props.params;
1818

19-
// Deploy Generic AgentCore Runtime if enabled
20-
if (params.createGenericAgentCoreRuntime) {
19+
// Deploy Generic AgentCore Runtime if either generic or agentBuilder is enabled
20+
if (params.createGenericAgentCoreRuntime || params.agentBuilderEnabled) {
2121
this.genericAgentCore = new GenericAgentCore(this, 'GenericAgentCore', {
2222
env: params.env,
23+
createGenericRuntime: params.createGenericAgentCoreRuntime,
24+
createAgentBuilderRuntime: params.agentBuilderEnabled,
2325
});
2426

25-
// Output the runtime ARN for cross-stack reference
26-
new CfnOutput(this, 'GenericAgentCoreRuntimeArn', {
27-
value: this.genericAgentCore.deployedGenericRuntimeArn || '',
28-
exportName: `${this.stackName}-GenericAgentCoreRuntimeArn`,
29-
});
27+
// Output the generic runtime ARN for cross-stack reference
28+
if (params.createGenericAgentCoreRuntime) {
29+
new CfnOutput(this, 'GenericAgentCoreRuntimeArn', {
30+
value: this.genericAgentCore.deployedGenericRuntimeArn || '',
31+
exportName: `${this.stackName}-GenericAgentCoreRuntimeArn`,
32+
});
3033

31-
new CfnOutput(this, 'GenericAgentCoreRuntimeName', {
32-
value: this.genericAgentCore.getGenericRuntimeConfig().name,
33-
exportName: `${this.stackName}-GenericAgentCoreRuntimeName`,
34-
});
34+
new CfnOutput(this, 'GenericAgentCoreRuntimeName', {
35+
value: this.genericAgentCore.getGenericRuntimeConfig().name,
36+
exportName: `${this.stackName}-GenericAgentCoreRuntimeName`,
37+
});
38+
}
39+
40+
// Output the AgentBuilder runtime ARN for cross-stack reference
41+
if (params.agentBuilderEnabled) {
42+
new CfnOutput(this, 'AgentBuilderAgentCoreRuntimeArn', {
43+
value: this.genericAgentCore.deployedAgentBuilderRuntimeArn || '',
44+
exportName: `${this.stackName}-AgentBuilderAgentCoreRuntimeArn`,
45+
});
46+
47+
new CfnOutput(this, 'AgentBuilderAgentCoreRuntimeName', {
48+
value: this.genericAgentCore.getAgentBuilderRuntimeConfig().name,
49+
exportName: `${this.stackName}-AgentBuilderAgentCoreRuntimeName`,
50+
});
51+
}
3552
}
3653
}
3754

@@ -42,13 +59,27 @@ export class AgentCoreStack extends Stack {
4259
return this.genericAgentCore?.deployedGenericRuntimeArn;
4360
}
4461

62+
/**
63+
* Get the deployed AgentBuilder runtime ARN
64+
*/
65+
public get deployedAgentBuilderRuntimeArn(): string | undefined {
66+
return this.genericAgentCore?.deployedAgentBuilderRuntimeArn;
67+
}
68+
4569
/**
4670
* Get the generic runtime configuration
4771
*/
4872
public getGenericRuntimeConfig() {
4973
return this.genericAgentCore?.getGenericRuntimeConfig();
5074
}
5175

76+
/**
77+
* Get the AgentBuilder runtime configuration
78+
*/
79+
public getAgentBuilderRuntimeConfig() {
80+
return this.genericAgentCore?.getAgentBuilderRuntimeConfig();
81+
}
82+
5283
/**
5384
* Get the file bucket for Agent Core Runtime
5485
*/

0 commit comments

Comments
 (0)