> ## Documentation Index
> Fetch the complete documentation index at: https://docs.seynlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Knowledge tools over the Model Context Protocol: give any MCP-capable agent grounded, org-scoped, fully audited access to extracted knowledge.

The MCP server exposes Seyn's knowledge to external AI agents via the [Model Context Protocol](https://modelcontextprotocol.io), the open standard supported by Claude, Claude Code, Cursor, and a growing list of agent runtimes. The pitch in one line: **your agents stop guessing how your business works, because they can look it up.**

## The tools

| Tool                  | What it returns                                                                                                                    |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `get_processes`       | All processes in the org: names, descriptions, step and rule counts. The orientation call.                                         |
| `get_process_rules`   | Rules for a process, optionally filtered by step: descriptions, confidence, frequency, review status.                              |
| `query_knowledge`     | Natural-language search through the full [hybrid query pipeline](/platform/query); supports the same strategies as the API.        |
| `get_rule_provenance` | The complete [audit chain](/platform/provenance) for a rule: inference log, events, raw records. Your agent can show receipts too. |
| `get_related_rules`   | Knowledge-graph neighbours of a rule, with relation types.                                                                         |
| `get_entity_timeline` | Chronological events for an entity: what happened to this deal, in order, with before/after state.                                 |
| `get_entity_graph`    | Multi-hop entity neighbourhood: the people, tools, and entities connected to a starting point, with the assertions that link them. |

A typical agent flow: `get_processes` to orient, `query_knowledge` for the user's question, `get_rule_provenance` when the user asks "why?".

## Transport, auth, audit

* **Transport:** stdio (JSON-RPC 2.0). The server runs as a local process speaking to your MCP client.
* **Auth:** a Seyn API key (`SEYN_MCP_API_KEY` environment variable). The key binds the session to exactly one organisation; every tool result is scoped to it, with no cross-tenant path. Same model as the [public API](/authentication).
* **Audit:** every tool invocation is logged with operation, latency, and outcome. An agent reading your knowledge base leaves the same trail a human would.
* **Rate limiting:** per-key sliding window; over-limit calls return a structured error with retry guidance.

## Setup

<CodeGroup>
  ```json Claude Desktop theme={null}
  {
    "mcpServers": {
      "seyn": {
        "command": "npx",
        "args": ["@seyn/mcp-server"],
        "env": { "SEYN_MCP_API_KEY": "sk_live_..." }
      }
    }
  }
  ```

  ```bash Claude Code theme={null}
  claude mcp add seyn \
    --env SEYN_MCP_API_KEY=sk_live_... \
    -- npx @seyn/mcp-server
  ```
</CodeGroup>

<Note>
  Like the SDK, the MCP server package is in **private alpha**: distribution is currently by tarball from the team rather than npm. [Request access](mailto:support@seynlabs.com?subject=Seyn%20access%20request); configuration is identical once installed.
</Note>

## Error shape

Tools return the platform's standard error format (`NOT_FOUND`, `VALIDATION_ERROR`, `RATE_LIMITED`, `INTERNAL_ERROR`) as structured tool results rather than protocol failures, so agents can branch on them.

## Common mistakes

| Symptom                               | Cause                                                           | Fix                                                                                  |
| ------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| Every tool returns empty results      | The API key belongs to an org with no active knowledge library  | Verify the key's org in the dashboard; run extraction if needed                      |
| Agent answers without consulting Seyn | The agent's system prompt doesn't tell it when to use the tools | Instruct it explicitly: "for questions about processes, query seyn before answering" |
| `RATE_LIMITED` during agent loops     | Agents can burn a sliding window fast in retry loops            | Honor the retry guidance in the error; add backoff to the agent harness              |

## Related

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    API keys: creation, rotation, revocation.
  </Card>

  <Card title="Query" icon="magnifying-glass" href="/platform/query">
    What `query_knowledge` runs under the hood.
  </Card>
</CardGroup>
