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
gaia daemon starts and supervises it — you don’t launch it yourself.Verify Installation
Check server status:Starting the MCP Server
- Foreground Mode
- Background Mode
- Custom Port
- Verbose Logging
Start in foreground to see logs:
Managing the Server
Check if server is running: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
- Health Check
- Chat (Conversational)
- LLM Query (No Context)
- JSON-RPC Protocol
Integration Examples
- Python
- JavaScript/Node.js
- cURL
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
Connection Refused
Connection Refused
Symptoms: Cannot connect to MCP serverSolutions:
- Ensure the GAIA MCP Bridge is running
- Check firewall settings
- Verify the correct port (default: 8765)
LLM Server Not Responding
LLM Server Not Responding
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_URLis correct (defaulthttp://localhost:13305/api/v1)
Server Won't Start
Server Won't Start
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
No Tools Available
No Tools Available
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:Validation Scripts
GAIA provides test scripts in thetests/mcp/ directory to validate the MCP bridge. Run from the project root directory:
Simple validation test:
The tests validate:
- Health checks and tool listing
- Direct endpoints (
/chat,/llm) - JSON-RPC protocol compliance
- Error handling and CORS headers
Security Considerations
- Authentication: Always use authentication tokens in production
- SSL/TLS: Use encrypted connections for sensitive data
- Rate Limiting: Implement rate limits to prevent abuse
- Access Control: Restrict access to specific IP addresses or networks
- 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_ORIGINSVSCode 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:87653
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
- Development Guide - Setup and contribution guidelines