DotCraft AG-UI Client
A minimal Next.js app that connects to DotCraft's AG-UI server via CopilotKit. Use it to chat with DotCraft from the browser without cloning the CopilotKit monorepo.
Prerequisites
DotCraft running with AG-UI enabled (default:
http://localhost:5100/ag-ui). In your DotCraft config (e.g..craft/config.json), ensure:json{ "AgUi": { "Enabled": true, "Port": 5100, "Path": "/ag-ui" } }Node.js 18+
Setup
Install dependencies:
bashpnpm installor
npm install/yarn install.(Optional) Copy env example and edit if needed:
bashcp .env.example .env.localDOTCRAFT_AGUI_URL— DotCraft AG-UI base URL (default:http://127.0.0.1:5100/ag-ui).DOTCRAFT_AGUI_API_KEY— Set only when DotCraft hasAgUi.RequireAuth: true; use the same key as in DotCraft config.
Run
Development:
bashpnpm run devOpen
http://localhost:3000and use the chat.Production build:
bashpnpm run build pnpm run start
How it works
- The frontend uses CopilotKit with
runtimeUrl="/api/dotcraft"anduseSingleEndpoint. - The Next.js API route
/api/dotcraftproxies CopilotKit's single-endpoint protocol to DotCraft's AG-UI endpoint: it handlesinfo,agent/run, andagent/connectby forwarding the request body to DotCraft and streaming the response back.
This sample does not depend on the CopilotKit repository; it uses only npm-published packages.