Skip to content

Integration

REST and MCP API

Your own applications, agents and pipelines reach knowmind through two interfaces: REST for queries and writes inside your program, MCP for tool calls made by a language model. Both use the same access key.

Audience
Developers comfortable with HTTP and JSON. The API is included in every plan, the free Private plan as well.

Prerequisites

  • An email address for the knowmind account
  • An access key of the form kmt_… with read, plus write for saving
  • An HTTP client with TLS in your language
Your application talks to REST or MCP over HTTPS. Behind them sit full-text and vector search in PostgreSQL and the knowledge graph in Neo4j, operated in Germany.

Steps

  1. 1

    Create your knowmind account

    Enter your email address at knowmind.de. You receive a sign-in link by mail and use it to sign in. There is no password.

    Then create your workspace: name, short name and plan. The Private plan costs 0 € and is enough for this guide; the pricing page lists the others.

    Outcome: The welcome screen is open, offering “start by writing” and “connect my AI tool”. Three starter cards are already in your workspace.

  2. 2

    Create an access key

    Create a key in the Cockpit under keys: read is enough for searching, write is needed for saving and linking. The key is shown only once.

    Note

    One key per application

    Create a separate key for every application. Then one can be revoked without stopping the others. In code it belongs in an environment variable, not in the source.

    Outcome: You have a key of the form kmt_….

  3. 3

    Endpoint and authentication

    All requests go to https://knowmind.de, authenticated with the header Authorization: Bearer kmt_…. MCP has a single address, REST one per task; the German REST reference lists them all.

    text
    MCP:     https://knowmind.de/api/mcp/v1
    REST:    https://knowmind.de/api/memory/recall
             https://knowmind.de/api/documents
             https://knowmind.de/api/karten
             https://knowmind.de/api/stats
    Header:  Authorization: Bearer kmt_…

    The MCP address answers either as a single JSON response or as an event stream, depending on what your client asks for in the Accept header. With no particular request you get plain JSON; with Accept: text/event-stream you get the stream some connectors expect.

    Outcome: A call with your key returns the tool list; without a valid key knowmind answers with HTTP 401.

    bash
    curl -s -X POST https://knowmind.de/api/mcp/v1 \
      -H "Authorization: Bearer kmt_…" \
      -H "Content-Type: application/json" \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

  4. 4

    First call: tools, save, search

    The tool list shows what is available. Then save something and search for it — in a fresh workspace the three starter cards come back instead, marked as a starting point rather than a solid hit.

    bash
    # List the tools
    curl -X POST https://knowmind.de/api/mcp/v1 \
      -H "Authorization: Bearer kmt_…" \
      -H "Content-Type: application/json" \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
    
    # Save
    curl -X POST https://knowmind.de/api/mcp/v1 \
      -H "Authorization: Bearer kmt_…" \
      -H "Content-Type: application/json" \
      -d '{
        "jsonrpc": "2.0", "id": 2, "method": "tools/call",
        "params": {
          "name": "knowmind_store_memory",
          "arguments": {
            "memory_type": "semantic",
            "title": "Invoice routing",
            "content": "Invoices go to head office, never to a branch.",
            "source": "handbook"
          }
        }
      }'
    
    # Search
    curl -X POST https://knowmind.de/api/mcp/v1 \
      -H "Authorization: Bearer kmt_…" \
      -H "Content-Type: application/json" \
      -d '{
        "jsonrpc": "2.0", "id": 3, "method": "tools/call",
        "params": {
          "name": "knowmind_recall_memories",
          "arguments": { "query": "Where do invoices go?", "k": 5 }
        }
      }'

    Outcome: Every answer is a JSON-RPC object with result or error. What you saved is found in the next call straight away.

  5. 5

    The same from code

    TypeScript (Node 20 or newer):

    ts
    const TOKEN = process.env.KNOWMIND_TOKEN!;
    const MCP = "https://knowmind.de/api/mcp/v1";
    
    async function tool(name: string, args: Record<string, unknown>) {
      const response = await fetch(MCP, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${TOKEN}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          jsonrpc: "2.0",
          id: 1,
          method: "tools/call",
          params: { name, arguments: args },
        }),
      });
      if (!response.ok) throw new Error(`knowmind: HTTP ${response.status}`);
      return response.json();
    }
    
    const hits = await tool("knowmind_recall_memories", {
      query: "Who wrote the Müller contract?",
      k: 5,
    });
    console.log(hits);

    Python:

    python
    import os, requests
    
    TOKEN = os.environ["KNOWMIND_TOKEN"]
    MCP = "https://knowmind.de/api/mcp/v1"
    HEADERS = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
    
    def tool(name: str, args: dict) -> dict:
        response = requests.post(
            MCP,
            headers=HEADERS,
            json={
                "jsonrpc": "2.0",
                "id": 1,
                "method": "tools/call",
                "params": {"name": name, "arguments": args},
            },
            timeout=10,
        )
        response.raise_for_status()
        return response.json()
    
    print(tool("knowmind_recall_memories", {"query": "GDPR training?", "k": 5}))

    Outcome: The same hits as over curl, with the key from the environment.

  6. 6

    Plan for the rate limit

    The rate limit applies to the tools that query the memory; saving, linking and reporting on the store do not count towards it. The two routes report it differently:

    • REST answers with HTTP 429 and names the waiting time in seconds in the Retry-After header.
    • MCP answers with HTTP 200 and an error field carrying the code -32004 and a sentence the AI tool can pass on. Retry logic keyed to the status code does not catch it; check the error field.

    Wait the time given, with a little jitter, and retry at most three times. The limits of your plan are on the German limits page.

Note

Same title: new version or second entry

knowmind_store_memory always creates a new entry; an existing one with the same title stays valid beside it. knowmind_upload_document, by contrast, supersedes the valid document with the same title in the same domain and returns the superseded ids. Nothing is deleted: the earlier version stays retrievable at earlier points in time, through knowmind_recall_at_time or POST /api/memory/recall-temporal. With replace: false you deliberately store a second document beside it.

How each tool authenticates

  • Claude Desktop, Claude.ai, Claude Code and ChatGPT sign in with your knowmind account, authorised in the browser. You create no key for them.
  • Cursor, Gemini CLI, the command line and n8n work with an access key. Setting them up from the welcome screen creates one for you.
  • Your own applications send the key in the header on every call, as in the examples above.

Other tools that speak MCP

Any tool that can add an MCP server over HTTP with its own header can connect knowmind, even without a guide of its own — LM Studio or Continue, for instance. Many of them read a JSON file in this shape:

json
{
  "mcpServers": {
    "knowmind": {
      "url": "https://knowmind.de/api/mcp/v1",
      "headers": {
        "Authorization": "Bearer kmt_…"
      }
    }
  }
}

Where that file lives and what the fields are called is in the tool’s own documentation. knowmind receives the query and returns the hits; the rest of the conversation with the model never reaches knowmind. If a tool only supports locally started servers, the command line acts as a bridge with knowmind mcp.

Verify the result

The integration works when all three hold:

  • tools/list with your key returns the tool list; with a wrong key it returns HTTP 401.
  • tools/call with knowmind_recall_memories and a known question returns a hit.
  • The Cockpit shows the call in the timeline and a last-used time under keys.

Troubleshooting

Error messageCauseResolution
401 UnauthorizedThe key is missing, revoked, or the header is misspelled.Check the format: Authorization: Bearer kmt_… with a space after Bearer, and check in the Cockpit whether the key is still valid.
403 Forbidden (REST)The key only carries read, and the call wants to write.Create a key with read and write and revoke the old one.
-32002 Missing scope (MCP)The same thing over MCP: the key lacks the required right. The status code stays 200.Create a key with read and write; the message names the missing right.
429 Too Many Requests (REST)The workspace rate limit is reached.Read Retry-After and wait that long. For sustained volume, a larger plan allows more requests per minute.
-32004 (MCP)The same limit over MCP, as an error in the body with HTTP 200.Check the error field of the response and make the next call later.
The connector expects an event streamThe request does not ask for text/event-stream.Send the header Accept: text/event-stream; without it knowmind answers with plain JSON.
What we tested
Tested on 19 October 2026: listing the tools, saving and searching over /api/mcp/v1 with a key in the header all work, as JSON and as an event stream. Account, workspace and deleting the workspace were walked over the same route.

Related