Skip to content

Commit 0be233e

Browse files
George-iamclaude
andauthored
docs: add MCP section to README (#24)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fca5c89 commit 0be233e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,40 @@ Map<String, Object> profile = client.getUserProfile(
327327

328328
---
329329

330+
## MCP (Model Context Protocol)
331+
332+
The Java SDK includes a built-in MCP endpoint client for gateway-hosted MCP sessions.
333+
334+
```java
335+
// Initialize an MCP session
336+
Map<String, Object> init = client.mcpInitialize(RequestOptions.defaults());
337+
System.out.println(init.get("serverInfo"));
338+
339+
// List available tools
340+
Map<String, Object> tools = client.mcpListTools(RequestOptions.defaults());
341+
List<?> toolList = (List<?>) tools.get("tools");
342+
for (Object tool : toolList) {
343+
Map<?, ?> t = (Map<?, ?>) tool;
344+
System.out.println(t.get("name"));
345+
}
346+
347+
// Call a tool
348+
Map<String, Object> result = client.mcpCallTool(
349+
"create_intent",
350+
Map.of(
351+
"intent_type", "order.fulfillment.v1",
352+
"payload", Map.of("order_id", "ord_123"),
353+
"owner_agent", "agent://fulfillment-service"
354+
),
355+
RequestOptions.defaults()
356+
);
357+
System.out.println(result);
358+
```
359+
360+
By default the SDK posts to `/mcp`. Override with `mcpEndpointPath` in client options.
361+
362+
---
363+
330364
## Repository Structure
331365

332366
```

0 commit comments

Comments
 (0)