paperless-mcp
Paperless-NGX MCP Server
Paperless-NGX APIサーバーと連携するためのMCP(Model Context Protocol)サーバーです。このサーバーは、Paperless-NGXインスタンス内のドキュメント、タグ、取引先、ドキュメントタイプを管理するためのツールを提供します。
クイックスタート
インストール
以下をMCP設定ファイルに追加してください:
// STDIOモード(ローカルまたはCLIでの使用に推奨)
"paperless": {
"command": "npx",
"args": [
"-y",
"@baruchiro/paperless-mcp@latest",
],
"env": {
"PAPERLESS_URL": "http://your-paperless-instance:8000",
"PAPERLESS_API_KEY": "your-api-token",
"PAPERLESS_PUBLIC_URL": "https://your-public-domain.com"
}
}// HTTPモード(Dockerまたはリモートでの使用に推奨)
"paperless": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/baruchiro/paperless-mcp:latest",
],
"env": {
"PAPERLESS_URL": "http://your-paperless-instance:8000",
"PAPERLESS_API_KEY": "your-api-token",
"PAPERLESS_PUBLIC_URL": "https://your-public-domain.com"
}
}APIトークンを取得します:
Paperless-NGXインスタンスにログインします
右上のユーザー名をクリックします
「My Profile」を選択します
円形の矢印ボタンをクリックして新しいトークンを生成します
MCP設定内のプレースホルダーを置き換えます:
http://your-paperless-instance:8000をPaperless-NGXのURLに置き換えますyour-api-tokenを生成したばかりのトークンに置き換えますhttps://your-public-domain.comを公開用のPaperless-NGX URLに置き換えます(任意。指定しない場合はPAPERLESS_URLにフォールバックします)
環境変数
変数 | 必須 | デフォルト | 説明 |
| はい | — | Paperless-NGXインスタンスのベースURL |
| はい | — | Paperless-NGXプロフィールのAPIトークン |
| いいえ |
| ドキュメントリンク用の公開URL |
| いいえ |
| Paperless-ngx REST APIのバージョン。 |
| いいえ | — |
|
これで完了です!あとはClaudeにPaperless-NGXドキュメントの管理を手伝ってもらうだけです。
使用例
Claudeに依頼できる操作の例:
「'Invoice'というタグが付いたすべてのドキュメントを表示して」
「'tax return'を含むドキュメントを検索して」
「#FF0000の色で'Receipts'という新しいタグを作成して」
「ドキュメント#123をダウンロードして」
「すべての取引先を一覧表示して」
「'Bank Statement'という新しいドキュメントタイプを作成して」
Related MCP server: mcp-paperless-ngx
利用可能なツール
ドキュメント操作
list_documents
シンプルなフィルターを使用して、ページ分割されたドキュメントのリストを取得します。単純な一覧表示タスクに使用してください。全文クエリ、構造化されたカスタムフィールドフィルタリング、または高度なPaperlessフィルターが必要な場合は、query_documentsを使用してください。
パラメータ:
page (optional): ページ番号
page_size (optional): 1ページあたりのドキュメント数
search (optional): シンプルなPaperless検索語
correspondent (optional): 取引先ID
document_type (optional): ドキュメントタイプID
tag (optional): タグID
storage_path (optional): ストレージパスID
created__date__gte (optional): YYYY-MM-DD以降に作成された日付
created__date__lte (optional): YYYY-MM-DD以前に作成された日付
ordering (optional): Paperlessの並び順フィールド
archive_serial_number (optional): アーカイブ整理番号
archive_serial_number__isnull (optional): アーカイブ整理番号が空かどうか
custom_field_query (optional): JSONエンコードされた生のPaperlessカスタムフィールドクエリ文字列
custom_fields__icontains (optional): カスタムフィールド値に対する大文字小文字を区別しない部分一致
list_documents({
page: 1,
page_size: 25
})query_documents
標準のドキュメントクエリツールです。全文クエリ、シンプルなPaperless検索、カスタムフィールドフィルター、およびドキュメント化された/api/documents/ Paperlessクエリパラメータをサポートします。
パラメータ:
page (optional): ページ番号
page_size (optional): 1ページあたりのドキュメント数
ordering (optional): Paperlessの並び順フィールド
query (optional): 全文クエリ文字列
search (optional): シンプルなPaperless検索語
more_like_id (optional): このドキュメントIDに類似したドキュメントを検索
correspondent (optional): 取引先ID
document_type (optional): ドキュメントタイプID
tag (optional): タグID
storage_path (optional): ストレージパスID
created__date__gte (optional): YYYY-MM-DD以降に作成された日付
created__date__lte (optional): YYYY-MM-DD以前に作成された日付
custom_field_query (optional):
[field_name_or_id, operator, value]リーフまたは["AND" | "OR", [clause1, clause2]]グループを使用した構造化Paperlessカスタムフィールドクエリpaperless_filters (optional): キーと値のペアとして渡される、ドキュメント化された追加の
/api/documents/Paperlessクエリパラメータ
// Full-text query
query_documents({
query: "invoice 2024"
})
// Simple search term
query_documents({
search: "acme"
})
// Custom field exact match
query_documents({
custom_field_query: ["Invoice Number", "exact", "12345"]
})
// Custom field empty
query_documents({
custom_field_query: ["OR", [
["Invoice Number", "isnull", true],
["Invoice Number", "exact", ""]
]]
})
// Custom field missing
query_documents({
custom_field_query: ["Invoice Number", "exists", false]
})
// Combined filters
query_documents({
query: "invoice",
tag: 5,
created__date__gte: "2024-01-01",
custom_field_query: ["Invoice Number", "exists", true]
})
// One documented Paperless filter that is not a first-class argument
query_documents({
paperless_filters: {
id__in: [101, 202, 303]
}
})get_document
IDを指定して特定のドキュメントを取得します。
パラメータ:
id: ドキュメントID
get_document({
id: 123
})search_documents
全文検索用の非推奨の互換ラッパーです。新しい統合ではquery_documents({ query: ... })を使用してください。
パラメータ:
query: 検索クエリ文字列
search_documents({
query: "invoice 2024"
})download_document
IDを指定してドキュメントファイルをダウンロードします。
パラメータ:
id: ドキュメントID
original (optional): trueの場合、アーカイブ版ではなく元のファイルをダウンロードします
download_document({
id: 123,
original: false
})get_document_thumbnail
IDを指定してドキュメントのサムネイル(画像プレビュー)を取得します。サムネイルをbase64エンコードされたWebP画像リソースとして返します。
パラメータ:
id: ドキュメントID
get_document_thumbnail({
id: 123
})bulk_edit_documents
複数のドキュメントに対して一括操作を実行します。
パラメータ:
documents: ドキュメントIDの配列
method: 次のいずれか:
set_correspondent: ドキュメントの取引先を設定
set_document_type: ドキュメントのドキュメントタイプを設定
set_storage_path: ドキュメントのストレージパスを設定
add_tag: ドキュメントにタグを追加
remove_tag: ドキュメントからタグを削除
modify_tags: 複数のタグを追加および/または削除
delete: ドキュメントを削除
reprocess: ドキュメントを再処理
set_permissions: ドキュメントの権限を設定
merge: 複数のドキュメントを結合
split: ドキュメントを複数のドキュメントに分割
rotate: ドキュメントのページを回転
delete_pages: ドキュメントから特定のページを削除
メソッドに応じた追加パラメータ:
correspondent: set_correspondent用のID
document_type: set_document_type用のID
storage_path: set_storage_path用のID
tag: add_tag/remove_tag用のID
add_tags: modify_tags用のタグIDの配列
remove_tags: modify_tags用のタグIDの配列
set_permissions: set_permissions用のオブジェクト。閲覧/変更のユーザーとグループを指定します(
{"view": {"users": [], "groups": []}, "change": {...}})。省略されたアクション/リストは変更されませんowner: set_permissions用のユーザーID(削除する場合はnull)。mergeがtrueでない限り、ownerを省略すると現在の所有者がクリアされます
merge: set_permissions用のブール値 — trueの場合は既存の権限に追加し、所有者を維持します。false(デフォルト)の場合は指定されたユーザー/グループを置き換えます
metadata_document_id: mergeでメタデータソースを指定するためのID
delete_originals: merge/split用のブール値
pages: split "[1,2-3,4,5-7]"またはdelete_pages "[2,3,4]"用の文字列
degrees: rotate用の数値(90、180、または270)
例:
// Add a tag to multiple documents
bulk_edit_documents({
documents: [1, 2, 3],
method: "add_tag",
tag: 5
})
// Set correspondent and document type
bulk_edit_documents({
documents: [4, 5],
method: "set_correspondent",
correspondent: 2
})
// Merge documents
bulk_edit_documents({
documents: [6, 7, 8],
method: "merge",
metadata_document_id: 6,
delete_originals: true
})
// Split document into parts
bulk_edit_documents({
documents: [9],
method: "split",
pages: "[1-2,3-4,5]"
})
// Modify multiple tags at once
bulk_edit_documents({
documents: [10, 11],
method: "modify_tags",
add_tags: [1, 2],
remove_tags: [3, 4]
})
// Modify custom fields
bulk_edit_documents({
documents: [12, 13],
method: "modify_custom_fields",
add_custom_fields: [
{ field: 2, value: "year" }
],
remove_custom_fields: []
})
// Set an empty custom field value, e.g. a date field used as a pending marker
bulk_edit_documents({
documents: [14],
method: "modify_custom_fields",
add_custom_fields: [
{ field: 9, value: "" }
],
remove_custom_fields: []
})post_document
新しいドキュメントをPaperless-NGXにアップロードします。
2つのアップロードモード:
Base64モード(従来型):
file(base64エンコードされたコンテンツ)+filenameを指定しますファイルシステムモード(効率的):
file_path(サーバー上の絶対パス)を指定します
セキュリティに関する注意: file_pathを使用する場合は、PAPERLESS_MCP_UPLOAD_PATHS環境変数(許可するディレクトリのコロン区切りリスト)を設定して、アップロードを特定の場所に制限してください。これがないと、サーバーのファイルシステム上の任意のファイルがアップロードされる可能性があります。
パラメータ:
file (optional): base64エンコードされたファイルコンテンツ。
fileまたはfile_pathのいずれかが必要です。file_path (optional): サーバーのファイルシステム上のファイルへの絶対パス。
fileまたはfile_pathのいずれかが必要です。filename (optional): ファイル名。
fileの場合は必須、file_pathの場合は任意(パスから派生します)。title (optional): ドキュメントのタイトル
created (optional): ドキュメントが作成された日時(例:"2024-01-19"または"2024-01-19 06:15:00+02:00")
correspondent (optional): 取引先のID
document_type (optional): ドキュメントタイプのID
storage_path (optional): ストレージパスのID
tags (optional): タグIDの配列
archive_serial_number (optional): アーカイブ整理番号
custom_fields (optional): カスタムフィールドIDの配列
ファイルサイズ制限: 両モードとも100MB
// Base64 mode (traditional)
post_document({
file: "base64_encoded_content",
filename: "invoice.pdf",
title: "January Invoice",
created: "2024-01-19",
correspondent: 1,
document_type: 2,
tags: [1, 3],
archive_serial_number: "2024-001",
custom_fields: [1, 2]
})
// Filesystem mode (more efficient for large files)
post_document({
file_path: "/var/uploads/invoice.pdf",
title: "January Invoice",
correspondent: 1,
document_type: 2,
tags: [1, 3]
})ドキュメントメモ
list_document_notes
ドキュメントに添付されたすべてのメモを一覧表示します。
パラメータ:
id: ドキュメントID
list_document_notes({
id: 123
})create_document_note
ドキュメントにメモを追加します。ドキュメントのメモの全リストを返します。
パラメータ:
id: ドキュメントID
note: 追加するメモのテキスト
create_document_note({
id: 123,
note: "Invoice paid on 2026-06-30 from Commerzbank account."
})delete_document_note
⚠️ メモIDを指定して、ドキュメントから単一のメモを削除します。この操作は元に戻せません。
パラメータ:
id: ドキュメントID
note_id: 削除するメモのID
confirm: この破壊的操作を確認するには
trueを指定する必要があります
delete_document_note({
id: 123,
note_id: 5,
confirm: true
})タグ操作
list_tags
すべてのタグを取得します。
list_tags()create_tag
新しいタグを作成します。
パラメータ:
name: タグ名
color (optional): 16進数のカラーコード(例:"#ff0000")
match (optional): 一致させるテキストパターン
matching_algorithm (optional): 0から6までの数値: 0 - なし 1 - 任意の単語 2 - すべての単語 3 - 完全一致 4 - 正規表現 5 - あいまい単語 6 - 自動
create_tag({
name: "Invoice",
color: "#ff0000",
match: "invoice",
matching_algorithm: 5
})取引先操作
list_correspondents
すべての取引先を取得します。
list_correspondents()create_correspondent
新しい取引先を作成します。
パラメータ:
name: 取引先名
match (optional): 一致させるテキストパターン
matching_algorithm (optional): 0から6までの数値: 0 - なし 1 - 任意の単語 2 - すべての単語 3 - 完全一致 4 - 正規表現 5 - あいまい単語 6 - 自動
create_correspondent({
name: "ACME Corp",
match: "ACME",
matching_algorithm: 5
})ドキュメントタイプ操作
list_document_types
すべてのドキュメントタイプを取得します。
list_document_types()create_document_type
新しいドキュメントタイプを作成します。
パラメータ:
name: ドキュメントタイプ名
match (任意): 照合するテキストパターン
matching_algorithm (任意): 0〜6の数値: 0 - なし 1 - 任意の単語 2 - すべての単語 3 - 完全一致 4 - 正規表現 5 - あいまい単語 6 - 自動
create_document_type({
name: "Invoice",
match: "invoice total amount due",
matching_algorithm: 1
})カスタムフィールド操作
list_custom_fields
すべてのカスタムフィールドを取得します。
list_custom_fields()get_custom_field
IDで特定のカスタムフィールドを取得します。
パラメータ:
id: カスタムフィールドID
get_custom_field({
id: 1
})create_custom_field
新しいカスタムフィールドを作成します。
パラメータ:
name: カスタムフィールド名
data_type: "string"、"url"、"date"、"boolean"、"integer"、"float"、"monetary"、"documentlink"、"select"のいずれか
extra_data (任意): セレクトオプションなど、カスタムフィールドの追加データ
create_custom_field({
name: "Invoice Number",
data_type: "string"
})update_custom_field
既存のカスタムフィールドを更新します。
パラメータ:
id: カスタムフィールドID
name (任意): 新しいカスタムフィールド名
data_type (任意): 新しいデータ型
extra_data (任意): カスタムフィールドの追加データ
update_custom_field({
id: 1,
name: "Updated Invoice Number",
data_type: "string"
})delete_custom_field
カスタムフィールドを削除します。
パラメータ:
id: カスタムフィールドID
delete_custom_field({
id: 1
})bulk_edit_custom_fields
複数のカスタムフィールドに対して一括操作を実行します。
パラメータ:
custom_fields: カスタムフィールドIDの配列
operation: "delete"のいずれか
bulk_edit_custom_fields({
custom_fields: [1, 2, 3],
operation: "delete"
})メール操作
Paperlessのメールアカウントと、自動メール取り込みを駆動するメールルールを管理するためのツールです。アカウントのパスワード/トークンが公開されることは決してありません。すべてのツール応答で伏せられています。
list_mail_accounts
メールルールを作成する際に必要なアカウントIDを選択できるよう、メールアカウントを一覧表示します。パスワードは伏せられています。
パラメータ:
page (任意): ページ番号
page_size (任意): 1ページあたりの結果数
list_mail_accounts()get_mail_account
IDで単一のメールアカウントを取得します。パスワード/トークンフィールドは伏せられています。
パラメータ:
id: メールアカウントID
get_mail_account({
id: 1
})process_mail_account
1つのアカウントについて、Paperlessのメール処理を手動でトリガーします。アカウントで有効なメールルールに従って、一致するメールを取り込むことができます。
パラメータ:
id: メールアカウントID
process_mail_account({
id: 1
})list_mail_rules
メールルールをオプションのページネーション付きで一覧表示します。
パラメータ:
page (任意): ページ番号
page_size (任意): 1ページあたりの結果数
list_mail_rules()get_mail_rule
IDで単一のメールルールを取得します。
パラメータ:
id: メールルールID
get_mail_rule({
id: 1
})create_mail_rule
メールルールを作成します。最初にlist_mail_accountsを使用してアカウントを選択してください。
必須パラメータ:
name: ルール名
account: メールアカウントID
folder: スキャンするIMAPフォルダ(例: "INBOX")
一般的な任意パラメータ:
enabled (デフォルト true): ルールが有効かどうか
filter_from / filter_to / filter_subject / filter_body: 受信メールの照合条件
maximum_age: この日数より新しいメールのみ処理
action: 1=削除、2=フォルダへ移動、3=既読にする、4=フラグ、5=タグ
action_parameter: 選択したアクションの対象フォルダ/タグ
assign_title_from: 1=件名、2=添付ファイル名、3=割り当てない
assign_tags / assign_correspondent / assign_document_type: 適用するメタデータ
assign_correspondent_from: 1=なし、2=メールアドレス、3=送信者名、4=assign_correspondentを使用
attachment_type: 1=添付ファイルのみ、2=インラインを含むすべてのファイル
consumption_scope: 1=添付ファイルのみ、2=メール全体を.emlとして、3=両方
pdf_layout: 0=システムデフォルト、1=テキスト+HTML、2=HTML+テキスト、3=HTMLのみ、4=テキストのみ
create_mail_rule({
name: "Invoices",
account: 1,
folder: "INBOX",
filter_subject: "invoice",
action: 3,
attachment_type: 1
})update_mail_rule
既存のメールルールをパッチ更新します。指定したフィールドのみが変更されます。
パラメータ:
id: メールルールID
...更新する
create_mail_ruleの任意のフィールド
update_mail_rule({
id: 1,
enabled: false
})delete_mail_rule
メールルールを削除します。明示的な確認フラグが必要です。これは今後のメール取り込み動作を変更しますが、既存のドキュメントは削除しません。
パラメータ:
id: メールルールID
confirm: 削除を確認するには
trueである必要があります
delete_mail_rule({
id: 1,
confirm: true
})エラーハンドリング
サーバーは、以下の場合に明確なエラーメッセージを表示します:
Paperless-NGXのURLまたはAPIトークンが正しくない
Paperless-NGXサーバーに到達できない
要求された操作が失敗する
指定されたパラメータが無効である
テスト
ユニットテスト
ユニットテストスイートを実行します(外部依存関係は不要です):
npm testE2Eテスト
E2Eスイートは、空のPaperless-ngxインスタンスを起動し、コンパイル済みのMCPサーバーを実行して、tools/callリクエストを通じて決定的な直列シナリオを駆動します。タグ、correspondent(取引先)、ドキュメントタイプを作成し、PDFをアップロードしてから、同じドキュメントに対してlist / get / search / download / thumbnail / bulk-editを実行します。LLMもMCP外部のPaperless RESTクライアントも使用しません。
前提条件: Docker、Docker Compose、およびjq。
# 1. Build the MCP server
npm run build
# 2. Start Paperless-ngx
docker compose -f docker-compose.e2e.yml up -d
# 3. Wait for Paperless to be ready, then get a token
TOKEN=$(curl -s -X POST http://localhost:8000/api/token/ \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"admin123"}' | jq -r '.token')
# 4. Start the MCP server
node build/index.js --http --port 3001 \
--baseUrl http://localhost:8000 --token "$TOKEN" &
MCP_PID=$!
# 5. Run the E2E tests
MCP_URL=http://localhost:3001/mcp \
PAPERLESS_URL=http://localhost:8000 \
PAPERLESS_TOKEN="$TOKEN" \
npm run test:e2e
# 6. Cleanup
kill "$MCP_PID"
docker compose -f docker-compose.e2e.yml down -vE2Eテストは、すべてのプルリクエストとmainへのプッシュ時にCIでも自動的に実行され、build/index.js CLIと公開済みのDockerイメージの両方を対象とします。
開発
サーバーに貢献したい、または変更したい場合は、知っておくべきことは次のとおりです:
リポジトリをクローンする
依存関係をインストールする:
npm installserver.jsに変更を加える
ローカルでテストする:
node server.js http://localhost:8000 your-test-tokenサーバーは以下で構築されています:
APIドキュメント
このMCPサーバーは、Paperless-NGX REST APIのエンドポイントを実装しています。基盤となるAPIの詳細については、公式ドキュメントを参照してください。
MCPサーバーの実行
MCPサーバーは2つのモードで実行できます:
1. stdio(デフォルト)
これはデフォルトのモードです。サーバーはstdioを介して通信し、CLIや直接統合に適しています。
npm run start -- <baseUrl> <token>2. HTTP(Streamable HTTP Transport)
サーバーをHTTPサービスとして実行するには、--httpフラグを使用します。ポートは--portで指定することもできます(デフォルト: 3000)。このモードではExpressのインストールが必要です(依存関係として含まれています)。
npm run start -- <baseUrl> <token> --http --port 3000MCP APIは、指定されたポートの
POST /mcpで利用可能になります。各リクエストは、StreamableHTTPServerTransportパターンに従ってステートレスに処理されます。
/mcpへのGETおよびDELETEリクエストは、405 Method Not Allowedを返します。
リクエストごとのAPIトークン(HTTP/Dockerモード)
HTTPモードでは、クライアントは標準のAuthorizationヘッダーを介してPaperless-NGX APIトークンを提供することで認証します:
Authorization: Bearer <paperless-ngx-api-token>トークンはそのままPaperless-NGXに渡されるため、各クライアント自身のPaperless権限がエンドツーエンドで適用されます。これにより、単一のサーバーインスタンスで、それぞれ独自のトークンを持つ複数のユーザーにサービスを提供できます。同じ動作が/mcpと/sseの両方のエンドポイントに適用されます。
⚠️ v2.0.0での破壊的変更 — HTTPモードはデフォルトで認証が必要になりました。
以前は、
Authorizationヘッダーのないリクエストはサーバー設定のPAPERLESS_API_KEYに暗黙的にフォールバックしており、ポートに到達できる人なら誰でもHTTPエンドポイントを利用できました。v2.0.0以降、Bearerトークンのないリクエストは401 Unauthorizedで拒否されます。サーバートークンは、--no-authで明示的にオプトインしない限り、認証されていないリクエストに決して使用されません。
シナリオ |
|
|
クライアントが |
|
|
ヘッダーなし、 |
| サーバートークン |
ヘッダーなし、サーバートークンなし |
|
|
v1.xからの移行: 以前のフォールバック(トークンを送信しないクライアントに対して単一の共有PAPERLESS_API_KEYを使用する)に依存していた場合は、2つのオプションがあります:
推奨: 各クライアントに
Authorization: Bearer <paperless-token>を送信させます。以前の動作を復元する(信頼できるローカルネットワークのみ):
--no-authフラグを付けてサーバーを起動します。例: Dockerのcommand/argsまたはCLI呼び出しに追加します。これにはサーバートークン(PAPERLESS_API_KEYまたは--token)の設定が必要です。
MCPサーバーはDockerとDocker Composeを使用してデプロイできます。Dockerイメージは、ポート3000でSSE(Server-Sent Events)サポート付きのHTTPモードで自動的に実行されます。
Docker Compose設定
docker-compose.ymlファイルを作成します:
services:
paperless-mcp:
container_name: paperless-mcp
image: ghcr.io/baruchiro/paperless-mcp:latest
environment:
- PAPERLESS_URL=http://your-paperless-ngx-server:8000
- PAPERLESS_API_KEY=your-paperless-api-key
- PAPERLESS_PUBLIC_URL=https://paperless-ngx.yourpublicurl.com
ports:
- "3000:3000"
restart: unless-stopped次に実行します:
docker-compose up -dContinue VS Code拡張機能での使用
Continue VS Code拡張機能を使用している場合、SSEを介してDocker化されたMCPサーバーを使用するように設定できます。
ワークスペースのルートに.continue/mcpServers/paperless-mcp.yamlを作成または編集します:
name: Paperless
version: 0.0.1
schema: v1
mcpServers:
- name: Paperless
type: sse
url: http://localhost:3000/sse注記:
リモートサーバーで実行している場合は、
localhostをDockerホストのIPアドレスまたはホスト名に置き換えてくださいDockerコンテナは環境変数によって認証を処理するため、Continue設定に資格情報は不要です
SSEエンドポイントは、設定されたポート(デフォルト: 3000)の
/sseで利用可能です
クレジット
このプロジェクトはnloui/paperless-mcpのフォークです。原作者の作業に感謝します。貢献や改善はアップストリームに還元される場合があります。
デバッグ
VS CodeでMCPサーバーをデバッグするには、次の起動構成を使用します:
{
"type": "node",
"request": "launch",
"name": "Debug Paperless MCP (HTTP, ts-node ESM)",
"program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
"args": [
"--esm",
"src/index.ts",
"--http",
"--baseUrl",
"http://your-paperless-instance:8000",
"--token",
"your-api-token",
"--port",
"3002"
],
"env": {
"NODE_OPTIONS": "--loader ts-node/esm",
},
"console": "integratedTerminal",
"skipFiles": [
"<node_internals>/**"
]
}重要: デバッグする前に、src/index.tsの次の行(175行目あたり)のコメントを解除してください:
// await new Promise((resolve) => setTimeout(resolve, 1000000));これにより、サーバーがすぐに終了するのを防ぎ、ブレークポイントを設定してコードをデバッグできるようになります。
Available Tools
47 toolsacknowledge_tasksAIdempotent
Mark tasks as acknowledged (seen and handled) by their numeric task IDs from list_tasks. This only sets the acknowledged flag; it does not delete tasks or retry them. Returns the number of tasks acknowledged.
Inputs: tasks (required).
bulk_edit_correspondentsBDestructiveIdempotent
Bulk edit correspondents. ⚠️ WARNING: 'delete' operation permanently removes correspondents from the entire system.
Inputs: operation (required), correspondent_ids (required), merge, owner, +2 more.
bulk_edit_custom_fieldsBDestructiveIdempotent
Bulk edit custom fields. ⚠️ WARNING: 'delete' operation permanently removes custom fields from the entire system.
Inputs: operation (required), custom_fields (required), confirm.
bulk_edit_documentsBDestructive
Perform bulk operations on multiple documents. Note: 'remove_tag' removes a tag from specific documents (tag remains in system), while 'delete_tag' permanently deletes a tag from the entire system. ⚠️ WARNING: 'delete' moves documents to the trash on Paperless-ngx 2.10+ (temporarily restorable; retention depends on server policy and documents may be permanently removed automatically or manually); older versions permanently delete them. Confirmation is required in all versions.
Inputs: method (required), documents (required), tag, merge, +14 more.
bulk_edit_document_typesBDestructiveIdempotent
Bulk edit document types. ⚠️ WARNING: 'delete' operation permanently removes document types from the entire system.
Inputs: operation (required), document_type_ids (required), merge, owner, +2 more.
bulk_edit_tagsCDestructiveIdempotent
Bulk edit tags. ⚠️ WARNING: 'delete' operation permanently removes tags from the entire system. Use with caution.
Inputs: tag_ids (required), operation (required), merge, owner, +2 more.
create_correspondentB
Create a new correspondent with optional matching pattern and algorithm for automatic document assignment.
Inputs: name (required), match, matching_algorithm.
create_custom_fieldB
Create a new custom field with a specified data type (string, url, date, boolean, integer, float, monetary, documentlink, or select). For monetary fields, values must use currency code prefix format (e.g., USD10.00, GBP123.45) — NOT trailing symbol format (e.g., 10.00$).
Inputs: name (required), data_type (required), extra_data.
create_document_noteA
Add a note to a document. Use this to record an audit trail or progress note directly on the document. Returns the document's full list of notes after the note is added.
Inputs: id (required), note (required).
create_document_typeB
Create a new document type with optional matching pattern and algorithm for automatic document classification.
Inputs: name (required), match, matching_algorithm.
create_mail_ruleBDestructive
Create a Paperless mail rule. Use list_mail_accounts first to choose account. Prefer attachment-only rules for invoices unless the full mail must be archived.
Inputs: name (required), folder (required), account (required), order, +20 more.
create_tagA
Create a new tag with optional color, matching pattern, and matching algorithm for automatic document tagging.
Inputs: name (required), color, match, matching_algorithm.
delete_correspondentBDestructiveIdempotent
⚠️ DESTRUCTIVE: Permanently delete a correspondent from the entire system. This will affect ALL documents that use this correspondent.
Inputs: id (required), confirm (required).
delete_custom_fieldBDestructiveIdempotent
⚠️ DESTRUCTIVE: Permanently delete a custom field from the entire system. This will remove the field from ALL documents that use it.
Inputs: id (required), confirm (required).
delete_document_noteBDestructiveIdempotent
⚠️ DESTRUCTIVE: Permanently delete a single note from a document by its note ID. This operation is irreversible. Returns the document's remaining notes.
Inputs: id (required), confirm (required), note_id (required).
delete_document_typeADestructiveIdempotent
⚠️ DESTRUCTIVE: Permanently delete a document type from the entire system. This will affect ALL documents that use this type.
Inputs: id (required), confirm (required).
delete_mail_ruleADestructiveIdempotent
Delete one Paperless mail rule. This changes future mail ingestion behavior but does not delete documents.
Inputs: id (required), confirm (required).
delete_tagADestructiveIdempotent
⚠️ DESTRUCTIVE: Permanently delete a tag from the entire system. This will remove the tag from ALL documents that use it. Use with extreme caution.
Inputs: id (required), confirm (required).
download_documentARead-onlyIdempotent
Download a document file by ID. Returns a paperless:// resource URI; read the resource to fetch the file content.
Inputs: id (required), original.
get_correspondentBRead-onlyIdempotent
Get a specific correspondent by ID with full details including matching rules.
Inputs: id (required).
get_custom_fieldARead-onlyIdempotent
Get a specific custom field by ID with full details including data type and extra configuration.
Inputs: id (required).
get_documentARead-onlyIdempotent
Get a specific document by ID with full details including correspondent, document type, tags, and custom fields. Note: Document content is excluded from results by default. Use 'get_document_content' to retrieve content when needed.
Inputs: id (required).
get_document_contentARead-onlyIdempotent
Get the text content of a specific document by ID. Use this when you need to read or analyze the actual document text.
Inputs: id (required).
get_document_thumbnailARead-onlyIdempotent
Get a document thumbnail (image preview) by ID. Returns a paperless:// resource URI; read the resource to fetch the image content.
Inputs: id (required).
get_document_typeBRead-onlyIdempotent
Get a specific document type by ID with full details including matching rules.
Inputs: id (required).
get_mail_accountARead-onlyIdempotent
Get one Paperless mail account by ID. Password/token fields are redacted if the server returns them.
Inputs: id (required).
get_mail_ruleARead-onlyIdempotent
Get one Paperless mail rule by ID.
Inputs: id (required).
list_correspondentsBRead-onlyIdempotent
List all correspondents with optional filtering and pagination. Correspondents represent entities that send or receive documents.
Inputs: page, ordering, page_size, name__iexact, +3 more.
list_custom_fieldsARead-onlyIdempotent
List all custom fields. IMPORTANT: When a user query may refer to a custom field, you should fetch all custom fields up front (with a large enough page_size), cache them for the session, and search locally for matches by name before making further API calls. This reduces redundant requests and handles ambiguity efficiently.
Inputs: page, ordering, page_size, name__iexact, +3 more.
list_document_notesARead-onlyIdempotent
List all notes attached to a document. Notes are free-text comments on a document and are the natural place for an audit trail (e.g. "invoice paid on X from account Y") or progress notes on an action item.
Inputs: id (required).
list_documentsARead-onlyIdempotent
List and filter documents with pagination and common Paperless filters such as title search, correspondent, document type, tag, storage path, creation date, archive serial number, and simple custom field filters. Use 'query_documents' for full-text query, structured custom field conditions, or advanced documented /api/documents/ query parameters. IMPORTANT: For queries like 'the last 3 contributions' or when searching by tag, correspondent, document type, or storage path, first use the relevant lookup tool to find the correct ID. Note: Document content is excluded from results by default. Use 'get_document_content' when you need the document text.
Inputs: tag, page, search, ordering, +10 more.
list_document_typesARead-onlyIdempotent
List all document types. IMPORTANT: When a user query may refer to a document type or tag, you should fetch all document types and all tags up front (with a large enough page_size), cache them for the session, and search locally for matches by name or slug before making further API calls. This reduces redundant requests and handles ambiguity between tags and document types efficiently.
Inputs: page, ordering, page_size, name__iexact, +3 more.
list_mail_accountsARead-onlyIdempotent
List Paperless mail accounts for selecting the account ID needed by mail rules. Does not expose account passwords.
Inputs: page, page_size.
list_mail_rulesBRead-onlyIdempotent
List Paperless mail rules with optional pagination.
Inputs: page, page_size.
list_storage_pathsBRead-onlyIdempotent
List storage paths with optional filtering and pagination. Returns one page of path IDs, names, path templates and matching rules without modifying storage paths or documents.
Inputs: id, page, id__in, ordering, +10 more.
list_tagsBRead-onlyIdempotent
List all tags. IMPORTANT: When a user query may refer to a tag or document type, you should fetch all tags and all document types up front (with a large enough page_size), cache them for the session, and search locally for matches by name or slug before making further API calls. This reduces redundant requests and handles ambiguity between tags and document types efficiently.
Inputs: page, ordering, page_size, name__iexact, +3 more.
list_tasksARead-onlyIdempotent
List Paperless consumer-queue tasks, including failed uploads (unsupported file type, duplicate of an existing document, unreadable file). Each task has its status, result message (the failure reason), and, for uploads, the file name and related document; these two can be null for other tasks. Use status failure with acknowledged false to find unacknowledged failures. A failure can remain unacknowledged after its underlying issue is resolved.
Inputs: type, status, task_name, acknowledged.
post_documentA
Upload a new document to Paperless-NGX with optional metadata like title, correspondent, document type, tags, and custom fields. Provide either 'file' (base64-encoded content) or 'file_path' (absolute path to a file on the server's filesystem). Using file_path avoids base64 encoding overhead for large files. SECURITY: When using file_path, set PAPERLESS_MCP_UPLOAD_PATHS environment variable to restrict uploads to specific directories (colon-separated paths).
Inputs: file, tags, title, created, +7 more.
process_mail_accountBDestructive
Manually run Paperless mail processing for one account. This can consume matching mails according to enabled Paperless mail rules.
Inputs: id (required).
query_documentsARead-onlyIdempotent
Query documents using the full-text query engine plus structured Paperless filters. Use this for complex filtering, custom field conditions, or any documented /api/documents/ query parameters that are not exposed as first-class arguments. Prefer the dedicated top-level arguments where available. custom_field_query supports [field_name_or_id, operator, value] leaves or ['AND'|'OR', [clause1, clause2]] groups. Note: Document content is excluded from results by default. Use 'get_document_content' when you need the document text.
Inputs: tag, page, query, search, +13 more.
search_documentsARead-onlyIdempotent
Deprecated compatibility wrapper for full-text document search. Use 'query_documents' with the 'query' argument for new integrations. Note: Document content is excluded from results by default. Use 'get_document_content' to retrieve content when needed.
Inputs: query (required).
update_correspondentBIdempotent
Update an existing correspondent's name, matching pattern, or matching algorithm.
Inputs: id (required), name, match, matching_algorithm.
update_custom_fieldBIdempotent
Update an existing custom field's name, data type, or extra configuration data.
Inputs: id (required), name, data_type, extra_data.
update_documentADestructiveIdempotent
Update a specific document with new values (title, correspondent, document type, storage path, tags, custom fields, and more). Top-level fields you omit are left unchanged. IMPORTANT: custom_fields is the exception — see its parameter description; it replaces the document's entire custom-field set.
Inputs: id (required), tags, owner, title, +7 more.
update_document_typeBIdempotent
Update an existing document type's name, matching pattern, or matching algorithm.
Inputs: id (required), name, match, matching_algorithm.
update_mail_ruleBDestructiveIdempotent
Patch an existing Paperless mail rule. Only supplied fields are changed.
Inputs: id (required), name, order, owner, +21 more.
update_tagBIdempotent
Update an existing tag's name, color, matching pattern, or matching algorithm.
Inputs: id (required), name, color, match, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 47 tools
Most tools map to a distinct resource and action across Paperless-ngx, with clear separation between document metadata, content, notes, tags, correspondents, document types, custom fields, mail rules, and tasks. However, list_documents, query_documents, and the deprecated search_documents overlap on document retrieval, and bulk_edit_* operations partly duplicate individual delete/update verbs.
Tool names are uniformly snake_case and follow a predictable verb-first pattern such as list_tags, create_tag, delete_mail_rule, and bulk_edit_documents. Verb choices vary by operation (post_document, process_mail_account, acknowledge_tasks), but the verb_noun structure remains consistent throughout.
At 47 tools, the surface is very large for a single MCP server even though Paperless-ngx is a broad domain with many entity types. This is well beyond the typical well-scoped range and lands in the rubric's 25+ 'too many' category.
Core document workflows and metadata lifecycle operations are well covered, including notes, tags, correspondents, document types, custom fields, mail rules, and task acknowledgment. However, storage paths only expose list_storage_paths with no get/create/update/delete, and mail accounts are read/process-only, leaving notable lifecycle gaps.
Maintenance
Related MCP Connectors
MCP server for the PDFGate API. Generate PDFs, manage documents and handle e-signatures.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Related MCP Servers
- FlicenseAqualityCmaintenanceMCP server for Paperless-ngx document management. Enables AI models to search, retrieve, update documents and manage metadata.7-
- AlicenseNot gradedqualityCmaintenanceA read-only and write MCP server for Paperless-ngx, enabling document listing, metadata retrieval, and creation of tags, correspondents, document types, and sorting workflows via natural language.MIT
- FlicenseNot gradedqualityNot gradedmaintenanceMCP server for Paperless-ngx document management, enabling search, OCR content access, metadata updates, tag/correspondent/type management, and duplicate detection via natural language.1-
- AlicenseAqualityCmaintenanceAn MCP server that puts a paperless-ngx document archive within reach of AI assistants, enabling full-text search, reading, filing, uploading, and managing documents and taxonomy through the paperless-ngx REST API.1631 npmMIT