@baruchiro/paperless-mcp 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -20
- package/build/index.d.ts +1 -0
- package/build/index.js +21 -32
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -15,33 +15,37 @@ npx -y @smithery/cli install @baruchiro/paperless-mcp --client claude
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
### Manual Installation
|
|
18
|
-
1. Install the MCP server:
|
|
19
|
-
```bash
|
|
20
|
-
npm install -g paperless-mcp
|
|
21
|
-
```
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
Add these to your MCP config file:
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
// STDIO mode (recommended for local or CLI use)
|
|
26
22
|
```json
|
|
27
|
-
{
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
"paperless": {
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": [
|
|
26
|
+
"-y",
|
|
27
|
+
"@baruchiro/paperless-mcp@latest",
|
|
28
|
+
],
|
|
29
|
+
"env": {
|
|
30
|
+
"PAPERLESS_URL": "http://your-paperless-instance:8000",
|
|
31
|
+
"PAPERLESS_API_KEY": "your-api-token"
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
```
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
// HTTP mode (recommended for Docker or remote use)
|
|
38
37
|
```json
|
|
39
|
-
{
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
"paperless": {
|
|
39
|
+
"command": "docker",
|
|
40
|
+
"args": [
|
|
41
|
+
"run",
|
|
42
|
+
"-i",
|
|
43
|
+
"--rm",
|
|
44
|
+
"ghcr.io/baruchiro/paperless-mcp:latest",
|
|
45
|
+
],
|
|
46
|
+
"env": {
|
|
47
|
+
"PAPERLESS_URL": "http://your-paperless-instance:8000",
|
|
48
|
+
"PAPERLESS_API_KEY": "your-api-token"
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
```
|
|
@@ -58,7 +62,7 @@ For Claude desktop app, edit `~/Library/Application Support/Claude/claude_deskto
|
|
|
58
62
|
|
|
59
63
|
That's it! Now you can ask Claude to help you manage your Paperless-NGX documents.
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
### Example Usage
|
|
62
66
|
|
|
63
67
|
Here are some things you can ask Claude to do:
|
|
64
68
|
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";
|
|
2
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -17,45 +18,33 @@ const sse_js_1 = require("@modelcontextprotocol/sdk/server/sse.js");
|
|
|
17
18
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
18
19
|
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
19
20
|
const express_1 = __importDefault(require("express"));
|
|
21
|
+
const node_util_1 = require("node:util");
|
|
20
22
|
const PaperlessAPI_1 = require("./api/PaperlessAPI");
|
|
21
23
|
const correspondents_1 = require("./tools/correspondents");
|
|
22
24
|
const documents_1 = require("./tools/documents");
|
|
23
25
|
const documentTypes_1 = require("./tools/documentTypes");
|
|
24
26
|
const tags_1 = require("./tools/tags");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const { values: { baseUrl, token, http: useHttp, port }, } = (0, node_util_1.parseArgs)({
|
|
28
|
+
options: {
|
|
29
|
+
baseUrl: { type: "string" },
|
|
30
|
+
token: { type: "string" },
|
|
31
|
+
http: { type: "boolean", default: false },
|
|
32
|
+
port: { type: "string" },
|
|
33
|
+
},
|
|
34
|
+
allowPositionals: true,
|
|
35
|
+
});
|
|
36
|
+
const resolvedBaseUrl = baseUrl || process.env.PAPERLESS_URL;
|
|
37
|
+
const resolvedToken = token || process.env.PAPERLESS_API_KEY;
|
|
38
|
+
const resolvedPort = port ? parseInt(port, 10) : 3000;
|
|
39
|
+
if (!resolvedBaseUrl || !resolvedToken) {
|
|
40
|
+
console.error("Usage: paperless-mcp --baseUrl <url> --token <token> [--http] [--port <port>]");
|
|
41
|
+
console.error("Or set PAPERLESS_URL and PAPERLESS_API_KEY environment variables.");
|
|
42
|
+
process.exit(1);
|
|
34
43
|
}
|
|
35
44
|
function main() {
|
|
36
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
let baseUrl;
|
|
38
|
-
let token;
|
|
39
|
-
if (useHttp) {
|
|
40
|
-
baseUrl = process.env.PAPERLESS_URL;
|
|
41
|
-
token = process.env.API_KEY;
|
|
42
|
-
if (!baseUrl || !token) {
|
|
43
|
-
console.error("When using --http, PAPERLESS_URL and API_KEY environment variables must be set.");
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
baseUrl = args[0];
|
|
49
|
-
token = args[1];
|
|
50
|
-
if (!baseUrl || !token) {
|
|
51
|
-
console.error("Usage: paperless-mcp <baseUrl> <token> [--http] [--port <port>]");
|
|
52
|
-
console.error("Example: paperless-mcp http://localhost:8000 your-api-token --http --port 3000");
|
|
53
|
-
console.error("When using --http, PAPERLESS_URL and API_KEY environment variables must be set.");
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
46
|
// Initialize API client and server once
|
|
58
|
-
const api = new PaperlessAPI_1.PaperlessAPI(
|
|
47
|
+
const api = new PaperlessAPI_1.PaperlessAPI(resolvedBaseUrl, resolvedToken);
|
|
59
48
|
const server = new mcp_js_1.McpServer({ name: "paperless-ngx", version: "1.0.0" });
|
|
60
49
|
(0, documents_1.registerDocumentTools)(server, api);
|
|
61
50
|
(0, tags_1.registerTagTools)(server, api);
|
|
@@ -146,8 +135,8 @@ function main() {
|
|
|
146
135
|
res.status(400).send("No transport found for sessionId");
|
|
147
136
|
}
|
|
148
137
|
}));
|
|
149
|
-
app.listen(
|
|
150
|
-
console.log(`MCP Stateless Streamable HTTP Server listening on port ${
|
|
138
|
+
app.listen(resolvedPort, () => {
|
|
139
|
+
console.log(`MCP Stateless Streamable HTTP Server listening on port ${resolvedPort}`);
|
|
151
140
|
});
|
|
152
141
|
}
|
|
153
142
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baruchiro/paperless-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for interacting with Paperless-NGX document management system. Enables AI assistants to manage documents, tags, correspondents, and document types through the Paperless-NGX API.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@changesets/cli": "^2.29.4",
|
|
50
|
-
|
|
50
|
+
"@types/express": "^5.0.2",
|
|
51
|
+
"@types/node": "^22.15.17",
|
|
51
52
|
"ts-node": "^10.9.2"
|
|
52
53
|
}
|
|
53
54
|
}
|