@aws/nx-plugin-mcp 1.0.0-rc.36 → 1.0.0-rc.37

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.
@@ -102,7 +102,7 @@ resource "aws_bedrockagentcore_gateway_target" "my_mcp_server" {
102
102
  target_configuration {
103
103
  mcp {
104
104
  mcp_server {
105
- endpoint = "https://bedrock-agentcore.${local.aws_region}.amazonaws.com/runtimes/${urlencode(module.my_mcp_server.agent_core_runtime_arn)}/invocations?qualifier=DEFAULT"
105
+ endpoint = module.my_mcp_server.invocation_url
106
106
  }
107
107
  }
108
108
  }
@@ -122,11 +122,8 @@ function ChatComponent() {
122
122
  },
123
123
  }));
124
124
 
125
- const handleSend = (message: string) => {
126
- invoke.mutate({
127
- prompt: message,
128
- sessionId: 'my-session',
129
- });
125
+ const handleSend = (prompt: string) => {
126
+ invoke.mutate({ prompt });
130
127
  };
131
128
 
132
129
  return (
@@ -154,12 +151,9 @@ function ChatComponent() {
154
151
  const client = useMyAgentClient();
155
152
  const [chunks, setChunks] = useState<StreamChunk[]>([]);
156
153
 
157
- const handleSend = async (message: string) => {
154
+ const handleSend = async (prompt: string) => {
158
155
  setChunks([]);
159
- for await (const chunk of client.invoke({
160
- prompt: message,
161
- sessionId: 'my-session',
162
- })) {
156
+ for await (const chunk of client.invoke({ prompt })) {
163
157
  setChunks((prev) => [...prev, chunk]);
164
158
  }
165
159
  };
@@ -93,7 +93,7 @@ function ChatComponent() {
93
93
 
94
94
  const subscription = useSubscription(
95
95
  trpc.invoke.subscriptionOptions(
96
- { message: 'What can you help me with?' },
96
+ { prompt: 'What can you help me with?' },
97
97
  {
98
98
  enabled: true,
99
99
  onStarted: () => {
@@ -135,9 +135,9 @@ function ChatComponent() {
135
135
  const client = useMyAgentAgentClient();
136
136
  const [messages, setMessages] = useState<string[]>([]);
137
137
 
138
- const sendMessage = (message: string) => {
138
+ const sendMessage = (prompt: string) => {
139
139
  const subscription = client.invoke.subscribe(
140
- { message },
140
+ { prompt },
141
141
  {
142
142
  onData: (token) => {
143
143
  setMessages((prev) => [...prev, token]);
@@ -302,13 +302,13 @@ The agent's invocation endpoint uses [Pydantic](https://docs.pydantic.dev/) mode
302
302
 
303
303
  #### Defining Input Models
304
304
 
305
- The default `InvokeInput` model accepts a message.
305
+ The default `InvokeInput` model accepts a prompt.
306
306
 
307
307
  ```python
308
308
  from pydantic import BaseModel
309
309
 
310
310
  class InvokeInput(BaseModel):
311
- message: str
311
+ prompt: str
312
312
  ```
313
313
 
314
314
  You can extend this model to include any additional fields your agent needs.
@@ -493,7 +493,7 @@ To invoke an Agent running locally via the `<your-agent-name>-serve` target, you
493
493
 
494
494
  ```bash
495
495
  curl -N -X POST http://localhost:8081/invocations \
496
- -d '{"message": "what is 3 + 5?"}' \
496
+ -d '{"prompt": "what is 3 + 5?"}' \
497
497
  -H "Content-Type: application/json"
498
498
  ```
499
499
 
@@ -514,7 +514,7 @@ For IAM Authentication, the request must be signed using AWS Signature Version 4
514
514
  ```bash
515
515
  acurl <region> bedrock-agentcore -N -X POST \
516
516
  'https://bedrock-agentcore.<region>.amazonaws.com/runtimes/<url-encoded-arn>/invocations' \
517
- -d '{"message": "what is 3 + 5?"}' \
517
+ -d '{"prompt": "what is 3 + 5?"}' \
518
518
  -H 'Content-Type: application/json'
519
519
  ```
520
520
 
@@ -530,7 +530,7 @@ For Cognito Authentication, pass the Cognito Access Token in the `Authorization`
530
530
 
531
531
  ```bash
532
532
  curl -N -X POST 'https://bedrock-agentcore.<region>.amazonaws.com/runtimes/<url-encoded-arn>/invocations' \
533
- -d '{"message": "what is 3 + 5?"}' \
533
+ -d '{"prompt": "what is 3 + 5?"}' \
534
534
  -H "Content-Type: application/json" \
535
535
  -H "Authorization: Bearer <access-token>"
536
536
  ```
@@ -362,7 +362,7 @@ import { AgentClient } from '../packages/<project>/src/agent/client.js';
362
362
 
363
363
  const client = AgentClient.local({ url: 'http://localhost:8081/ws' });
364
364
 
365
- client.invoke.subscribe({ message: 'what is 1 plus 1?' }, { onData: console.log });
365
+ client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, { onData: console.log });
366
366
  ```
367
367
 
368
368
  :::tip[Quick Testing]
@@ -396,7 +396,7 @@ const client = AgentClient.withIamAuth({
396
396
  agentRuntimeArn: 'arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/my-agent',
397
397
  });
398
398
 
399
- client.invoke.subscribe({ message: 'what is 1 plus 1?' }, {
399
+ client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, {
400
400
  onData: (message) => console.log(message),
401
401
  onError: (error) => console.error(error),
402
402
  onComplete: () => console.log('Done'),
@@ -419,7 +419,7 @@ const client = AgentClient.withJwtAuth({
419
419
  accessTokenProvider: async () => `<access-token>`,
420
420
  });
421
421
 
422
- client.invoke.subscribe({ message: 'what is 1 plus 1?' }, {
422
+ client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, {
423
423
  onData: console.log,
424
424
  });
425
425
  ```
@@ -61,4 +61,25 @@ The Bedrock AgentCore Runtime dataplane URL for invoking the agent is as follows
61
61
  https://bedrock-agentcore.<region>.amazonaws.com/runtimes/<url-encoded-arn>/invocations
62
62
  ```
63
63
 
64
+ :::tip[Invocation URL]
65
+ Your infrastructure can also output the full invocation URL directly, with the ARN encoding handled for you:
66
+
67
+ <Infrastructure>
68
+ <Fragment slot="cdk">
69
+ ```ts
70
+ new CfnOutput(this, 'AgentUrl', {
71
+ value: agent.invocationUrl,
72
+ });
73
+ ```
74
+ </Fragment>
75
+ <Fragment slot="terraform">
76
+ ```terraform
77
+ output "agent_url" {
78
+ value = module.my_project_agent.invocation_url
79
+ }
80
+ ```
81
+ </Fragment>
82
+ </Infrastructure>
83
+ :::
84
+
64
85
  The exact way to invoke this URL depends upon the authentication method used.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin-mcp",
3
- "version": "1.0.0-rc.36",
3
+ "version": "1.0.0-rc.37",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",