Retrieval

MCP server

The MCP server lets any MCP-compatible client: Claude Code, Cursor, VS Code, ChatGPT, or an agent you build yourself: search the knowledge of one project. The client does the reasoning; QueryMind returns the passages, each with the document it came from.

MCP (Model Context Protocol) is an open standard for connecting AI applications to external systems. This page assumes you know what an MCP client is; it describes what this server exposes and how to reach it.

Two ways to reach the same corpus

Both endpoints live on mcp.querymindx.tech. They serve the same two tools and differ only in how the caller proves who it is.

EndpointAuthenticationFor
POST /mcpAuthorization: Bearer ak_…Agents and backends you operate
POST /mcp/<project-uid>None, but the project must be marked publicExternal users in Cursor, Claude Code, VS Code

Both speak JSON-RPC 2.0 over HTTP and answer in application/json. Batch requests are accepted: send an array, receive an array.

API key mode

Every request carries a project API key. The key is bound to one project: it cannot be pointed at another corpus by passing a different identifier.

http
POST https://mcp.querymindx.tech/mcp
Authorization: Bearer ak_…
Content-Type: application/json

Keep the key in your backend. Never ship it in client-side code or send it to a browser: it grants read access to the whole corpus of the project.

Public mode

A public server needs no credential, which makes it usable by people who do not have an account. It is off by default and switched on per project:

sql
UPDATE projects SET mcp_public = 1 WHERE uid = 'v0m6-4hag-6ubz-o57g-7l00';

The project UID is the one shown in the dashboard and carried by the widget snippet. It is matched case-insensitively.

http
POST https://mcp.querymindx.tech/mcp/v0m6-4hag-6ubz-o57g-7l00

What protects the corpus is not the secrecy of the UID: it travels in snippets and URLs. It is the flag: a project that is not marked public answers 404, exactly like a UID that does not exist. The response does not reveal whether the project exists.

Public mode serves only initialize, tools/list, tools/call and ping. It cannot write, cannot list documents, and cannot reach another project. Only projects with visibility = 'external' can be made public: an internal project stays unreachable however the flag is set.

There is deliberately no domain allow-list here, unlike the website widget. An MCP client calls from a server: it sends no Origin and no Referer, so there is nothing to compare against, and requiring a domain would reject every legitimate call.

Connecting a client

Claude Code:

bash
claude mcp add --transport http querymind https://mcp.querymindx.tech/mcp \
  --header "Authorization: Bearer ak_…"

For a public server, drop the header and put the UID in the path:

bash
claude mcp add --transport http querymind https://mcp.querymindx.tech/mcp/v0m6-4hag-6ubz-o57g-7l00

Any client that speaks streamable HTTP works the same way; the URL and, where required, the header are the only configuration.

SparkCode

SparkCode speaks the same protocol. The declaration mirrors the Claude Code command, with sparkcode in front: the options are identical:

bash
sparkcode mcp add --transport http querymind https://mcp.querymindx.tech/mcp \
  --header "Authorization: Bearer ${QUERYMIND_API_KEY}"

For a public server, drop the header and put the UID in the path:

bash
sparkcode mcp add --transport http querymind https://mcp.querymindx.tech/mcp/v0m6-4hag-6ubz-o57g-7l00

Three notes specific to SparkCode. The environment-reference form ${QUERYMIND_API_KEY} is deliberate: the literal text is written to the declaration file and the variable is read at launch, so the key never lands in a config file in plain text. The key must then be present in the environment (export QUERYMIND_API_KEY=ak_…); a missing variable is reported as an error named after the variable, not sent as an empty credential. And unlike Claude Code, --transport stdio is not supported: if a published snippet uses an mcp-remote bridge, it is unnecessary here: the declaration is translated to direct HTTP.

Verify the declaration without connecting:

bash
sparkcode mcp list

A line reading refused: Missing environment variable: QUERYMIND_API_KEY means the declaration is in place but the variable was not set at launch.

Video walkthrough — Claude Code

The whole integration, recorded end to end: the key in a shell variable, the claude mcp add command, the connection check, then a real question answered with cited documents inside Claude Code.

Connecting the QueryMind MCP server to Claude Code, then asking a question and reading the cited sources · 1 min 27 s

Video walkthrough — SparkCode

The same integration in SparkCode: the key stays in a shell variable, sparkcode mcp add declares the server, sparkcode mcp list confirms it, then /mcp list inside the terminal UI shows the two tools connected before a real question is answered with cited documents.

Connecting the QueryMind MCP server to SparkCode, checking the connection, then asking a question and reading the cited sources · 1 min 28 s

Video walkthrough — Codex CLI

The same integration in Codex CLI: the key in a shell variable, codex mcp add with --bearer-token-env-var so the token is read from the environment rather than written to the config file, then /mcp inside the terminal UI showing querymind: connected (2 tools) before a real question is answered with cited sources.

Connecting the QueryMind MCP server to Codex CLI, checking the connection with /mcp, then asking a question and reading the cited sources · 6 min 18 s

Video walkthrough — Gemini CLI

The same integration in Gemini CLI: gemini mcp add with the HTTP transport and an Authorization header, then gemini mcp list confirming querymind: Connected before a real question answered with three cited documents.

This recording uses Gemini's non-interactive mode (gemini -p) rather than its full-screen UI: on the machine this was recorded on, the interactive mode stayed on Thinking for over four minutes without producing an answer, while the same question through -p returned in about a minute. The MCP integration is identical either way — only the surface differs.

Connecting the QueryMind MCP server to Gemini CLI, verifying the connection, then asking a question and reading the three cited documents · 2 min 30 s

The tools

search_knowledge_sources

Searches the corpus of the project and returns the most relevant passages.

ArgumentTypeRequiredDescription
querystringYesA specific, complete question. Vague keywords return worse passages than a full sentence.
limitintegerNoHow many passages to return. Default 5, maximum 8.

Each result carries:

  • text: the passage, as it is indexed.
  • document: the name of the file it comes from.
  • document_id: the id to pass to get_knowledge_document.
  • score: the similarity score, higher is closer.

The search is dense retrieval over the project's vectors. The passages are the same ones the chat assistant reads, so a citation the agent produces can be traced back to a real document.

get_knowledge_document

Returns the full text of one document, given an id that a search returned.

ArgumentTypeRequiredDescription
idstringYesThe document_id from a search result.

The content is reconstructed from the document's indexed chunks, in reading order: that is, exactly the text the assistant had access to. A document longer than 120 000 characters is truncated and the result says so in truncated.

Documents that are not in the project of the server are never returned: an id belonging to another project, or another account, comes back as document introuvable.

Protocol

The server implements three methods plus ping, and tolerates notifications.

MethodPurpose
initializeHandshake. Returns the protocol version, capabilities.tools, and the server name.
tools/listReturns the two tools with their JSON schemas.
tools/callInvokes a tool.
pingLiveness.

A request without an id is treated as a notification and answered with 202 Accepted and an empty body, as the specification requires.

Example

bash
curl -s https://mcp.querymindx.tech/mcp/v0m6-4hag-6ubz-o57g-7l00 \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "search_knowledge_sources",
      "arguments": { "query": "How do I rotate an API key?", "limit": 3 }
    }
  }'
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [{ "type": "text", "text": "[1] security.md (score 0.741)\n…" }],
    "structuredContent": {
      "results": [
        {
          "text": "…",
          "document": "security.md",
          "document_id": "2572",
          "score": 0.741
        }
      ]
    },
    "isError": false
  }
}

The text block is what most clients display; structuredContent is the same information for clients that prefer to parse it.

Errors

Errors follow JSON-RPC: a -32602 for a missing or invalid argument, -32603 when a dependency fails (embedding, search, unreadable document), -32601 for an unknown method, -32700 for a body that is not JSON.

A tool that fails on its own terms: an unknown document id, an unreadable file: comes back as a JSON-RPC error (-32602 or -32603) rather than as a result with isError: true. The isError field is present and false on successful calls; treat any error object as a failed call.

What the server does not do

There is no write tool, no crawl trigger, and no analytics access. The MCP server reads a corpus; administering the project stays in the dashboard and the GraphQL API. A public server additionally cannot list documents: it can only search, then fetch by the id a search returned.