Skip to main content
Source Code: src/gaia/mcp/

GAIA MCP Server

Overview

The GAIA MCP Server provides an HTTP-native bridge that exposes GAIA’s AI agents to third-party applications through standard REST and JSON-RPC protocols. This enables external tools like n8n, Zapier, web applications, and custom integrations to leverage GAIA’s AI capabilities without direct Python dependencies.

When to Use MCP

Use MCP Server When

  • Integrating GAIA with external applications (n8n, Zapier, web apps)
  • Building non-Python applications that need GAIA’s AI capabilities
  • Creating workflow automations with tools that support HTTP/REST
  • Accessing GAIA from browsers or mobile applications

You DON'T Need MCP When

  • Using GAIA CLI directly (gaia chat, gaia llm, etc.)
  • Building Python applications (use GAIA’s Python API directly)
  • Running GAIA agents locally from the command line
  • Integrating with VSCode as a Language Model Provider (use the API Server instead)

Quick Start

1

Install GAIA

MCP is included in base installation
2

Start the MCP Server

3

Test the Server

4

Make Your First API Call

Setup

Prerequisites

1

Install GAIA

Follow the Development Guide to install GAIA
2

Install the LLM backend

Installs Lemonade Server and pulls the model. gaia daemon starts and supervises it — you don’t launch it yourself.

Verify Installation

Check server status:
Test with a simple query:

Starting the MCP Server

Start in foreground to see logs:

Managing the Server

Check if server is running:
Test with a simple query:
Stop the server:

Architecture

The MCP Server acts as an HTTP bridge between external applications and GAIA’s native Python agents.

API Endpoints

REST Endpoints

JSON-RPC Methods

POST / speaks MCP over JSON-RPC 2.0, so standard MCP clients (including the official SDKs) can connect to it directly.

Example API Calls

Response (agent/tool counts vary by installation):

Integration Examples

Example usage:

n8n Integration

For detailed n8n workflow automation examples, see the n8n Integration Guide.

Quick n8n Setup

1

Start the MCP Server

2

Configure HTTP Request Node in n8n

  • Method: POST
  • URL: http://localhost:8765/chat
  • Body: JSON with your query
3

Import Example Workflow

  • Go to Workflows → Import
  • Import src/gaia/mcp/n8n.json

Available Tools

The MCP server exposes the following GAIA agents as tools:

Standard Tools (Port 8765)

Troubleshooting

Symptoms: Cannot connect to MCP serverSolutions:
  • Ensure the GAIA MCP Bridge is running
  • Check firewall settings
  • Verify the correct port (default: 8765)
Symptoms: Queries time out or failSolutions:
  • Check the daemon that supervises the model server: gaia daemon status. If none is running, gaia daemon start
  • If the daemon is up but the model server isn’t, read gaia daemon logs --lines 100
  • Check LEMONADE_BASE_URL is correct (default http://localhost:13305/api/v1)
Symptoms: Server fails to startSolutions:
  • Check if port 8765 is already in use: netstat -an | findstr 8765
  • Stop existing MCP server: gaia mcp stop
  • Try different port: gaia mcp start --port 8766
Symptoms: Empty tools list or specific tools missingSolutions:
  • Check server logs: gaia mcp start --verbose
  • Verify GAIA installation: pip show gaia
  • Reinstall MCP dependencies: uv pip install -e ".[mcp]"

CLI Testing & Debugging

Use GAIA’s built-in MCP commands: Check server status:
Test with a query:
Start with verbose logging:
Test specific host/port:

Validation Scripts

GAIA provides test scripts in the tests/mcp/ directory to validate the MCP bridge. Run from the project root directory: Simple validation test:
Comprehensive HTTP validation test:
Integration tests:
The tests validate:
  • Health checks and tool listing
  • Direct endpoints (/chat, /llm)
  • JSON-RPC protocol compliance
  • Error handling and CORS headers

Security Considerations

For production deployments, always implement these security measures:
  1. Authentication: Always use authentication tokens in production
  2. SSL/TLS: Use encrypted connections for sensitive data
  3. Rate Limiting: Implement rate limits to prevent abuse
  4. Access Control: Restrict access to specific IP addresses or networks
  5. Audit Logging: Enable logging for compliance and debugging

Architecture Notes

HTTP-Native

Pure REST/JSON-RPC, no WebSocket dependencies

Stateless

Each request is independent for better scalability

Agent Access

Direct access to all GAIA agents

Loopback Browser Origins

Browser apps on localhost work; other origins need GAIA_MCP_ALLOWED_ORIGINS

VSCode Integration

GAIA MCP Server can be integrated with VSCode using MCP client capabilities. This provides an alternative integration approach to the VSCode Language Model Provider extension. For complete VSCode integration documentation, see VSCode Integration Documentation. Quick Setup:
1

Start MCP Server

2

Configure VSCode MCP Client

Configure MCP client in VSCode to connect to http://localhost:8765
3

Access GAIA Tools

Access GAIA tools via MCP client

See Also

VSCode Integration

VSCode extension and MCP integration

GAIA API Server

OpenAI-compatible API for VSCode extension

n8n Integration

Detailed workflow automation examples

GAIA CLI

Command line interface reference