Ragty MCP Server
Ragty exposes read-only knowledge retrieval through the Model Context Protocol (MCP). AI clients can discover the caller's datasets and search authorized document chunks without integrating with Ragty's administration API.
Endpoint and Transport
The endpoint uses Streamable HTTP with stateless server sessions and JSON responses. Configure clients with the canonical trailing slash. A request to /mcp is redirected with HTTP 307 to /mcp/; /ragty/mcp is not a backend route unless an external reverse proxy explicitly maps that prefix.
Authentication
Tool discovery and execution, including tools/list, require a Bearer credential:
Credential | Format | Use |
|---|---|---|
User JWT | Standard JWT | Interactive user identity in the active tenant |
Personal API key |
| Long-lived machine credential created in Settings → API Keys |
Invalid, expired, or missing credentials fail closed. Tool descriptions are advisory; authorization is recalculated when a tool is called.
Tool Discovery and Dataset Context
Ragty keeps each tool's name and input schema stable, but extends the existing tool descriptions for the authenticated caller:
list_datasetsincludes bounded names of currently accessible datasets.search_datasetsincludes bounded names and short descriptions for semantic tool selection by clients or LLMs.Caller-controlled dataset metadata is normalized, size-limited, and marked as untrusted data. It must never be treated as instructions.
At most 12 datasets are embedded in descriptions. If more are available, the description tells the client to call
list_datasetsfor the complete catalog.With no accessible datasets, discovery succeeds with an explicit no-access message.
If contextual metadata cannot be loaded after authentication, Ragty returns the original static descriptions. Tool execution still applies live RBAC.
The snapshot is generated on each explicit tools/list request. Clients may cache discovery results, so descriptions must never be used as proof of access.
Available Tools
list_datasets
Returns datasets accessible to the current user and tenant. Call it when the user asks which knowledge bases are available or before a dataset-scoped search.
Parameters: none
search_datasets
Runs hybrid retrieval across authorized datasets. It searches document chunks, not whole documents.
Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | Non-empty query, maximum 2,000 characters |
| string[] | No | Up to 50 dataset IDs from |
| integer | No | Result limit, |
| boolean | No | Apply the configured reranker; default |
If reranking is unavailable or rejects the request, Ragty degrades to the fused hybrid-search results. Dataset IDs are authorization-filtered again at call time.
Client Configuration
Codex
Add this to ~/.codex/config.toml:
Claude Desktop
Add a Streamable HTTP server to the Claude Desktop configuration:
VS Code
Add to .vscode/mcp.json:
Obtain an API Key
Open the frontend at http://localhost:8080.
Navigate to Settings → API Keys.
Create a personal or dataset-scoped key.
Copy the
ragty-...token immediately; it is displayed only once.
Do not place API keys in source control or shared client configuration files.