skip to content

Paperless-ngx

An agent for documents and files, for requests such as “find the boiler’s warranty”.

MCP server github.com/tb1337/paperless-mcp
Transport Streamable HTTP
Authentication bearer

paperless-mcp publishes no image: Compose builds it from the Dockerfile of its release tag, beside the server of Ambrogio:

services:
paperless-mcp:
build: https://github.com/tb1337/paperless-mcp.git#v0.1.1
image: paperless-mcp:0.1.1
environment:
PAPERLESS_URL: http://<paperless-host>:8000
PAPERLESS_TOKEN: ${PAPERLESS_API_TOKEN:?}
PAPERLESS_MCP_TRANSPORT: http
PAPERLESS_MCP_HOST: 0.0.0.0
PAPERLESS_MCP_PORT: "8000"
PAPERLESS_MCP_AUTH_TOKEN: ${PAPERLESS_MCP_TOKEN:?}

It serves Streamable HTTP on port 8000 at /mcp, so the server of Ambrogio reaches it at http://paperless-mcp:8000/mcp, the name of its Compose service on a network the two share; from another host, use the name or address of the host that runs it, with the same port and path.

PAPERLESS_TOKEN is how the MCP server signs in to Paperless-ngx: the API auth token, created in your profile of Paperless-ngx.

  1. Run the MCP server, as Run the MCP server shows.

  2. Choose the token that the MCP server accepts, a random value such as the output of openssl rand -hex 32: the same value goes to the MCP server, as PAPERLESS_MCP_AUTH_TOKEN above, and to Ambrogio. Write it in .env as PAPERLESS_MCP_TOKEN, and pass the variable to the server of Ambrogio in compose.yaml:

    services:
    server:
    environment:
    PAPERLESS_MCP_TOKEN: ${PAPERLESS_MCP_TOKEN:?}
  3. Add the agent file agents/paperless-ngx.json, with the address of the Streamable HTTP endpoint of the MCP server in mcp.url:

    {
    "description": "Answers the household's requests about documents and files, with the tools of Paperless-ngx.",
    "instructions": "You handle the household's requests about documents and files with the tools of Paperless-ngx. Requests may come from speech recognition and contain misheard words; interpret them in context. Answer briefly.",
    "llm": {
    "provider": "mistral",
    "model": "mistral-medium-latest",
    "apiKeyEnv": "MISTRAL_API_KEY"
    },
    "maxToolCalls": 4,
    "mcp": {
    "url": "http://paperless-mcp:8000/mcp",
    "auth": {
    "type": "bearer",
    "tokenEnv": "PAPERLESS_MCP_TOKEN"
    }
    }
    }
  4. Restart with docker compose up -d.

Authentication: a bearer token, which the agent file names through the variable PAPERLESS_MCP_TOKEN. The description, the instructions, the language model and maxToolCalls are an example: adapt them to the household. See Agents for every field of the file.