Skip to main content
The Ragen MCP Server lets any MCP-compatible client — Claude Desktop, Cursor, Hermes Agent, a custom agent, or any tool that speaks the Model Context Protocol — talk directly to your Ragen assistants. Instead of integrating the Chat REST API yourself, point your client at the MCP endpoint and start chatting with your knowledge base immediately. This is the reverse of MCP Connectors: here, an external client calls into Ragen rather than Ragen calling out to other services.

Connecting your client

Point your MCP client at the Streamable HTTP endpoint:
Authenticate using a Ragen API key — the same key you’d use for the REST API. Send it as a Bearer token on every connection:
A connection with no Authorization header, or one that isn’t Bearer-prefixed, is rejected with 401 before any tool call can proceed. Ragen validates the key on each tool call — a deactivated or malformed key fails exactly as it would on POST /v1/chat. Every tool call runs with the permissions of the person who created the key: the key’s scope picks the assistant or the knowledge base, and inside it retrieval applies that person’s document permissions, the same as in the web app. See Authentication.

Available tools

Omit assistant_id unless you have one. The API key carries a scope: a key created for one assistant answers for it without being told, and a key scoped to the whole knowledge base rejects a request naming any assistant with 403. ragen_list_assistants shows what the key you connected with can reach. See Authentication.

ragen_chat

Send a message to a Ragen assistant and receive its answer.
string
The ID of the assistant (project) to send the message to. Optional — the key decides by itself, and naming an assistant it is not scoped to is refused. Use ragen_list_assistants to see what this key can reach.
string
required
The message to send to the assistant.
string
Additional context to include alongside the message — for example, the content of the page the caller is currently viewing.
string
OpenAI-style reasoning effort level: "low", "medium", or "high". Only honoured by reasoning-capable models; ignored otherwise.
Success response:
Error response:
A 403 means the key and the request disagree about the assistant — either you named one the key is not scoped to, or you named one at all on a knowledge-base key. A 404 still means the assistant does not exist for this organization.
ragen_chat is always non-streaming. An MCP tool call returns a single result, so there is no mechanism to forward a partial answer token-by-token. If you need streaming responses, call the Chat API directly with stream: true.

ragen_list_assistants

List the assistants your API key can reach. A knowledge-base key sees every assistant its organisation owns; a key created for one assistant sees that one. Use this to find an assistant_id before calling ragen_chat — or, if exactly one comes back, to confirm you can omit it. This tool takes no parameters. Success response:
Error response:
Scoping is automatic: this calls the same GET /v1/assistants endpoint as the REST API, which returns what the key can reach — the organisation’s assistants for a knowledge-base key, the single bound one otherwise. The example above shows a knowledge-base key. There is no additional access configuration needed.

ragen_search_knowledge_base

Search the knowledge base and get back the most relevant document chunks, without generating an answer. Use it when your agent should reason over Ragen’s documents itself — or when you want to check what Ragen retrieves before blaming the answer. It is the MCP equivalent of POST /v1/search.
string
The assistant (project) whose knowledge base to search. Optional — the key decides by itself, and naming an assistant it is not scoped to is refused.
string
required
The search query.
integer
Maximum number of chunks to return, a whole number from 1 to 20. Defaults to the organisation’s configured retrieval count.
Success response:
context is the same block Ragen’s chat passes to the model; file_ids are the source files, which GET /v1/files/{id} resolves. Error response:

Configuring Claude Desktop

There are two ways to connect, depending on where the MCP server runs:
  • Your Ragen instance already runs the MCP server. Connect to its /mcp endpoint through mcp-remote, below.
  • It does not, or you would rather run it on your own machine. Claude Desktop can start the server itself over stdio. See Running the server locally over stdio.

Connecting to a deployed server

Add a ragen entry to your Claude Desktop configuration file:
claude_desktop_config.json
claude_desktop_config.json launches local processes over stdio; it has no field for a remote URL or request headers. mcp-remote is the bridge: Claude Desktop starts it as a process, and it forwards every call to your Ragen MCP endpoint over Streamable HTTP with the Authorization header attached. Replace https://your-ragen-instance.example.com with your RAGEN_MCP_URL value and YOUR_API_KEY with a valid Ragen API key.
The header goes through an environment variable, written as Authorization:${RAGEN_AUTH} with no space after the colon: some clients split arguments on spaces, and Bearer YOUR_API_KEY inside args would arrive as two arguments.
After saving the config, restart Claude Desktop. You should see ragen_chat, ragen_list_assistants and ragen_search_knowledge_base in Claude’s tool list. Call ragen_list_assistants first to confirm the connection is working and to retrieve your assistant IDs.

Running the server locally over stdio

Claude Desktop can start the MCP server as a local process and talk to it over stdin and stdout, with no mcp-remote in between. The server still calls your Ragen API for every tool, so the API has to be reachable from your machine.
claude_desktop_config.json
RAGEN_API_URL is the address of the Ragen API (the api service), not of the MCP server, and it is resolved from inside the container. If the API runs on the same machine, localhost points at the container itself. On Docker Desktop, use http://host.docker.internal:3001 instead. RAGEN_API_KEY is the key on its own, without Bearer. Over stdio there is no request to carry an Authorization header, so the server reads the key from its environment instead.
Without RAGEN_API_KEY the server still starts and lists its tools, and every tool call returns an error naming the variable to set. That error is the first thing to check if the tools appear but never answer.
Stdio needs Ragen 2.37.0 or later. Pin the image to a version you have checked (ghcr.io/webamigos/ragen-mcp:2.37.0) if you would rather not follow latest.

Configuring Cursor

In Cursor’s MCP settings, add a new server entry with:
  • Transport: Streamable HTTP
  • URL: $RAGEN_MCP_URL/mcp
  • Authorization header: Bearer YOUR_API_KEY
.cursor/mcp.json

Configuring Hermes Agent

Hermes Agent is a personal agent that runs on your own machine or server. Connected to Ragen, it answers from your company knowledge base within the permissions of the person whose key it uses, while Hermes itself handles tasks, memory and messaging channels. Tested with Hermes Agent 0.16.0. Add a ragen entry under mcp_servers in the Hermes config.yaml (~/.hermes/config.yaml, or a profile’s own file under ~/.hermes/profiles/<name>/):
config.yaml
Hermes resolves ${RAGEN_API_KEY} from its environment when it connects, so the key never has to be written into the file. Set it without echoing it, then check the connection:
A working connection reports Tools discovered: 3 and lists ragen_chat, ragen_list_assistants and ragen_search_knowledge_base. Hermes exposes them to the model as mcp_ragen_ragen_chat and so on, and marks every result as untrusted tool output.
Create the key as the person who will use the agent. A key carries the permissions of the person who created it, so a key created by an organization owner gives the agent the owner’s view of every document. With a plain member’s key, a document the member cannot open in the web app is not returned to the agent either, through ragen_search_knowledge_base or ragen_chat.
If the agent should only answer from the knowledge base, give it a dedicated profile and switch off the toolsets it does not need, such as the terminal and file access:
Hermes and Ragen can share one model server. Point both at the same Ollama or vLLM endpoint (Open models). Hermes needs a model with a context window of at least 64,000 tokens.

Custom agents

For custom agents or any MCP-compatible SDK, use Streamable HTTP transport and supply the Authorization: Bearer header on connection. All standard MCP tool-call patterns apply — discover tools with the standard tools/list method and invoke them with tools/call.

ragen_chat

Send a question to a specific assistant and receive a complete answer in one call.

ragen_list_assistants

Discover the assistants your API key can reach.

ragen_search_knowledge_base

Retrieve the most relevant document chunks, with no answer generated.

Testing the connection

Before you configure a client, you can check each layer from a terminal with the MCP Inspector CLI. Run the commands in order. Each one depends on everything the one before it proved, so the first failure tells you which layer is broken.

Set the key without echoing it

Read the key into a variable instead of typing it on the command line, where it would land in your shell history and on screen:
Paste the key and press Enter. Nothing is shown. Set RAGEN_MCP_URL to your server’s address the same way, or with a plain export, since it is not a secret.

Check one layer at a time

1

The MCP server: list its tools

You should see ragen_chat, ragen_list_assistants and ragen_search_knowledge_base. This step does not check the key: the MCP server only checks that the header is shaped like Bearer <key>. A pass proves the server is reachable, nothing more.
2

The key and the Ragen API: list assistants

"success": true with a list of assistants means the key is valid. It also means the Ragen API, and the token vault it checks keys against, both work.
3

Retrieval: search the knowledge base

"success": true means the vector store answers. An empty file_ids list is still a pass: retrieval works, and this query found nothing.
4

A model answer: chat

This spends model tokens, so run it last.

Reading the result

When you are done testing, deactivate a key you created only for the test in Organization → API keys.

Self-hosting the MCP server

If you run Ragen yourself, the MCP server is a separate service — a thin one. It owns no data: every tool call forwards an API key to the Ragen API, which does the authentication, the retrieval and the rate limiting. That is why it configures in three variables, plus two for stdio and two optional ones for OpenTelemetry. Use the published image, ghcr.io/webamigos/ragen-mcp, or build it from the repository’s apps/mcp/Dockerfile, whose build context is the repository root, and run node dist/index.js. By default it listens for Streamable HTTP on /mcp; with RAGEN_MCP_TRANSPORT=stdio it serves one client over stdin and stdout instead.

Environment variables

There is nothing else — no database, no Redis, no API key of its own over HTTP. There, a key belongs to whoever is calling, arrives per request, and is never stored. Over stdio the server serves one client, so that client’s key comes from RAGEN_API_KEY.
TARGET_ENV is what makes RAGEN_API_URL required. A deployment that leaves it unset would read as local, accept the localhost fallback, boot cleanly, and then fail every tool call with a connection error. Recent versions refuse to start instead — if yours boots without it, set it anyway and check RAGEN_API_URL really points at your API.

When tools are listed but calls fail

The MCP server’s health check (/health) and its tool list do not depend on the Ragen API, so both pass while every tool call fails. The calls depend on variables of the api service, not of the MCP server: If you have a checkout of the Ragen repository, its smoke test runs all of the steps above against a URL and prints a hint naming the service and variable for the first one that fails:
It reads the key from RAGEN_API_KEY and exits with 1 when a step fails, so it can also run after a deployment.