Prerequisites
- mAItion is running (
docker compose up -d) and healthy - At least one connector has been configured and has indexed data
Enable the MCP Server
Add the following to your.env.rag file:
Security:MCP_API_KEYis required whenMCP_ENABLE=1— the service will refuse to start without it. Use a strong random value and never commit it to version control. Your.env.ragfile is already gitignored. The underlying REST API can also be protected withAPI_KEY. SetAPI_KEY=your-strong-random-keyin.env.ragto require Bearer token authentication on all/api/endpoints. This is recommended when exposing port 8000 outside the Docker network.
Expose the API Port
By default, theapi service is internal to the Docker network. MCP clients running on your host machine need port 8000 exposed. Use the provided compose.mcp.yaml override — this avoids editing compose.yaml directly:
Production note: Do not expose port 8000 publicly without a reverse proxy and TLS. The MCP endpoint is protected by Bearer token auth, but network-level exposure should still be controlled.
Endpoint
The MCP server uses streamable HTTP transport (stateless, no session header required). The endpoint is:Available Tools
retrieve_chunks
Retrieves the most relevant chunks from the vector store for a given query. Fast — no LLM call involved.
Returns: list of chunks with
source_name, source_type, url, title, text, score
rephrase_chunks
Retrieves relevant chunks and generates a concise answer using the configured LLM. Requires inference to be configured in config.yaml. Slower and uses LLM tokens.
Returns:
answer (LLM-generated string) + references list with citations
Cost note:retrieve_chunksonly hits the vector store — no LLM cost.rephrase_chunksmakes an LLM API call and counts toward your token quota.
Verify the Connection
MCP Inspector
Run the MCP Inspector in Docker to interactively explore and test the MCP server:http://host.docker.internal:8000/mcp, and add an Authorization header with your MCP_API_KEY. Click Connect — you should see retrieve_chunks and rephrase_chunks listed under Tools.
curl
Or with curl (confirms the endpoint is reachable):retrieve_chunks and rephrase_chunks.
Troubleshooting
Configuration Reference
See Environment Variables (Backend) for the full
.env.rag reference.