Skip to content

Commit 453b156

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/CPK-7190-chat-performance
2 parents 468062c + c2e9eed commit 453b156

119 files changed

Lines changed: 3849 additions & 2220 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/flat-singers-drum.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@copilotkit/react-textarea": patch
3+
"@copilotkit/a2ui-renderer": patch
4+
"@copilotkit/web-inspector": patch
5+
"@copilotkit/react-core": patch
6+
"@copilotkit/runtime": patch
7+
"@copilotkit/shared": patch
8+
---
9+
10+
Fixing license warnings, barrel export and typing

.oxfmtrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"packages/runtime/src/lib/runtime/mcp-tools-utils.ts",
77
".github/actions/changesets-action/src/run.ts",
88
"examples/v1/_legacy/copilot-anthropic-pinecone/src/app/api/copilotkit/route.ts",
9-
"examples/v1/_legacy/copilot-openai-mongodb-atlas-vector-search/src/app/api/copilotkit/route.ts"
9+
"examples/v1/_legacy/copilot-openai-mongodb-atlas-vector-search/src/app/api/copilotkit/route.ts",
10+
"packages/web-inspector/src/styles/generated.css"
1011
]
1112
}

.oxlintrc.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,27 @@
1010
"react/react-in-jsx-scope": "off",
1111
"import/no-unassigned-import": "off",
1212
"unicorn/no-array-sort": "off",
13-
"copilotkit/require-cpk-prefix": "off"
13+
"copilotkit/require-cpk-prefix": "off",
14+
"no-restricted-imports": "off"
1415
},
1516
"overrides": [
17+
{
18+
"files": ["packages/**/*.{ts,tsx}"],
19+
"rules": {
20+
"no-restricted-imports": [
21+
"error",
22+
{
23+
"paths": [
24+
{
25+
"name": "@a2ui/lit",
26+
"message": "Do not use value imports from '@a2ui/lit' — it registers custom elements as a side effect, which breaks React Strict Mode. Use `import type` for types, or import from '@a2ui/lit/0.8' for value access (core only, no UI side effects).",
27+
"allowTypeImports": true
28+
}
29+
]
30+
}
31+
]
32+
}
33+
},
1634
{
1735
"files": ["packages/react-ui/src/**/*.{ts,tsx}"],
1836
"rules": {

examples/integrations/agentcore/infra-cdk/lib/fast-main-stack.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export class FastMainStack extends cdk.Stack {
1717
public readonly cognitoStack: CognitoStack;
1818

1919
constructor(scope: Construct, id: string, props: FastAmplifyStackProps) {
20-
const description = "CopilotKit + AWS AgentCore Integration Example";
20+
const description =
21+
"CopilotKit + AWS AgentCore Integration Example (uksb-v6dos0t5g8)";
2122
super(scope, id, { ...props, description });
2223

2324
// Step 1: Create the Amplify stack to get the predictable domain

examples/showcases/open-mcp-client/README.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# CopilotKit <> MCP Apps Starter
1+
# Open MCP Client Builder
22

33
**Production go-live:** [`docs/TRACKER.md`](docs/TRACKER.md) · **Stakeholder / product handoff** (shipped scope, CopilotKit open questions): [`docs/HANDOFF.md`](docs/HANDOFF.md)
44

55
This monorepo demonstrates **MCP Apps** with **CopilotKit**: the **MCP App builder** web UI (`apps/web`) drives a **Mastra** agent (`/api/mastra-agent`) that can provision **E2B** sandboxes running the **`mcp-use-server`** template (`apps/mcp-use-server`). An optional local sample is the [Three.js MCP example](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/threejs-server) in **`apps/threejs-server`** (used for sidebar defaults when running everything locally).
66

7-
https://github.com/user-attachments/assets/8908af31-2b64-4426-9c83-c51ab86256de
7+
https://github.com/user-attachments/assets/4bb35806-5e42-43c0-a8fe-01c0d1e5b8b3
88

99
## Prerequisites
1010

@@ -29,48 +29,48 @@ pnpm dev
2929

3030
**Run pieces individually**
3131

32-
| Goal | Command |
33-
|------|---------|
34-
| Web app only | `pnpm --filter web dev` (from repo root) or `cd apps/web && pnpm dev` |
35-
| Three.js MCP sample (local sidebar default) | `cd apps/threejs-server && pnpm dev` |
36-
| `mcp-use-server` (local MCP, not the E2B image) | `cd apps/mcp-use-server && pnpm dev` |
32+
| Goal | Command |
33+
| ----------------------------------------------- | --------------------------------------------------------------------- |
34+
| Web app only | `pnpm --filter web dev` (from repo root) or `cd apps/web && pnpm dev` |
35+
| Three.js MCP sample (local sidebar default) | `cd apps/threejs-server && pnpm dev` |
36+
| `mcp-use-server` (local MCP, not the E2B image) | `cd apps/mcp-use-server && pnpm dev` |
3737

3838
Open the URL shown by Next (usually `http://localhost:3000`).
3939

4040
## Scripts reference
4141

4242
### Root (`package.json`)
4343

44-
| Script | Description |
45-
|--------|-------------|
46-
| `pnpm dev` | Turbo: all packages’ `dev` scripts |
47-
| `pnpm build` | Turbo: all packages’ `build` (for `web`, runs **`prebuild`** first — see below) |
48-
| `pnpm lint` | Turbo lint |
49-
| `pnpm clean` / `pnpm fresh` | Remove installs / lockfile helpers (see script definitions) |
44+
| Script | Description |
45+
| --------------------------- | ------------------------------------------------------------------------------- |
46+
| `pnpm dev` | Turbo: all packages’ `dev` scripts |
47+
| `pnpm build` | Turbo: all packages’ `build` (for `web`, runs **`prebuild`** first — see below) |
48+
| `pnpm lint` | Turbo lint |
49+
| `pnpm clean` / `pnpm fresh` | Remove installs / lockfile helpers (see script definitions) |
5050

5151
### `apps/web`
5252

53-
| Script | Description |
54-
|--------|-------------|
55-
| `pnpm dev` | Next.js dev (Turbopack) |
56-
| `pnpm build` | Runs **`prebuild`****`pack-download-kit`** (writes **`.download-kit/base.tar.gz`** for [full app kit](docs/HANDOFF.md) download), then **`next build`** |
57-
| `pnpm pack-download-kit` | Regenerate **`.download-kit/base.tar.gz`** without a full Next build |
58-
| `pnpm start` | Production Next server |
59-
| `pnpm lint` | ESLint |
60-
| `pnpm run test:download-kit` | Integration test: Next + E2B + **`POST /api/workspace/download`** (see **`apps/web/test/`)** |
61-
| `pnpm run test:e2b-download` | Smoke test: E2B tarball only |
62-
| `pnpm run dev:mcp` | Starts the **Three.js** sample MCP from **`apps/threejs-server`** (for local MCP alongside web) |
53+
| Script | Description |
54+
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
55+
| `pnpm dev` | Next.js dev (Turbopack) |
56+
| `pnpm build` | Runs **`prebuild`****`pack-download-kit`** (writes **`.download-kit/base.tar.gz`** for [full app kit](docs/HANDOFF.md) download), then **`next build`** |
57+
| `pnpm pack-download-kit` | Regenerate **`.download-kit/base.tar.gz`** without a full Next build |
58+
| `pnpm start` | Production Next server |
59+
| `pnpm lint` | ESLint |
60+
| `pnpm run test:download-kit` | Integration test: Next + E2B + **`POST /api/workspace/download`** (see **`apps/web/test/`)** |
61+
| `pnpm run test:e2b-download` | Smoke test: E2B tarball only |
62+
| `pnpm run dev:mcp` | Starts the **Three.js** sample MCP from **`apps/threejs-server`** (for local MCP alongside web) |
6363

6464
Manual scripts under **`apps/web/test/`**: run from **`apps/web`** as `node test/<file>.mjs` (paths and env documented in each file).
6565

6666
### E2B sandbox template (`apps/mcp-use-server`)
6767

6868
The agent provisions sandboxes from an E2B **template** defined in **`template.ts`**. Rebuild the image when you change dependencies, tools, or widgets there.
6969

70-
| Script | When to use | Command (from repo root) |
71-
|--------|-------------|---------------------------|
72-
| **Dev template** (`mcp-use-server-dev`) | Day-to-day iteration | `cd apps/mcp-use-server && npx tsx --env-file=../../.env build.dev.ts` |
73-
| **Prod template** (`mcp-use-server`) | Stable snapshot for production | `cd apps/mcp-use-server && npx tsx --env-file=../../.env build.prod.ts` |
70+
| Script | When to use | Command (from repo root) |
71+
| --------------------------------------- | ------------------------------ | ----------------------------------------------------------------------- |
72+
| **Dev template** (`mcp-use-server-dev`) | Day-to-day iteration | `cd apps/mcp-use-server && npx tsx --env-file=../../.env build.dev.ts` |
73+
| **Prod template** (`mcp-use-server`) | Stable snapshot for production | `cd apps/mcp-use-server && npx tsx --env-file=../../.env build.prod.ts` |
7474

7575
Requirements: **`E2B_API_KEY`** in `.env` (or environment). The CLI prints a **`BuildInfo`** object; set **`E2B_TEMPLATE`** to **`templateId`** from that output (and the same in your hosting dashboard). Template **name** (e.g. `mcp-use-server-dev`) is not the same as **`templateId`**.
7676

@@ -106,10 +106,10 @@ More: **[`docs/DYNAMIC_MCP.md`](docs/DYNAMIC_MCP.md)**.
106106

107107
## Environment variables (E2B)
108108

109-
| Variable | Description |
110-
|----------|-------------|
111-
| `E2B_API_KEY` | From [e2b.dev/dashboard](https://e2b.dev/dashboard) |
112-
| `E2B_TEMPLATE` | **`templateId`** from `Template.build` output after **`build.dev.ts`** / **`build.prod.ts`** |
109+
| Variable | Description |
110+
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
111+
| `E2B_API_KEY` | From [e2b.dev/dashboard](https://e2b.dev/dashboard) |
112+
| `E2B_TEMPLATE` | **`templateId`** from `Template.build` output after **`build.dev.ts`** / **`build.prod.ts`** |
113113
| `E2B_REPO_URL` | Used when **`E2B_TEMPLATE`** is empty — clones repo into sandbox (slower cold start). Default in code: **`mcp-use-server-template`** GitHub URL |
114114

115115
## Hosting on Render
@@ -129,19 +129,19 @@ Widget tools should include **`_meta["ui/previewData"]`** for offline sidebar pr
129129

130130
**In this repo**
131131

132-
- **[`docs/TRACKER.md`](docs/TRACKER.md)****production go-live checklist**
133-
- **[`docs/HANDOFF.md`](docs/HANDOFF.md)** — shipped scope, CopilotKit open questions
134-
- **[`docs/DEPLOY-RENDER.md`](docs/DEPLOY-RENDER.md)** — Render deployment guide
135-
- **[`docs/DYNAMIC_MCP.md`](docs/DYNAMIC_MCP.md)** — dynamic MCP patterns
136-
- **[`docs/PLAN.md`](docs/PLAN.md)** / **[`docs/E2B-IMPLEMENTATION.md`](docs/E2B-IMPLEMENTATION.md)** — roadmap and E2B design
132+
- **[`docs/TRACKER.md`](docs/TRACKER.md)****production go-live checklist**
133+
- **[`docs/HANDOFF.md`](docs/HANDOFF.md)** — shipped scope, CopilotKit open questions
134+
- **[`docs/DEPLOY-RENDER.md`](docs/DEPLOY-RENDER.md)** — Render deployment guide
135+
- **[`docs/DYNAMIC_MCP.md`](docs/DYNAMIC_MCP.md)** — dynamic MCP patterns
136+
- **[`docs/PLAN.md`](docs/PLAN.md)** / **[`docs/E2B-IMPLEMENTATION.md`](docs/E2B-IMPLEMENTATION.md)** — roadmap and E2B design
137137

138138
**UI entry:** `apps/web/app/page.tsx` (theme, layout, CopilotKit wiring).
139139

140140
**External**
141141

142-
- [CopilotKit](https://docs.copilotkit.ai)
143-
- [Next.js](https://nextjs.org/docs)
144-
- [MCP Apps / UI](https://mcpui.dev/guide/introduction)
142+
- [CopilotKit](https://docs.copilotkit.ai)
143+
- [Next.js](https://nextjs.org/docs)
144+
- [MCP Apps / UI](https://mcpui.dev/guide/introduction)
145145

146146
## Contributing
147147

examples/showcases/open-mcp-client/apps/mcp-use-server/.agent/skills/chatgpt-app-builder/references/architecture.md

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Design UX flows and API shape for your ChatGPT app.
77
A **tool** is a backend action with no UI. It takes input and returns structured output. Use for CRUD operations, API calls, and actions (checkout, submit, cancel).
88

99
A **widget** is a tool with a UI. It renders the tool output visually. The UI is a React component that can:
10+
1011
- Navigate multiple views (search -> detail -> confirmation)
1112
- Manage its own state (selections, filters, form inputs)
1213
- Call other tools to fetch data or trigger actions
@@ -22,6 +23,7 @@ Extract flows from your spec's core actions. **Stick to the spec** -- don't inve
2223
Spec: "Book flights by destination and dates, and cancel existing bookings."
2324

2425
Flows:
26+
2527
```
2628
Book flight: Search -> Select -> Checkout
2729
Cancel booking: Provide info -> Confirm cancellation
@@ -30,11 +32,13 @@ Cancel booking: Provide info -> Confirm cancellation
3032
## Step 2: Does the Flow Need UI?
3133

3234
**YES → widget** if:
35+
3336
- Browsing/comparing multiple items (search results, listings)
3437
- Visual data improves understanding (maps, charts, images, color swatches)
3538
- Selections are easier in a visual layout (seat picker, calendar)
3639

3740
**NO → tool only** if:
41+
3842
- Inputs are naturally conversational (amounts, dates, descriptions)
3943
- Output is simple text (confirmation ID, status message)
4044
- No visual element would meaningfully improve the experience
@@ -81,32 +85,42 @@ Tool calls are expensive. Return all needed data upfront.
8185

8286
```typescript
8387
// Widget: search-flights
84-
server.tool({
85-
name: "search-flights",
86-
schema: z.object({
87-
destination: z.string().describe("Destination city"),
88-
dates: z.string().describe("Travel dates"),
89-
}),
90-
widget: { name: "flight-search", invoking: "Searching...", invoked: "Flights found" },
91-
}, async ({ destination, dates }) => {
92-
const flights = await fetchFlights(destination, dates);
93-
return widget({
94-
props: { flights, destination },
95-
output: text(`Found ${flights.length} flights to ${destination}`),
96-
});
97-
});
88+
server.tool(
89+
{
90+
name: "search-flights",
91+
schema: z.object({
92+
destination: z.string().describe("Destination city"),
93+
dates: z.string().describe("Travel dates"),
94+
}),
95+
widget: {
96+
name: "flight-search",
97+
invoking: "Searching...",
98+
invoked: "Flights found",
99+
},
100+
},
101+
async ({ destination, dates }) => {
102+
const flights = await fetchFlights(destination, dates);
103+
return widget({
104+
props: { flights, destination },
105+
output: text(`Found ${flights.length} flights to ${destination}`),
106+
});
107+
},
108+
);
98109

99110
// Tool: create-checkout (called by widget)
100-
server.tool({
101-
name: "create-checkout",
102-
schema: z.object({
103-
flightId: z.string().describe("Selected flight ID"),
104-
passengers: z.array(z.object({ name: z.string(), email: z.string() })),
105-
}),
106-
}, async ({ flightId, passengers }) => {
107-
const checkout = await createCheckoutSession(flightId, passengers);
108-
return object({ checkoutUrl: checkout.url });
109-
});
111+
server.tool(
112+
{
113+
name: "create-checkout",
114+
schema: z.object({
115+
flightId: z.string().describe("Selected flight ID"),
116+
passengers: z.array(z.object({ name: z.string(), email: z.string() })),
117+
}),
118+
},
119+
async ({ flightId, passengers }) => {
120+
const checkout = await createCheckoutSession(flightId, passengers);
121+
return object({ checkoutUrl: checkout.url });
122+
},
123+
);
110124
```
111125

112126
### Flow DOES NOT NEED UI -> Tool(s) Only
@@ -115,23 +129,31 @@ server.tool({
115129

116130
```typescript
117131
// Tool: list-bookings
118-
server.tool({
119-
name: "list-bookings",
120-
schema: z.object({ email: z.string().describe("Booking email") }),
121-
}, async ({ email }) => {
122-
const bookings = await getBookings(email);
123-
return object({ bookings });
124-
// LLM: "You have two flights: Paris Jan 1, Tokyo Feb 15. Which cancel?"
125-
});
132+
server.tool(
133+
{
134+
name: "list-bookings",
135+
schema: z.object({ email: z.string().describe("Booking email") }),
136+
},
137+
async ({ email }) => {
138+
const bookings = await getBookings(email);
139+
return object({ bookings });
140+
// LLM: "You have two flights: Paris Jan 1, Tokyo Feb 15. Which cancel?"
141+
},
142+
);
126143

127144
// Tool: cancel-booking
128-
server.tool({
129-
name: "cancel-booking",
130-
schema: z.object({ bookingId: z.string().describe("Booking ID to cancel") }),
131-
}, async ({ bookingId }) => {
132-
await cancelBooking(bookingId);
133-
return text(`Booking ${bookingId} has been cancelled.`);
134-
});
145+
server.tool(
146+
{
147+
name: "cancel-booking",
148+
schema: z.object({
149+
bookingId: z.string().describe("Booking ID to cancel"),
150+
}),
151+
},
152+
async ({ bookingId }) => {
153+
await cancelBooking(bookingId);
154+
return text(`Booking ${bookingId} has been cancelled.`);
155+
},
156+
);
135157
```
136158

137159
## `exposeAsTool` Defaults to `false`

0 commit comments

Comments
 (0)