paperless-mcp

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.

Category
访问服务器

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

  1. 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.
  2. 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

  1. 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.
  2. 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.
  3. Verify read-only is actually enforced, independent of this server's code:
    curl -i -X PATCH \
      -H "Authorization: Token <token>" \
      -H "Content-Type: application/json" \
      -d '{"title": "should not work"}' \
      http://<paperless-host>/api/documents/<some-id>/
    
    This should come back 403 Forbidden.
  4. 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 to 8420.
  • LAN_BIND_IP — required. naspi's LAN-facing IP; docker compose up refuses 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 the external network name in docker-compose.yml, and set PAPERLESS_BASE_URL to 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-readonly user's profile; update .env and redeploy. Rotate MCP_BEARER_TOKEN the same way — update .env, redeploy, and update every MCP client's config.
  • Redeploying: docker compose up -d --build picks up code or .env changes.
  • 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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选