Skip to main content
The mAItion MCP server exposes the retrieval API as a Model Context Protocol endpoint. This lets any MCP-compatible system — agents, orchestration frameworks, or custom integrations — call mAItion’s retrieval tools programmatically.

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:
Then restart the API service:
Verify it started:
Security: MCP_API_KEY is required when MCP_ENABLE=1 — the service will refuse to start without it. Use a strong random value and never commit it to version control. Your .env.rag file is already gitignored. The underlying REST API can also be protected with API_KEY. Set API_KEY=your-strong-random-key in .env.rag to 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, the api 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:
All requests must include a Bearer token:
Integrate this endpoint into any MCP-compatible system by pointing it at the URL above and passing the authorization header.

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_chunks only hits the vector store — no LLM cost. rephrase_chunks makes 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:
Then open http://localhost:6274/ in your browser. Set the transport to Streamable HTTP, the URL to 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):
Expected: a JSON response listing retrieve_chunks and rephrase_chunks.

Troubleshooting

Configuration Reference

See Environment Variables (Backend) for the full .env.rag reference.