paperless-mcp
Enables MCP clients to search and retrieve documents from a self-hosted Paperless-ngx instance, including full OCR'd text and metadata, with read-only access enforced via API tokens.
README
paperless-mcp
An MCP server that exposes a self-hosted Paperless-ngx instance as tools an MCP client (Claude Desktop, Claude Code) can call — search documents, fetch a document's OCR'd text, and list tags/document types/correspondents/custom fields. Paperless already does OCR and full-text indexing; this server doesn't add its own index or vector store, it just gives Claude a way to query Paperless's.
Designed to run LAN-only: no public exposure, no router port-forwarding. Only reachable from MCP clients on the home network.
Two independent auth layers
- This server → Paperless — a Paperless API token, sent as
Authorization: Token <token>on every request to Paperless. Generated from a dedicated read-only Paperless user (not your admin account), so read-only is enforced by Paperless itself, not just by this server's code never calling write endpoints. - MCP client → this server — a static bearer token (
Authorization: Bearer <token>), checked before any request reaches the MCP transport. The LAN isn't a trust boundary by itself, and these documents include tax/financial data, so this server should never be reachable without it.
1. Paperless-side setup
- In Paperless's admin UI, create a new user (e.g.
mcp-readonly) and grant it view-only permissions on documents (and whatever tags/types/correspondents/custom fields it should be able to list) — not the admin account. - Log in as that user and generate an API token: user profile → "API Auth Token", or
POST /api/token/with that user's username/password. - Verify read-only is actually enforced, independent of this server's code:
This should come backcurl -i -X PATCH \ -H "Authorization: Token <token>" \ -H "Content-Type: application/json" \ -d '{"title": "should not work"}' \ http://<paperless-host>/api/documents/<some-id>/403 Forbidden. - Confirm the base URL this server should use — see "Networking on naspi" below.
2. Configure
cp .env.example .env
Fill in:
PAPERLESS_BASE_URL— how this container reaches Paperless (see below).PAPERLESS_API_TOKEN— the read-only user's token from step 1.MCP_BEARER_TOKEN— a long random string (e.g.openssl rand -hex 32). This is what MCP clients must send.PORT— defaults to8420.LAN_BIND_IP— required. naspi's LAN-facing IP;docker compose uprefuses to start without it, so port 8420 never binds to a public interface by accident. See "Networking on naspi" below.
3. Run locally (before containerizing)
npm install
npm test # unit tests — no live Paperless instance needed
npm run dev # starts the server against your real Paperless instance
Then use the MCP inspector to call tools manually and confirm real results come back:
npx @modelcontextprotocol/inspector
Point it at http://localhost:8420/mcp with header Authorization: Bearer <MCP_BEARER_TOKEN>, and try
search_documents, get_document, and list_facets.
4. Networking on naspi
Two options, in order of preference:
- Join Paperless's existing Docker network (preferred — internal, no LAN hop). Find its network name with
docker network ls/docker inspect <paperless-webserver-container>, then set that as theexternalnetwork name indocker-compose.yml, and setPAPERLESS_BASE_URLto the Paperless container's name on that network (e.g.http://paperless-webserver-1:8000). - Reach Paperless over the LAN IP/port if the containers can't share a network, e.g.
PAPERLESS_BASE_URL=http://10.4.0.100:<paperless-port>.
Set LAN_BIND_IP in .env to naspi's LAN-only IP so docker-compose publishes port 8420 only on that
interface — required even if naspi doesn't currently have a public IP, since it's a cheap guard against
future network changes exposing this server by accident.
5. Deploy
docker compose up -d --build
Verify it's LAN-only:
# From a device on the home network — should succeed (401 without the bearer token is expected/correct):
curl -i http://10.4.0.100:8420/healthz
# From outside the LAN — should fail/time out, confirming no public exposure.
6. Connect an MCP client
Point Claude Desktop / Claude Code's remote MCP server config at:
- URL:
http://10.4.0.100:8420/mcp - Header:
Authorization: Bearer <MCP_BEARER_TOKEN>
Then ask it something like "what does error code E4 mean on my dryer" or "did I take the standard
deduction on my 2024 taxes and what was my AGI" — it should call list_facets/search_documents to find the
right document, get_document to read it, and answer from the actual OCR'd content.
Maintenance
- Regenerating tokens: revoke/regenerate the Paperless API token from the
mcp-readonlyuser's profile; update.envand redeploy. RotateMCP_BEARER_TOKENthe same way — update.env, redeploy, and update every MCP client's config. - Redeploying:
docker compose up -d --buildpicks up code or.envchanges. - Scaling to more MCP servers on naspi later: keep each server on its own port for now. If a second one
gets added, put a single LAN-only reverse proxy (e.g. Caddy) in front of all of them with path routing
(
/mcp/paperless,/mcp/other) instead of tracking a growing list of ports — this server doesn't need to change for that, only how it's fronted.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.