Overview
The GAIA Agent UI includes a built-in MCP (Model Context Protocol) server that exposes the full Agent UI as a set of tools. This lets external AI assistants — like Claude Code, Cursor, or any MCP-compatible client — interact with GAIA agents, manage chat sessions, index documents, and browse files, all through the same backend that powers the web UI. Conversations initiated via MCP appear in the browser UI in real time, so you can watch tool execution and agent activity as it happens.Available Tools
| Tool | Description |
|---|---|
system_status | Check GAIA system status (LLM server, model, memory) |
list_sessions | List all chat sessions with titles and message counts |
create_session | Create a new chat session |
get_session | Get details of a specific session |
delete_session | Delete a session and all its messages |
get_messages | Get all messages in a session (with agent steps) |
send_message | Send a message to the GAIA agent (streams to the web UI) |
list_documents | List all indexed documents |
index_document | Index a file for RAG (PDF, TXT, CSV, XLSX, etc.) |
index_folder | Index all documents in a folder |
browse_files | Browse files and folders on the filesystem |
search_files | Search for files by name pattern and type |
preview_file | Preview file contents or metadata |
take_screenshot | Capture the Agent UI browser window (Windows) |
open_session_in_browser | Open a session in the default browser |
Setup with Claude Code
Add the MCP server to Claude Code
--stdio flag tells the MCP server to use stdio transport, which is what Claude Code expects.The MCP server connects to the Agent UI backend at
http://localhost:4200 by default. If your backend runs on a different port, pass --backend http://localhost:YOUR_PORT after --stdio.Setup with Other MCP Clients
The MCP server also supports Streamable HTTP transport for clients that connect over HTTP instead of stdio:http://localhost:8765/mcp.
Usage Examples
Once connected, you can ask Claude Code (or any MCP client) to interact with GAIA:Chat with the Agent
create_session, then send_message, and the conversation will appear in the Agent UI browser window in real time.
Index and Query Documents
index_folder to index the documents, then send_message to query them using RAG.
Browse and Search Files
search_files to find matching files across the filesystem.
Visual Feedback
Architecture
send_message, it streams the response via SSE (Server-Sent Events) from the backend, collects tool outputs and agent steps, and returns the complete result. The web UI receives the same SSE events simultaneously, so you see real-time activity in the browser.
Configuration
| Flag | Default | Description |
|---|---|---|
--stdio | off | Use stdio transport (for Claude Code) |
--port | 8765 | HTTP MCP server port |
--host | localhost | HTTP MCP server host |
--backend | http://localhost:4200 | Agent UI backend URL |
Removing the MCP Server
Troubleshooting
MCP tools not appearing in Claude Code
MCP tools not appearing in Claude Code
Make sure you started a new conversation after adding the MCP server. Claude Code only loads MCP tools at conversation start. Also verify the backend is running with
curl http://localhost:4200/api/health.'Cannot connect to GAIA backend' errors
'Cannot connect to GAIA backend' errors
The Agent UI backend must be running before the MCP server can work. Start it with
uv run python -m gaia.ui.server or use the startup scripts in scripts/.send_message times out
send_message times out
Large documents or complex queries can take time. The default timeout is 180 seconds. If the Lemonade LLM server is slow to respond, check its status with
system_status.