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

# MCP endpoint (agentic filesystem access)

> Per-knowledge-base Model Context Protocol endpoint (JSON-RPC 2.0, MCP spec
2025-06-18). Gives agents deterministic, filesystem-style access to this
base's content, complementary to semantic `/search`. The `knowledge_base_id`
is fixed by the URL and injected into every tool call, so an agent connected
here can only read THIS base and never passes the id itself. Access control
reuses the same middleware as the REST routes; content returned by the tools
is redacted from execution events.

Nine tools are exposed via `tools/list` and `tools/call`: `kb_search`
(semantic top-k), `kb_ls` (list documents), `kb_find` (find by name),
`kb_cat` (read a full document, chunks reassembled and de-duplicated),
`kb_grep` (pattern search with line numbers, literal by default), `kb_head`
and `kb_tail` (first and last N lines), `kb_sed` (output-only substitution,
never persisted) and `kb_source_url` (resolve a citation link).

Transport: POST only. A GET (SSE stream probe) returns 405; this endpoint
does not offer server-streaming.




## OpenAPI

````yaml /api-reference/storage/swagger.yml post /v1/knowledge_bases/{knowledgeBaseId}/mcp
openapi: 3.0.3
info:
  version: 1.0.0
  title: Knowledges API
  description: >
    Public REST API for the Prisme.ai Knowledges (storage) workspace: knowledge
    bases, documents (uploaded files, web pages, remote files, connector
    documents), recurring web-crawl sources, semantic search, access control,
    per-knowledge-base API keys, and skills.


    Resource identifiers use the physical prefixes emitted by the implementation
    (`vs_` knowledge base, `vsf_` document, `seed_` web source, `kb-` API-key
    slug).


    This spec documents the public REST surface only. Internal helpers (private
    automations prefixed with `_`) and admin/GDPR lifecycle operations are not
    part of the public contract.
  contact:
    name: Prisme.ai
    url: https://prisme.ai
servers:
  - url: https://{host}/v2/workspaces/slug:storage/webhooks
    description: Prisme.ai workspace webhooks
    variables:
      host:
        default: api.studio.prisme.ai
        description: API host (override for self-hosted or sandbox)
security:
  - BearerAuth: []
  - WorkspaceApiKeyAuth: []
tags:
  - name: Knowledge Bases
    description: >-
      Create, list, read, update, and delete knowledge bases (vector-backed
      document stores).
  - name: Documents
    description: >-
      Ingest and manage documents (uploaded files, web pages, remote files,
      connector documents) and their indexing.
  - name: Web Sources
    description: >-
      Recurring web crawl seeds that discover and index pages into a knowledge
      base.
  - name: Search
    description: Semantic search over a knowledge base.
  - name: MCP
    description: >-
      Per-knowledge-base Model Context Protocol endpoint for deterministic,
      filesystem-style access to content (kb_search, kb_ls, kb_find, kb_cat,
      kb_grep, kb_head, kb_tail, kb_sed, kb_source_url).
  - name: Access
    description: Per-knowledge-base access bindings (user, group, org, agent principals).
  - name: API Keys
    description: Per-knowledge-base API keys for connector authentication.
  - name: Stats
    description: Aggregate dashboard statistics.
  - name: Skills
    description: Prompt/instruction registry entries.
paths:
  /v1/knowledge_bases/{knowledgeBaseId}/mcp:
    parameters:
      - name: knowledgeBaseId
        in: path
        required: true
        schema:
          type: string
          pattern: ^vs_[A-Za-z0-9-]+$
          maxLength: 128
        description: >-
          Knowledge base id. Legacy physical prefix `vs_` (the `kb_` rename is
          deferred).
    post:
      tags:
        - MCP
      summary: MCP endpoint (agentic filesystem access)
      description: >
        Per-knowledge-base Model Context Protocol endpoint (JSON-RPC 2.0, MCP
        spec

        2025-06-18). Gives agents deterministic, filesystem-style access to this

        base's content, complementary to semantic `/search`. The
        `knowledge_base_id`

        is fixed by the URL and injected into every tool call, so an agent
        connected

        here can only read THIS base and never passes the id itself. Access
        control

        reuses the same middleware as the REST routes; content returned by the
        tools

        is redacted from execution events.


        Nine tools are exposed via `tools/list` and `tools/call`: `kb_search`

        (semantic top-k), `kb_ls` (list documents), `kb_find` (find by name),

        `kb_cat` (read a full document, chunks reassembled and de-duplicated),

        `kb_grep` (pattern search with line numbers, literal by default),
        `kb_head`

        and `kb_tail` (first and last N lines), `kb_sed` (output-only
        substitution,

        never persisted) and `kb_source_url` (resolve a citation link).


        Transport: POST only. A GET (SSE stream probe) returns 405; this
        endpoint

        does not offer server-streaming.
      operationId: knowledgeBaseMcp
      requestBody:
        required: true
        description: >-
          A single JSON-RPC 2.0 request (`initialize`, `tools/list`, or
          `tools/call`).
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - method
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                id:
                  description: >-
                    Request id echoed back in the response. Omit for
                    notifications.
                  oneOf:
                    - type: string
                    - type: integer
                method:
                  type: string
                  enum:
                    - initialize
                    - notifications/initialized
                    - tools/list
                    - tools/call
                params:
                  type: object
                  description: >
                    For `tools/call`: `{ name, arguments }` where `name` is one
                    of the

                    nine tools and `arguments` carries that tool's parameters.
                    The

                    `knowledge_base_id` is injected from the path and must not
                    be sent.
            examples:
              toolsList:
                summary: List the available tools
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: tools/list
              grep:
                summary: Grep a literal token across the base
                value:
                  jsonrpc: '2.0'
                  id: 2
                  method: tools/call
                  params:
                    name: kb_grep
                    arguments:
                      pattern: INV-42
      responses:
        '200':
          description: >
            JSON-RPC 2.0 response envelope. Tool results follow the MCP

            `CallToolResult` shape (`content[]`, `structuredContent`,
            `isError`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    nullable: true
                    oneOf:
                      - type: string
                      - type: integer
                  result:
                    type: object
                    description: >-
                      Present on success (tool result, tools/list, or
                      initialize).
                  error:
                    type: object
                    description: >-
                      Present on JSON-RPC errors (unknown method or tool, auth,
                      rate limit).
                    properties:
                      code:
                        type: integer
                      message:
                        type: string
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          description: >-
            Method Not Allowed: the endpoint accepts POST only (a GET SSE stream
            is not offered).
        '429':
          $ref: '#/components/responses/Error429'
      security:
        - BearerAuth: []
components:
  responses:
    Error401:
      description: Authentication missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthenticated:
              value:
                error:
                  code: UNAUTHENTICATED
                  message: Authentication required.
    Error403:
      description: Authentication present, authorization denied.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              value:
                error:
                  code: FORBIDDEN
                  message: Caller is not allowed to access this resource.
            hook_rejected:
              summary: An external content hook blocked ingestion (sync)
              value:
                error:
                  code: HOOK_REJECTED
                  message: Content was rejected by a compliance hook.
                  details:
                    rejected_by: hook_pii_filter
                    rejection_reason: detected_unmasked_pii
    Error404:
      description: Resource does not exist or is not visible to the caller.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            not_found:
              value:
                error:
                  code: NOT_FOUND
                  message: knowledge_base.document not found.
                  details:
                    resource: knowledge_base.document
                    id: vsf_unknown
    Error429:
      description: Rate limited.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds the caller should wait before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      description: |
        Single error envelope shared by every non-2xx response. `code`
        is the stable machine-readable identifier; `message` is the
        human-readable text; `details` is optional structured context.
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: VALIDATION_ERROR
            message:
              type: string
            details:
              type: object
              additionalProperties: true
      required:
        - error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        User session JWT or instance API key (`iak_*`). Send as `Authorization:
        Bearer <token>`.
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key
      description: Workspace- or knowledge-base-scoped API key.

````