@aws/agentcore 0.3.0-preview.5.0 → 0.3.0-preview.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +1124 -97
  2. package/dist/assets/cdk/package.json +1 -1
  3. package/dist/assets/cdk/test/cdk.test.ts +2 -0
  4. package/dist/assets/python/a2a/googleadk/base/README.md +22 -0
  5. package/dist/assets/python/a2a/googleadk/base/main.py +48 -0
  6. package/dist/assets/python/a2a/googleadk/base/pyproject.toml +20 -0
  7. package/dist/assets/python/a2a/langchain_langgraph/base/README.md +22 -0
  8. package/dist/assets/python/a2a/langchain_langgraph/base/main.py +64 -0
  9. package/dist/assets/python/a2a/langchain_langgraph/base/pyproject.toml +24 -0
  10. package/dist/assets/python/a2a/strands/base/README.md +22 -0
  11. package/dist/assets/python/a2a/strands/base/main.py +44 -0
  12. package/dist/assets/python/a2a/strands/base/pyproject.toml +23 -0
  13. package/dist/assets/python/a2a/strands/capabilities/memory/session.py +38 -0
  14. package/dist/assets/python/{autogen → http/autogen}/base/mcp_client/client.py +10 -0
  15. package/dist/assets/python/http/googleadk/base/gitignore.template +41 -0
  16. package/dist/assets/python/{googleadk → http/googleadk}/base/mcp_client/client.py +9 -0
  17. package/dist/assets/python/http/googleadk/base/model/load.py +41 -0
  18. package/dist/assets/python/http/langchain_langgraph/base/gitignore.template +41 -0
  19. package/dist/assets/python/{langchain_langgraph → http/langchain_langgraph}/base/mcp_client/client.py +9 -0
  20. package/dist/assets/python/http/langchain_langgraph/base/model/load.py +123 -0
  21. package/dist/assets/python/http/openaiagents/base/gitignore.template +41 -0
  22. package/dist/assets/python/{openaiagents → http/openaiagents}/base/mcp_client/client.py +9 -0
  23. package/dist/assets/python/http/openaiagents/base/model/__init__.py +1 -0
  24. package/dist/assets/python/http/strands/base/mcp_client/__init__.py +1 -0
  25. package/dist/assets/python/{strands → http/strands}/base/mcp_client/client.py +9 -0
  26. package/dist/assets/python/http/strands/base/model/__init__.py +1 -0
  27. package/dist/assets/python/http/strands/base/model/load.py +123 -0
  28. package/dist/assets/python/http/strands/capabilities/memory/__init__.py +1 -0
  29. package/dist/assets/python/mcp/standalone/base/README.md +36 -0
  30. package/dist/assets/python/mcp/standalone/base/gitignore.template +41 -0
  31. package/dist/assets/python/mcp/standalone/base/main.py +25 -0
  32. package/dist/assets/python/mcp/standalone/base/pyproject.toml +16 -0
  33. package/dist/cli/index.mjs +359 -321
  34. package/dist/lib/packaging/helpers.js +2 -2
  35. package/dist/lib/packaging/helpers.js.map +1 -1
  36. package/dist/lib/utils/index.d.ts +1 -0
  37. package/dist/lib/utils/index.d.ts.map +1 -1
  38. package/dist/lib/utils/index.js +3 -1
  39. package/dist/lib/utils/index.js.map +1 -1
  40. package/dist/lib/utils/json-rpc.d.ts +3 -0
  41. package/dist/lib/utils/json-rpc.d.ts.map +1 -0
  42. package/dist/lib/utils/json-rpc.js +27 -0
  43. package/dist/lib/utils/json-rpc.js.map +1 -0
  44. package/dist/schema/constants.d.ts +20 -1
  45. package/dist/schema/constants.d.ts.map +1 -1
  46. package/dist/schema/constants.js +29 -2
  47. package/dist/schema/constants.js.map +1 -1
  48. package/dist/schema/schemas/agent-env.d.ts +20 -2
  49. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  50. package/dist/schema/schemas/agent-env.js +37 -2
  51. package/dist/schema/schemas/agent-env.js.map +1 -1
  52. package/dist/schema/schemas/agentcore-project.d.ts +82 -1
  53. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  54. package/dist/schema/schemas/agentcore-project.js +59 -2
  55. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  56. package/dist/schema/schemas/deployed-state.d.ts +62 -0
  57. package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
  58. package/dist/schema/schemas/deployed-state.js +18 -1
  59. package/dist/schema/schemas/deployed-state.js.map +1 -1
  60. package/dist/schema/schemas/mcp.d.ts +25 -10
  61. package/dist/schema/schemas/mcp.d.ts.map +1 -1
  62. package/dist/schema/schemas/mcp.js +9 -1
  63. package/dist/schema/schemas/mcp.js.map +1 -1
  64. package/dist/schema/schemas/primitives/evaluator.d.ts +68 -0
  65. package/dist/schema/schemas/primitives/evaluator.d.ts.map +1 -0
  66. package/dist/schema/schemas/primitives/evaluator.js +58 -0
  67. package/dist/schema/schemas/primitives/evaluator.js.map +1 -0
  68. package/dist/schema/schemas/primitives/index.d.ts +4 -0
  69. package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
  70. package/dist/schema/schemas/primitives/index.js +14 -1
  71. package/dist/schema/schemas/primitives/index.js.map +1 -1
  72. package/dist/schema/schemas/primitives/online-eval-config.d.ts +13 -0
  73. package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -0
  74. package/dist/schema/schemas/primitives/online-eval-config.js +27 -0
  75. package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -0
  76. package/package.json +11 -5
  77. /package/dist/assets/python/{autogen → a2a/googleadk}/base/gitignore.template +0 -0
  78. /package/dist/assets/python/{autogen/base/mcp_client → a2a/googleadk/base/model}/__init__.py +0 -0
  79. /package/dist/assets/python/{googleadk → a2a/googleadk}/base/model/load.py +0 -0
  80. /package/dist/assets/python/{crewai → a2a/langchain_langgraph}/base/gitignore.template +0 -0
  81. /package/dist/assets/python/{autogen → a2a/langchain_langgraph}/base/model/__init__.py +0 -0
  82. /package/dist/assets/python/{langchain_langgraph → a2a/langchain_langgraph}/base/model/load.py +0 -0
  83. /package/dist/assets/python/{googleadk → a2a/strands}/base/gitignore.template +0 -0
  84. /package/dist/assets/python/{crewai → a2a/strands}/base/model/__init__.py +0 -0
  85. /package/dist/assets/python/{strands → a2a/strands}/base/model/load.py +0 -0
  86. /package/dist/assets/python/{googleadk/base/mcp_client → a2a/strands/capabilities/memory}/__init__.py +0 -0
  87. /package/dist/assets/python/{autogen → http/autogen}/base/README.md +0 -0
  88. /package/dist/assets/python/{langchain_langgraph → http/autogen}/base/gitignore.template +0 -0
  89. /package/dist/assets/python/{autogen → http/autogen}/base/main.py +0 -0
  90. /package/dist/assets/python/{googleadk/base/model → http/autogen/base/mcp_client}/__init__.py +0 -0
  91. /package/dist/assets/python/{langchain_langgraph/base/mcp_client → http/autogen/base/model}/__init__.py +0 -0
  92. /package/dist/assets/python/{autogen → http/autogen}/base/model/load.py +0 -0
  93. /package/dist/assets/python/{autogen → http/autogen}/base/pyproject.toml +0 -0
  94. /package/dist/assets/python/{crewai → http/crewai}/base/README.md +0 -0
  95. /package/dist/assets/python/{openaiagents → http/crewai}/base/gitignore.template +0 -0
  96. /package/dist/assets/python/{crewai → http/crewai}/base/main.py +0 -0
  97. /package/dist/assets/python/{langchain_langgraph → http/crewai}/base/model/__init__.py +0 -0
  98. /package/dist/assets/python/{crewai → http/crewai}/base/model/load.py +0 -0
  99. /package/dist/assets/python/{crewai → http/crewai}/base/pyproject.toml +0 -0
  100. /package/dist/assets/python/{googleadk → http/googleadk}/base/README.md +0 -0
  101. /package/dist/assets/python/{googleadk → http/googleadk}/base/main.py +0 -0
  102. /package/dist/assets/python/{openaiagents → http/googleadk}/base/mcp_client/__init__.py +0 -0
  103. /package/dist/assets/python/{openaiagents → http/googleadk}/base/model/__init__.py +0 -0
  104. /package/dist/assets/python/{googleadk → http/googleadk}/base/pyproject.toml +0 -0
  105. /package/dist/assets/python/{langchain_langgraph → http/langchain_langgraph}/base/README.md +0 -0
  106. /package/dist/assets/python/{langchain_langgraph → http/langchain_langgraph}/base/main.py +0 -0
  107. /package/dist/assets/python/{strands → http/langchain_langgraph}/base/mcp_client/__init__.py +0 -0
  108. /package/dist/assets/python/{strands → http/langchain_langgraph}/base/model/__init__.py +0 -0
  109. /package/dist/assets/python/{langchain_langgraph → http/langchain_langgraph}/base/pyproject.toml +0 -0
  110. /package/dist/assets/python/{openaiagents → http/openaiagents}/base/README.md +0 -0
  111. /package/dist/assets/python/{openaiagents → http/openaiagents}/base/main.py +0 -0
  112. /package/dist/assets/python/{strands/capabilities/memory → http/openaiagents/base/mcp_client}/__init__.py +0 -0
  113. /package/dist/assets/python/{openaiagents → http/openaiagents}/base/model/load.py +0 -0
  114. /package/dist/assets/python/{openaiagents → http/openaiagents}/base/pyproject.toml +0 -0
  115. /package/dist/assets/python/{strands → http/strands}/base/README.md +0 -0
  116. /package/dist/assets/python/{strands → http/strands}/base/gitignore.template +0 -0
  117. /package/dist/assets/python/{strands → http/strands}/base/main.py +0 -0
  118. /package/dist/assets/python/{strands → http/strands}/base/pyproject.toml +0 -0
  119. /package/dist/assets/python/{strands → http/strands}/capabilities/memory/session.py +0 -0
@@ -0,0 +1,41 @@
1
+ # Environment variables
2
+ .env
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+ *.so
9
+ .Python
10
+ build/
11
+ develop-eggs/
12
+ dist/
13
+ downloads/
14
+ eggs/
15
+ .eggs/
16
+ lib/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ wheels/
22
+ *.egg-info/
23
+ .installed.cfg
24
+ *.egg
25
+
26
+ # Virtual environments
27
+ .venv/
28
+ venv/
29
+ ENV/
30
+ env/
31
+
32
+ # IDE
33
+ .vscode/
34
+ .idea/
35
+ *.swp
36
+ *.swo
37
+ *~
38
+
39
+ # OS
40
+ .DS_Store
41
+ Thumbs.db
@@ -52,6 +52,14 @@ def get_all_gateway_mcp_servers() -> list[MCPServerStreamableHttp]:
52
52
  {{/each}}
53
53
  return servers
54
54
  {{else}}
55
+ {{#if isVpc}}
56
+ # VPC mode: external MCP endpoints are not reachable without a NAT gateway.
57
+ # Add an AgentCore Gateway with `agentcore add gateway`, or configure your own endpoint below.
58
+
59
+ def get_streamable_http_mcp_client() -> MCPServerStreamableHttp | None:
60
+ """No MCP server configured. Add a gateway with `agentcore add gateway`."""
61
+ return None
62
+ {{else}}
55
63
  # ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
56
64
  EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
57
65
 
@@ -63,3 +71,4 @@ def get_streamable_http_mcp_client() -> MCPServerStreamableHttp:
63
71
  name="AgentCore Gateway MCP", params={"url": EXAMPLE_MCP_ENDPOINT}
64
72
  )
65
73
  {{/if}}
74
+ {{/if}}
@@ -0,0 +1 @@
1
+ # Package marker
@@ -0,0 +1 @@
1
+ # Package marker
@@ -54,6 +54,14 @@ def get_all_gateway_mcp_clients() -> list[MCPClient]:
54
54
  {{/each}}
55
55
  return clients
56
56
  {{else}}
57
+ {{#if isVpc}}
58
+ # VPC mode: external MCP endpoints are not reachable without a NAT gateway.
59
+ # Add an AgentCore Gateway with `agentcore add gateway`, or configure your own endpoint below.
60
+
61
+ def get_streamable_http_mcp_client() -> MCPClient | None:
62
+ """No MCP server configured. Add a gateway with `agentcore add gateway`."""
63
+ return None
64
+ {{else}}
57
65
  # ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
58
66
  EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
59
67
 
@@ -62,3 +70,4 @@ def get_streamable_http_mcp_client() -> MCPClient:
62
70
  # to use an MCP server that supports bearer authentication, add headers={"Authorization": f"Bearer {access_token}"}
63
71
  return MCPClient(lambda: streamablehttp_client(EXAMPLE_MCP_ENDPOINT))
64
72
  {{/if}}
73
+ {{/if}}
@@ -0,0 +1 @@
1
+ # Package marker
@@ -0,0 +1,123 @@
1
+ {{#if (eq modelProvider "Bedrock")}}
2
+ from strands.models.bedrock import BedrockModel
3
+
4
+
5
+ def load_model() -> BedrockModel:
6
+ """Get Bedrock model client using IAM credentials."""
7
+ return BedrockModel(model_id="global.anthropic.claude-sonnet-4-5-20250929-v1:0")
8
+ {{/if}}
9
+ {{#if (eq modelProvider "Anthropic")}}
10
+ import os
11
+
12
+ from strands.models.anthropic import AnthropicModel
13
+ from bedrock_agentcore.identity.auth import requires_api_key
14
+
15
+ IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
16
+ IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
17
+
18
+
19
+ @requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
20
+ def _agentcore_identity_api_key_provider(api_key: str) -> str:
21
+ """Fetch API key from AgentCore Identity."""
22
+ return api_key
23
+
24
+
25
+ def _get_api_key() -> str:
26
+ """
27
+ Uses AgentCore Identity for API key management in deployed environments.
28
+ For local development, run via 'agentcore dev' which loads agentcore/.env.
29
+ """
30
+ if os.getenv("LOCAL_DEV") == "1":
31
+ api_key = os.getenv(IDENTITY_ENV_VAR)
32
+ if not api_key:
33
+ raise RuntimeError(
34
+ f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
35
+ )
36
+ return api_key
37
+ return _agentcore_identity_api_key_provider()
38
+
39
+
40
+ def load_model() -> AnthropicModel:
41
+ """Get authenticated Anthropic model client."""
42
+ return AnthropicModel(
43
+ client_args={"api_key": _get_api_key()},
44
+ model_id="claude-sonnet-4-5-20250929",
45
+ max_tokens=5000,
46
+ )
47
+ {{/if}}
48
+ {{#if (eq modelProvider "OpenAI")}}
49
+ import os
50
+
51
+ from strands.models.openai import OpenAIModel
52
+ from bedrock_agentcore.identity.auth import requires_api_key
53
+
54
+ IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
55
+ IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
56
+
57
+
58
+ @requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
59
+ def _agentcore_identity_api_key_provider(api_key: str) -> str:
60
+ """Fetch API key from AgentCore Identity."""
61
+ return api_key
62
+
63
+
64
+ def _get_api_key() -> str:
65
+ """
66
+ Uses AgentCore Identity for API key management in deployed environments.
67
+ For local development, run via 'agentcore dev' which loads agentcore/.env.
68
+ """
69
+ if os.getenv("LOCAL_DEV") == "1":
70
+ api_key = os.getenv(IDENTITY_ENV_VAR)
71
+ if not api_key:
72
+ raise RuntimeError(
73
+ f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
74
+ )
75
+ return api_key
76
+ return _agentcore_identity_api_key_provider()
77
+
78
+
79
+ def load_model() -> OpenAIModel:
80
+ """Get authenticated OpenAI model client."""
81
+ return OpenAIModel(
82
+ client_args={"api_key": _get_api_key()},
83
+ model_id="gpt-4.1",
84
+ )
85
+ {{/if}}
86
+ {{#if (eq modelProvider "Gemini")}}
87
+ import os
88
+
89
+ from strands.models.gemini import GeminiModel
90
+ from bedrock_agentcore.identity.auth import requires_api_key
91
+
92
+ IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
93
+ IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
94
+
95
+
96
+ @requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
97
+ def _agentcore_identity_api_key_provider(api_key: str) -> str:
98
+ """Fetch API key from AgentCore Identity."""
99
+ return api_key
100
+
101
+
102
+ def _get_api_key() -> str:
103
+ """
104
+ Uses AgentCore Identity for API key management in deployed environments.
105
+ For local development, run via 'agentcore dev' which loads agentcore/.env.
106
+ """
107
+ if os.getenv("LOCAL_DEV") == "1":
108
+ api_key = os.getenv(IDENTITY_ENV_VAR)
109
+ if not api_key:
110
+ raise RuntimeError(
111
+ f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
112
+ )
113
+ return api_key
114
+ return _agentcore_identity_api_key_provider()
115
+
116
+
117
+ def load_model() -> GeminiModel:
118
+ """Get authenticated Gemini model client."""
119
+ return GeminiModel(
120
+ client_args={"api_key": _get_api_key()},
121
+ model_id="gemini-2.5-flash",
122
+ )
123
+ {{/if}}
@@ -0,0 +1,36 @@
1
+ # {{ name }}
2
+
3
+ An MCP (Model Context Protocol) server deployed on Amazon Bedrock AgentCore.
4
+
5
+ ## Overview
6
+
7
+ This project implements an MCP server using FastMCP. MCP servers expose tools that can be consumed by MCP clients (other agents or applications).
8
+
9
+ ## Local Development
10
+
11
+ ```bash
12
+ # Install dependencies
13
+ uv sync
14
+
15
+ # Run the MCP server locally
16
+ uv run python main.py
17
+ ```
18
+
19
+ The server starts on port 8000 with Streamable HTTP transport.
20
+
21
+ ## Adding Tools
22
+
23
+ Define tools using the `@mcp.tool()` decorator in `main.py`:
24
+
25
+ ```python
26
+ @mcp.tool()
27
+ def my_tool(param: str) -> str:
28
+ """Description of what the tool does."""
29
+ return f"Result: {param}"
30
+ ```
31
+
32
+ ## Deploy
33
+
34
+ ```bash
35
+ agentcore deploy
36
+ ```
@@ -0,0 +1,41 @@
1
+ # Environment variables
2
+ .env
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+ *.so
9
+ .Python
10
+ build/
11
+ develop-eggs/
12
+ dist/
13
+ downloads/
14
+ eggs/
15
+ .eggs/
16
+ lib/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ wheels/
22
+ *.egg-info/
23
+ .installed.cfg
24
+ *.egg
25
+
26
+ # Virtual environments
27
+ .venv/
28
+ venv/
29
+ ENV/
30
+ env/
31
+
32
+ # IDE
33
+ .vscode/
34
+ .idea/
35
+ *.swp
36
+ *.swo
37
+ *~
38
+
39
+ # OS
40
+ .DS_Store
41
+ Thumbs.db
@@ -0,0 +1,25 @@
1
+ from mcp.server.fastmcp import FastMCP
2
+
3
+ mcp = FastMCP("{{ name }}", host="0.0.0.0", stateless_http=True)
4
+
5
+
6
+ @mcp.tool()
7
+ def add_numbers(a: int, b: int) -> int:
8
+ """Add two numbers together"""
9
+ return a + b
10
+
11
+
12
+ @mcp.tool()
13
+ def multiply_numbers(a: int, b: int) -> int:
14
+ """Multiply two numbers together"""
15
+ return a * b
16
+
17
+
18
+ @mcp.tool()
19
+ def greet_user(name: str) -> str:
20
+ """Greet a user by name"""
21
+ return f"Hello, {name}! Nice to meet you."
22
+
23
+
24
+ if __name__ == "__main__":
25
+ mcp.run(transport="streamable-http")
@@ -0,0 +1,16 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "{{ name }}"
7
+ version = "0.1.0"
8
+ description = "AgentCore MCP Server"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "mcp >= 1.19.0",
13
+ ]
14
+
15
+ [tool.hatch.build.targets.wheel]
16
+ packages = ["."]