Installation
AG-UI Adapter
TheAguiAdapter converts MCP tools into the AG-UI protocol format.
AG-UI Middleware
The AG-UI middleware enables server-side execution of MCP tools. This is essential when your agent runs on a separate backend but needs to execute MCP tools that require server-side access (like database or file system access).How It Works
Usage
Event Flow
The middleware intercepts AG-UI events and executes MCP tools:| Event | Description |
|---|---|
TOOL_CALL_START | Records tool name and ID, marks MCP tools as pending |
TOOL_CALL_ARGS | Accumulates streamed arguments |
TOOL_CALL_END | Marks tool call as complete |
RUN_FINISHED | Executes pending MCP tools, emits results, triggers new run |
TOOL_CALL_RESULT | Emitted by middleware with MCP tool results |