Skip to content

Commit b74dab0

Browse files
mmeclaude
authored andcommitted
feat: add Excalidraw MCP apps middleware and suggestion
Wire @ag-ui/mcp-apps-middleware into the CopilotKit runtime Lambda so agents can use Excalidraw's MCP server for open generative UI. Add the corresponding "network diagram" suggestion to the frontend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d1f8bd8 commit b74dab0

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

frontend/src/hooks/useExampleSuggestions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ export const useExampleSuggestions = () => {
1414
message:
1515
"Please show me the distribution of our expenses by category in a bar chart.",
1616
},
17+
{
18+
title: "MCP apps (Open Generative UI)",
19+
message:
20+
"Please create a simple network diagram of a router and two switches.",
21+
},
1722
{
1823
title: "Change theme (Frontend Tools)",
1924
message: "Switch the app to dark mode.",

infra-cdk/lambdas/copilotkit-runtime/package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infra-cdk/lambdas/copilotkit-runtime/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
"dependencies": {
1111
"@ag-ui/client": "^0.0.47",
12+
"@ag-ui/mcp-apps-middleware": "^0.0.3",
1213
"@copilotkit/runtime": "^1.54.0",
1314
"hono": "^4.11.4",
1415
"rxjs": "^7.8.2"

infra-cdk/lambdas/copilotkit-runtime/src/index.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { EventType, HttpAgent, type BaseEvent } from "@ag-ui/client"
2+
import { MCPAppsMiddleware } from "@ag-ui/mcp-apps-middleware"
23
import { CopilotRuntime, createCopilotEndpoint, InMemoryAgentRunner } from "@copilotkit/runtime/v2"
34
import { streamHandle } from "hono/aws-lambda"
45
import { concatMap, of } from "rxjs"
@@ -20,9 +21,23 @@ function getConfiguredAgents(): Record<string, HttpAgent> {
2021
"strands-single-agent": process.env.STRANDS_AGENTCORE_AG_UI_URL,
2122
}
2223

24+
const mcpServerUrl = process.env.MCP_SERVER_URL || "https://mcp.excalidraw.com"
25+
2326
for (const [name, url] of Object.entries(agentUrls)) {
2427
if (url) {
25-
configuredAgents[name] = new HttpAgent({ url })
28+
const agent = new HttpAgent({ url })
29+
agent.use(
30+
new MCPAppsMiddleware({
31+
mcpServers: [
32+
{
33+
type: "http",
34+
url: mcpServerUrl,
35+
serverId: "example_mcp_app",
36+
},
37+
],
38+
})
39+
)
40+
configuredAgents[name] = agent
2641
}
2742
}
2843

0 commit comments

Comments
 (0)