@aws/nx-plugin-mcp 1.0.0-rc.72 → 1.0.0-rc.74
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.
package/bin/aws-nx-mcp.js
CHANGED
|
@@ -20801,27 +20801,27 @@ const NX_VERSION = {
|
|
|
20801
20801
|
"@aws/aws-distro-opentelemetry-node-autoinstrumentation": "0.12.0",
|
|
20802
20802
|
"@opentelemetry/propagator-jaeger": "2.10.0",
|
|
20803
20803
|
minimatch: "10.2.6",
|
|
20804
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
20805
|
-
"@aws-sdk/client-api-gateway": "3.
|
|
20806
|
-
"@aws-sdk/client-iam": "3.
|
|
20807
|
-
"@aws-sdk/client-bedrock-agentcore": "3.
|
|
20808
|
-
"@aws-sdk/client-bedrock-runtime": "3.
|
|
20809
|
-
"@aws-sdk/client-s3": "3.
|
|
20810
|
-
"@aws-sdk/client-sts": "3.
|
|
20811
|
-
"@aws-sdk/credential-providers": "3.
|
|
20812
|
-
"@aws-sdk/credential-provider-cognito-identity": "3.972.
|
|
20813
|
-
"@aws-sdk/client-secrets-manager": "3.
|
|
20814
|
-
"@aws-sdk/rds-signer": "3.
|
|
20815
|
-
"@smithy/server-apigateway": "0.
|
|
20816
|
-
"@smithy/server-node": "0.
|
|
20804
|
+
"@aws-sdk/client-dynamodb": "3.1111.0",
|
|
20805
|
+
"@aws-sdk/client-api-gateway": "3.1111.0",
|
|
20806
|
+
"@aws-sdk/client-iam": "3.1111.0",
|
|
20807
|
+
"@aws-sdk/client-bedrock-agentcore": "3.1111.0",
|
|
20808
|
+
"@aws-sdk/client-bedrock-runtime": "3.1111.0",
|
|
20809
|
+
"@aws-sdk/client-s3": "3.1111.0",
|
|
20810
|
+
"@aws-sdk/client-sts": "3.1111.0",
|
|
20811
|
+
"@aws-sdk/credential-providers": "3.1111.0",
|
|
20812
|
+
"@aws-sdk/credential-provider-cognito-identity": "3.972.68",
|
|
20813
|
+
"@aws-sdk/client-secrets-manager": "3.1111.0",
|
|
20814
|
+
"@aws-sdk/rds-signer": "3.1111.0",
|
|
20815
|
+
"@smithy/server-apigateway": "0.3.3",
|
|
20816
|
+
"@smithy/server-node": "0.3.3",
|
|
20817
20817
|
"@aws-lambda-powertools/logger": "2.34.0",
|
|
20818
20818
|
"@aws-lambda-powertools/metrics": "2.34.0",
|
|
20819
20819
|
"@aws-lambda-powertools/parameters": "2.34.0",
|
|
20820
20820
|
"@aws-lambda-powertools/tracer": "2.34.0",
|
|
20821
20821
|
"@aws-lambda-powertools/parser": "2.34.0",
|
|
20822
|
-
"@aws-sdk/client-appconfigdata": "3.
|
|
20823
|
-
"@middy/core": "7.7.
|
|
20824
|
-
"@nxlv/python": "
|
|
20822
|
+
"@aws-sdk/client-appconfigdata": "3.1111.0",
|
|
20823
|
+
"@middy/core": "7.7.4",
|
|
20824
|
+
"@nxlv/python": "23.0.0",
|
|
20825
20825
|
"@nx-extend/terraform": "10.4.1",
|
|
20826
20826
|
nx: "23.1.1",
|
|
20827
20827
|
"@nx/devkit": "23.1.1",
|
|
@@ -20832,27 +20832,27 @@ const NX_VERSION = {
|
|
|
20832
20832
|
"@nx/workspace": "23.1.1",
|
|
20833
20833
|
"create-nx-workspace": "23.1.1",
|
|
20834
20834
|
"@swc-node/register": "1.12.1",
|
|
20835
|
-
"@swc/core": "1.
|
|
20835
|
+
"@swc/core": "1.16.0",
|
|
20836
20836
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
20837
|
-
"@modelcontextprotocol/inspector": "
|
|
20837
|
+
"@modelcontextprotocol/inspector": "2.2.0",
|
|
20838
20838
|
"@ag-ui/a2ui-toolkit": "0.0.4",
|
|
20839
20839
|
"@ag-ui/aws-strands": "0.2.3",
|
|
20840
20840
|
"@ag-ui/client": "0.0.57",
|
|
20841
20841
|
"@ag-ui/core": "0.0.57",
|
|
20842
20842
|
"@ag-ui/encoder": "0.0.57",
|
|
20843
20843
|
"agent-chat-cli": "0.3.0",
|
|
20844
|
-
"@copilotkit/react-core": "1.
|
|
20844
|
+
"@copilotkit/react-core": "1.68.1",
|
|
20845
20845
|
rxjs: "7.8.2",
|
|
20846
|
-
"@strands-agents/sdk": "1.
|
|
20847
|
-
"@tanstack/react-router": "1.170.
|
|
20848
|
-
"@tanstack/router-plugin": "1.168.
|
|
20849
|
-
"@tanstack/router-generator": "1.167.
|
|
20846
|
+
"@strands-agents/sdk": "1.13.0",
|
|
20847
|
+
"@tanstack/react-router": "1.170.29",
|
|
20848
|
+
"@tanstack/router-plugin": "1.168.32",
|
|
20849
|
+
"@tanstack/router-generator": "1.167.30",
|
|
20850
20850
|
"@tanstack/virtual-file-routes": "1.162.0",
|
|
20851
20851
|
"@tanstack/router-utils": "1.162.2",
|
|
20852
|
-
"@cloudscape-design/board-components": "3.0.
|
|
20853
|
-
"@cloudscape-design/chat-components": "1.0.
|
|
20854
|
-
"@cloudscape-design/components": "3.0.
|
|
20855
|
-
"@cloudscape-design/global-styles": "1.0.
|
|
20852
|
+
"@cloudscape-design/board-components": "3.0.218",
|
|
20853
|
+
"@cloudscape-design/chat-components": "1.0.162",
|
|
20854
|
+
"@cloudscape-design/components": "3.0.1347",
|
|
20855
|
+
"@cloudscape-design/global-styles": "1.0.66",
|
|
20856
20856
|
"@tanstack/react-query": "5.101.4",
|
|
20857
20857
|
"@tanstack/react-query-devtools": "5.101.4",
|
|
20858
20858
|
"@trpc/tanstack-react-query": "11.18.0",
|
|
@@ -20864,31 +20864,31 @@ const NX_VERSION = {
|
|
|
20864
20864
|
"@types/pg": "8.21.0",
|
|
20865
20865
|
"@types/ws": "8.18.1",
|
|
20866
20866
|
"@types/express": "5.0.6",
|
|
20867
|
-
"@smithy/config-resolver": "4.
|
|
20868
|
-
"@smithy/node-config-provider": "4.
|
|
20869
|
-
"@smithy/node-http-handler": "4.
|
|
20870
|
-
"@smithy/types": "4.
|
|
20867
|
+
"@smithy/config-resolver": "4.7.2",
|
|
20868
|
+
"@smithy/node-config-provider": "4.6.2",
|
|
20869
|
+
"@smithy/node-http-handler": "4.11.2",
|
|
20870
|
+
"@smithy/types": "4.17.2",
|
|
20871
20871
|
"@vitest/coverage-v8": "4.1.10",
|
|
20872
20872
|
"@vitest/ui": "4.1.10",
|
|
20873
20873
|
"@astrojs/react": "6.0.2",
|
|
20874
|
-
"@astrojs/starlight": "0.41.
|
|
20874
|
+
"@astrojs/starlight": "0.41.7",
|
|
20875
20875
|
astro: "7.1.1",
|
|
20876
20876
|
aws4fetch: "1.0.20",
|
|
20877
|
-
"aws-cdk": "2.
|
|
20878
|
-
"aws-cdk-lib": "2.
|
|
20877
|
+
"aws-cdk": "2.1136.0",
|
|
20878
|
+
"aws-cdk-lib": "2.265.0",
|
|
20879
20879
|
"aws-xray-sdk-core": "3.12.0",
|
|
20880
20880
|
constructs: "10.8.1",
|
|
20881
20881
|
cors: "2.8.6",
|
|
20882
|
-
chalk: "
|
|
20882
|
+
chalk: "6.0.0",
|
|
20883
20883
|
"class-variance-authority": "0.7.1",
|
|
20884
20884
|
clsx: "2.1.1",
|
|
20885
20885
|
commander: "15.0.0",
|
|
20886
20886
|
"cpy-cli": "7.0.0",
|
|
20887
|
-
electrodb: "3.9.
|
|
20887
|
+
electrodb: "3.9.3",
|
|
20888
20888
|
esbuild: "0.28.2",
|
|
20889
20889
|
"event-source-polyfill": "1.0.31",
|
|
20890
20890
|
"@types/event-source-polyfill": "1.0.5",
|
|
20891
|
-
"@biomejs/biome": "2.5.
|
|
20891
|
+
"@biomejs/biome": "2.5.8",
|
|
20892
20892
|
"@prisma/adapter-mariadb": "7.9.1",
|
|
20893
20893
|
"@prisma/adapter-pg": "7.9.1",
|
|
20894
20894
|
"@prisma/client": "7.9.1",
|
|
@@ -20901,10 +20901,10 @@ const NX_VERSION = {
|
|
|
20901
20901
|
"@types/fs-extra": "11.0.4",
|
|
20902
20902
|
"make-dir-cli": "4.0.0",
|
|
20903
20903
|
mariadb: "3.5.3",
|
|
20904
|
-
mise: "2026.8.
|
|
20904
|
+
mise: "2026.8.6",
|
|
20905
20905
|
ncp: "2.0.0",
|
|
20906
20906
|
npm: "12.0.2",
|
|
20907
|
-
"npm-check-updates": "
|
|
20907
|
+
"npm-check-updates": "23.0.2",
|
|
20908
20908
|
"oidc-client-ts": "3.5.0",
|
|
20909
20909
|
pg: "8.23.0",
|
|
20910
20910
|
prisma: "7.9.1",
|
|
@@ -20912,17 +20912,17 @@ const NX_VERSION = {
|
|
|
20912
20912
|
react: "19.2.8",
|
|
20913
20913
|
"react-dom": "19.2.8",
|
|
20914
20914
|
rimraf: "6.1.3",
|
|
20915
|
-
rolldown: "1.2.
|
|
20916
|
-
"rolldown-plugin-dts": "0.28.
|
|
20915
|
+
rolldown: "1.2.4",
|
|
20916
|
+
"rolldown-plugin-dts": "0.28.2",
|
|
20917
20917
|
"simple-git": "3.36.0",
|
|
20918
20918
|
"source-map-support": "0.5.21",
|
|
20919
20919
|
"starlight-blog": "0.28.0",
|
|
20920
20920
|
tailwindcss: "4.3.3",
|
|
20921
20921
|
"@tailwindcss/vite": "4.3.3",
|
|
20922
|
-
tsx: "4.23.
|
|
20923
|
-
"lucide-react": "1.
|
|
20922
|
+
tsx: "4.23.12",
|
|
20923
|
+
"lucide-react": "1.31.0",
|
|
20924
20924
|
"radix-ui": "1.6.7",
|
|
20925
|
-
shadcn: "4.
|
|
20925
|
+
shadcn: "4.18.0",
|
|
20926
20926
|
"tw-animate-css": "1.4.0",
|
|
20927
20927
|
"tailwind-merge": "3.6.0",
|
|
20928
20928
|
vite: "8.2.1",
|
|
@@ -5,7 +5,7 @@ description: Key concepts.
|
|
|
5
5
|
import Link from '@components/link.astro';
|
|
6
6
|
import FrameworkLogos from '@components/framework-logos.astro';
|
|
7
7
|
|
|
8
|
-
The `@aws/nx-plugin` is an [Nx](https://nx.dev/) plugin that provides a toolkit for building and deploying full-stack applications on AWS. It gives you a collection of [Generators](#generators) which scaffold
|
|
8
|
+
The `@aws/nx-plugin` is an [Nx](https://nx.dev/) plugin that provides a toolkit for building and deploying full-stack applications on AWS. It gives you a collection of [Generators](#generators) which scaffold best-practice application code _and_ the infrastructure to deploy it — type-safe, locally runnable, and deployable from the start, getting you closer to production.
|
|
9
9
|
|
|
10
10
|
Rather than starting from a blank page, you (or your AI agent) pick the components you need — APIs, websites, authentication, AI agents, infrastructure — provide a few configuration options, and the plugin generates best-practice starter code. It even wires projects together for you (including updating existing files via AST transforms) to produce type-safe clients between your frontend and backend.
|
|
11
11
|
|
|
@@ -452,6 +452,8 @@ The `py#agent` generates these files:
|
|
|
452
452
|
- main.py entrypoint for your agent in Bedrock AgentCore Runtime
|
|
453
453
|
- agent.py defines an example agent and tools
|
|
454
454
|
- session.py resolves a SessionManager for persisting conversation state
|
|
455
|
+
- middleware/
|
|
456
|
+
- session_id_middleware.py binds the inbound AgentCore session ID for the request
|
|
455
457
|
- Dockerfile defines the docker image for deployment to AgentCore Runtime
|
|
456
458
|
- common/constructs/
|
|
457
459
|
- src
|
|
@@ -492,6 +494,29 @@ Refer to tools as your 'spellbook'.
|
|
|
492
494
|
|
|
493
495
|
This creates an example Strands agent and defines a subtraction tool. `log_model_errors` and `log_tool_errors` are hooks from the shared `dungeon_adventure_agent_connection` project that log model/tool failures instead of letting them fail silently.
|
|
494
496
|
|
|
497
|
+
```python
|
|
498
|
+
# agent/middleware/session_id_middleware.py
|
|
499
|
+
import uuid
|
|
500
|
+
|
|
501
|
+
from fastapi import Request
|
|
502
|
+
from starlette.middleware.base import BaseHTTPMiddleware
|
|
503
|
+
|
|
504
|
+
from dungeon_adventure_agent_connection import session_id_context
|
|
505
|
+
|
|
506
|
+
SESSION_ID_HEADER = "x-amzn-bedrock-agentcore-runtime-session-id"
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
class SessionIdMiddleware(BaseHTTPMiddleware):
|
|
510
|
+
"""Bind the session ID for this request so downstream MCP / A2A clients forward it on outbound calls."""
|
|
511
|
+
|
|
512
|
+
async def dispatch(self, request: Request, call_next):
|
|
513
|
+
session_id = request.headers.get(SESSION_ID_HEADER) or str(uuid.uuid4())
|
|
514
|
+
with session_id_context(session_id):
|
|
515
|
+
return await call_next(request)
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
The `SessionIdMiddleware` binds the inbound AgentCore runtime session ID onto a `ContextVar` for the duration of the request.
|
|
519
|
+
|
|
495
520
|
```python
|
|
496
521
|
# agent/main.py
|
|
497
522
|
import logging
|
|
@@ -505,15 +530,13 @@ from dungeon_adventure_agent_connection import get_current_session_id, session_i
|
|
|
505
530
|
from fastapi import FastAPI, Request
|
|
506
531
|
from fastapi.middleware.cors import CORSMiddleware
|
|
507
532
|
from fastapi.responses import StreamingResponse
|
|
508
|
-
from starlette.middleware.base import BaseHTTPMiddleware
|
|
509
533
|
|
|
510
534
|
from .agent import get_agent
|
|
535
|
+
from .middleware.session_id_middleware import SESSION_ID_HEADER, SessionIdMiddleware
|
|
511
536
|
from .session import get_session_manager
|
|
512
537
|
|
|
513
538
|
logging.basicConfig(level=logging.INFO)
|
|
514
539
|
|
|
515
|
-
SESSION_ID_HEADER = "x-amzn-bedrock-agentcore-runtime-session-id"
|
|
516
|
-
|
|
517
540
|
|
|
518
541
|
@asynccontextmanager
|
|
519
542
|
async def lifespan(app: FastAPI):
|
|
@@ -529,15 +552,6 @@ async def lifespan(app: FastAPI):
|
|
|
529
552
|
yield
|
|
530
553
|
|
|
531
554
|
|
|
532
|
-
class _SessionIdMiddleware(BaseHTTPMiddleware):
|
|
533
|
-
"""Bind the session ID for this request so downstream MCP / A2A clients forward it on outbound calls."""
|
|
534
|
-
|
|
535
|
-
async def dispatch(self, request: Request, call_next):
|
|
536
|
-
session_id = request.headers.get(SESSION_ID_HEADER) or str(uuid.uuid4())
|
|
537
|
-
with session_id_context(session_id):
|
|
538
|
-
return await call_next(request)
|
|
539
|
-
|
|
540
|
-
|
|
541
555
|
app = FastAPI(title="AWS Strands - StoryAgent", lifespan=lifespan)
|
|
542
556
|
app.add_middleware(
|
|
543
557
|
CORSMiddleware,
|
|
@@ -546,7 +560,7 @@ app.add_middleware(
|
|
|
546
560
|
allow_methods=["*"],
|
|
547
561
|
allow_headers=["*"],
|
|
548
562
|
)
|
|
549
|
-
app.add_middleware(
|
|
563
|
+
app.add_middleware(SessionIdMiddleware)
|
|
550
564
|
|
|
551
565
|
|
|
552
566
|
@app.post("/invocations")
|
|
@@ -589,7 +603,7 @@ async def ping():
|
|
|
589
603
|
return {"status": "healthy"}
|
|
590
604
|
```
|
|
591
605
|
|
|
592
|
-
This is the entrypoint for the agent. Because we selected `--protocol=ag-ui`, the generator wraps our Strands `Agent` with `StrandsAgent` from [`ag_ui_strands`](https://docs.copilotkit.ai/aws-strands/integration) and mounts it on a FastAPI app that speaks the [AG-UI protocol](https://docs.copilotkit.ai/aws-strands/protocol) — this is what CopilotKit will talk to from the React website. The agent is built inside a `lifespan` handler — not at import time — so container startup, not module import, owns construction, and each AgentCore session gets its own container. The `
|
|
606
|
+
This is the entrypoint for the agent. Because we selected `--protocol=ag-ui`, the generator wraps our Strands `Agent` with `StrandsAgent` from [`ag_ui_strands`](https://docs.copilotkit.ai/aws-strands/integration) and mounts it on a FastAPI app that speaks the [AG-UI protocol](https://docs.copilotkit.ai/aws-strands/protocol) — this is what CopilotKit will talk to from the React website. The agent is built inside a `lifespan` handler — not at import time — so container startup, not module import, owns construction, and each AgentCore session gets its own container. The `SessionIdMiddleware` we saw above forwards the inbound AgentCore runtime session ID so any downstream MCP/A2A client we wire up later (e.g. the Inventory MCP server in <Link path="get_started/tutorials/dungeon-game/2">Module 2</Link>) automatically forwards it on its outbound calls. Since AG-UI caches one Strands agent per `thread_id`, we plug in a `session_manager_provider` rather than the template agent's own session manager — this gives each thread its own `SessionManager` so conversation history persists across turns. That `get_session_manager()` function comes from a generated `session.py` sibling: deployed, it returns a `strands.session.S3SessionManager` backed by an S3 bucket the generator provisions automatically; under `agent-dev` (`LOCAL_DEV=true`) it always returns a `FileSessionManager` writing to a local temp directory instead, regardless of deployed configuration.
|
|
593
607
|
|
|
594
608
|
```ts
|
|
595
609
|
// common/constructs/src/app/agents/story-agent/story-agent.ts
|
|
@@ -304,6 +304,18 @@ Because the image is fully determined by your project source, declaring `inputs`
|
|
|
304
304
|
Trivy reads a `.trivyignore` file (a list of vulnerability IDs, one per line) from the root of your project. `--ignore-unfixed` skips vulnerabilities with no available fix, so the scan only fails on issues you can action by upgrading tooling in your `Dockerfile`. See the [Trivy filtering documentation](https://trivy.dev/latest/docs/configuration/filtering/#by-finding-ids) for details.
|
|
305
305
|
:::
|
|
306
306
|
|
|
307
|
+
:::tip[Apply the distribution's security updates]
|
|
308
|
+
A base image tag lags behind its distribution's security suite, so its OS packages carry vulnerabilities that already have a published fix. Upgrade them as the first step of your build, ahead of any other instruction so later layers install against the upgraded packages. For a Debian-derived base image (as used by the Node and Python images above):
|
|
309
|
+
|
|
310
|
+
```dockerfile
|
|
311
|
+
RUN apt-get update && \
|
|
312
|
+
apt-get upgrade -y --no-install-recommends && \
|
|
313
|
+
rm -rf /var/lib/apt/lists/*
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
The generated `Dockerfile`s do this for you.
|
|
317
|
+
:::
|
|
318
|
+
|
|
307
319
|
## Infrastructure
|
|
308
320
|
|
|
309
321
|
Wiring the resulting build-context directory to infrastructure as code is the same for both TypeScript and Python — only the path to the build-context directory differs (`dist/packages/my-project/bundle` for TypeScript, `dist/packages/my-project/docker` for Python).
|
package/docs/guides/py-agent.mdx
CHANGED
|
@@ -51,6 +51,9 @@ The generator will add the following files to your existing Python project. The
|
|
|
51
51
|
- init.py FastAPI application setup with CORS and error handling middleware
|
|
52
52
|
- agent.py Main agent definition with sample tools
|
|
53
53
|
- session.py Resolves the framework-specific session persistence implementation
|
|
54
|
+
- middleware/
|
|
55
|
+
- \_\_init\_\_.py Python package initialization
|
|
56
|
+
- session_id_middleware.py Binds the inbound AgentCore session ID for the request
|
|
54
57
|
- main.py FastAPI entry point for Bedrock AgentCore Runtime
|
|
55
58
|
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
56
59
|
- pyproject.toml Updated with Strands dependencies
|
|
@@ -70,6 +73,9 @@ The entry point exposes your agent over the A2A protocol (Strands uses the [Stra
|
|
|
70
73
|
- \_\_init\_\_.py Python package initialization
|
|
71
74
|
- agent.py Main agent definition with sample tools
|
|
72
75
|
- session.py Resolves the framework-specific session persistence implementation
|
|
76
|
+
- middleware/
|
|
77
|
+
- \_\_init\_\_.py Python package initialization
|
|
78
|
+
- session_id_middleware.py Binds the inbound AgentCore session ID for the request
|
|
73
79
|
- main.py A2A server entry point
|
|
74
80
|
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
75
81
|
- pyproject.toml Updated with framework and A2A dependencies
|
|
@@ -89,6 +95,9 @@ The entry point exposes your agent via the [AG-UI](https://docs.ag-ui.com/) prot
|
|
|
89
95
|
- \_\_init\_\_.py Python package initialization
|
|
90
96
|
- agent.py Main agent definition with sample tools
|
|
91
97
|
- session.py Resolves the framework-specific session persistence implementation
|
|
98
|
+
- middleware/
|
|
99
|
+
- \_\_init\_\_.py Python package initialization
|
|
100
|
+
- session_id_middleware.py Binds the inbound AgentCore session ID for the request
|
|
92
101
|
- main.py AG-UI server entry point
|
|
93
102
|
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
94
103
|
- pyproject.toml Updated with framework and AG-UI dependencies
|