MCP
Model Context Protocol gateway and tool reference
Model Context Protocol (MCP)
Overview
This project exposes an MCP server for AI agents and LLM clients through the Public Gateway.
Live Tools
The gateway currently exposes health check and knowledge base search and browsing tools.
Header-Based Auth
MCP requests authenticate with an API key unless the request is already associated with an existing MCP session.
Knowledge Base Access
The gateway exposes safe, tenant-aware knowledge base tools over MCP.
Image Search
Image-oriented retrieval is supported through a dedicated image search workflow.
MCP Client Package
Official npm package @agent-brains/mcp-client for instant integration with
Claude Desktop, Cursor, and other MCP clients.
- Server URL:
https://api.agent-brains.com - Purpose: expose safe, tenant-aware knowledge base tools over MCP
- Transports protected by middleware:
/mcp,/sse,/messages - Current MCP scope: health check and knowledge base search/browsing tools
The MCP layer is implemented with NestJS resolvers and forwards requests to underlying services, mainly SDS for knowledge base operations.
MCP Client Package
We publish an official npm package — @agent-brains/mcp-client — that acts as a local stdio proxy between any standard MCP client and the Agent Brains Gateway.
Instead of configuring HTTP transports manually, you can run the proxy with
npx and let your IDE or chat client communicate over the standard MCP stdio
protocol.
Claude Desktop
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"agent-brains": {
"command": "npx",
"args": ["-y", "@agent-brains/mcp-client"],
"env": {
"AGENT_BRAINS_API_KEY": "<your-api-key>"
}
}
}
}Cursor
Add the following to .cursor/mcp.json in your project root:
{
"mcpServers": {
"agent-brains": {
"command": "npx",
"args": ["-y", "@agent-brains/mcp-client"],
"env": {
"AGENT_BRAINS_API_KEY": "<your-api-key>"
}
}
}
}Other MCP Clients
Any MCP client that supports the stdio transport can use the same pattern.
Point the client's command to npx with the arguments shown above and
set the AGENT_BRAINS_API_KEY environment variable.
API Key Required
You need an AgentBrains API key with the knowledge-base scope.
See Access API Key for instructions on
creating one.
Authentication
MCP requests require a valid API key unless the request is already associated with an existing MCP session.
Supported headers:
x-api-key: <key>authorization: Bearer <key>
The gateway resolves the tenant from the API key and enforces the
knowledge-base scope for the knowledge base tools.
Available Tools
health_check
Simple availability check for the public gateway.
Parameters: none
search-knowledge-base
Semantic search across a selected knowledge base index.
Parameters:
index(string, required): knowledge base index namequery(string, required): natural language querytopK(number, optional, default10, max50): number of matches to returnmetadata(object, optional): metadata filters forwarded to SDS
Behavior:
- Maps
indexto SDSnamespace - Sends a
POSTrequest to/retrieve
list-knowledge-base-indexes
Lists available knowledge base indexes.
Parameters:
status(initial | vectorised | fail, optional): filter by index statuscategoryId(string, optional): filter by category IDname(string, optional): text search in index namenotes(string, optional): text search in index notes
Behavior:
- Sends a
GETrequest to/indexes
search-images
Semantic search over the image index.
Parameters:
query(string, required): natural language querytopK(number, optional, default10, max50): number of matches to returnmetadata(object, optional): metadata filters forwarded to SDS
Behavior:
- Hardcodes SDS
namespacetoimages - Sends a
POSTrequest to/retrieve
get-entity
Fetches a full knowledge base entity by ID or exact name.
Parameters:
id(string, optional): entity IDname(string, optional): exact entity name
Rules:
- At least one of
idornamemust be provided
Behavior:
- Sends a
GETrequest to/entities/:key
get-knowledge-base-structure
Browses the category tree for the knowledge base.
Parameters:
categoryId(string, optional): category to drill into
Behavior:
- Without
categoryId, sendsGET /categories - With
categoryId, sendsGET /categories/:categoryId
Usage Notes For AI Agents
- Prefer
search-knowledge-basefor text and semantic discovery. - Prefer
search-imagesonly for image-oriented retrieval use cases. - Use
list-knowledge-base-indexesfirst when the correct index is unknown. - Use
get-knowledge-base-structureto browse taxonomy before deep retrieval. - Use
get-entitywhen you already know the entity ID or exact name. - If a tool returns a validation error, fix the parameters and retry instead of guessing new fields.
Recommended Prompt
Use the following prompt when connecting an AI agent to this MCP server:
You are connected to the Agent Brains Public Gateway MCP server.
Your job is to help the user find and retrieve knowledge base information accurately and efficiently.
Rules:
- Use MCP tools instead of inventing data.
- Before searching, identify the most appropriate knowledge base index.
- If the correct index is unknown, call `list-knowledge-base-indexes` first.
- For general semantic search, call `search-knowledge-base` with:
- `index`: the chosen index name
- `query`: the user's request rewritten as a focused search query
- For image-related retrieval, call `search-images`. Do not ask the user for an image namespace because it is fixed internally.
- When the user asks to browse categories or structure, call `get-knowledge-base-structure`.
- When the user asks for a specific known entity, call `get-entity` with `id` or exact `name`.
- Do not guess missing required parameters. Ask a clarification question when needed.
- Summarize tool results clearly, and distinguish facts returned by tools from your own reasoning.
- If a tool returns no results, say so plainly and propose the next best query or tool.
Response style:
- Be concise and factual.
- Prefer actionable answers.
- Mention which index you used when performing knowledge base search.Example Workflows
Find the right index
- Call
list-knowledge-base-indexes - Select the best matching index
- Call
search-knowledge-base
Search for product images
- Call
search-imageswith the user's image-related query - Summarize the returned matches
Inspect the taxonomy
- Call
get-knowledge-base-structurewithoutcategoryId - If needed, call it again with a selected category ID