Skip to main content
Prerequisites: Complete the Setup guide and have the Agent UI backend running.

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

The memory_* tools are conditional. The read tools (memory_stats, memory_list, memory_recall, memory_get, memory_get_by_entity, memory_get_conversation_turns) are registered only when memory MCP access is enabled — either via the Memory Dashboard toggle (mcp_memory_enabled) or GAIA_MEMORY_MCP_ALWAYS=1. The admin tools (memory_seed, memory_clear) additionally require GAIA_MEMORY_ADMIN=1 on the backend process.

Setup with Claude Code

1

Start the Agent UI backend

Verify the backend is running:
2

Add the MCP server to Claude Code

The --stdio flag tells the MCP server to use stdio transport, which is what Claude Code expects.
3

Start a new Claude Code conversation

After adding the MCP server, start a new conversation (or restart Claude Code) so it picks up the new tools. You should see gaia-agent-ui tools available.
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:
Connect your MCP client to 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

Claude Code will call create_session, then send_message, and the conversation will appear in the Agent UI browser window in real time.

Index and Query Documents

This calls index_folder to index the documents, then send_message to query them using RAG.

Browse and Search Files

The agent uses search_files to find matching files across the filesystem.

Visual Feedback

Captures the browser window and returns the image path for review.

Architecture

The MCP server is a thin wrapper around the Agent UI REST API. When you call 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


Removing the MCP Server

Troubleshooting

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.
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 installer/scripts/.
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.