@penloapp/mcp-server 1.2.0
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/LICENSE +21 -0
- package/README.md +127 -0
- package/index.js +183 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michał Włosik EFC (Penlo)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# @penloapp/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for [Penlo](https://penlo.app) — search your handwritten e-ink notes from any AI assistant that speaks MCP.
|
|
4
|
+
|
|
5
|
+
Works with **Claude**, **ChatGPT**, **Cursor**, **VS Code**, **Claude Code**, **Windsurf**, **Zed**, and others.
|
|
6
|
+
|
|
7
|
+
> **Claude Desktop users:** prefer the one-click `.mcpb` installer at <https://penlo.app/mcp-guide>. This npm package is for non-Claude MCP clients.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- A [Penlo](https://penlo.app) account on the **Power plan**
|
|
12
|
+
- A Penlo API key — generate one in Penlo at **Settings → API**
|
|
13
|
+
- Node.js 18 or newer
|
|
14
|
+
|
|
15
|
+
## Tools
|
|
16
|
+
|
|
17
|
+
This server exposes three tools to your AI assistant:
|
|
18
|
+
|
|
19
|
+
- **`search_notes`** — full-text search across the OCR content of every notebook
|
|
20
|
+
- **`find_notebook`** — locate a notebook by its title or PDF filename
|
|
21
|
+
- **`list_recent_notes`** — list your most recently synced notebooks
|
|
22
|
+
|
|
23
|
+
## Setup
|
|
24
|
+
|
|
25
|
+
### Cursor
|
|
26
|
+
|
|
27
|
+
Add to `~/.cursor/mcp.json` (macOS / Linux) or `%USERPROFILE%\.cursor\mcp.json` (Windows):
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"mcpServers": {
|
|
32
|
+
"penlo": {
|
|
33
|
+
"command": "npx",
|
|
34
|
+
"args": ["-y", "@penloapp/mcp-server"],
|
|
35
|
+
"env": {
|
|
36
|
+
"PENLO_API_KEY": "your_penlo_api_key_here"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Restart Cursor.
|
|
44
|
+
|
|
45
|
+
### VS Code (GitHub Copilot)
|
|
46
|
+
|
|
47
|
+
Add to `.vscode/mcp.json` (workspace) or your user-level `mcp.json`. Note: VS Code uses `servers`, not `mcpServers`.
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"servers": {
|
|
52
|
+
"penlo": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ["-y", "@penloapp/mcp-server"],
|
|
55
|
+
"env": {
|
|
56
|
+
"PENLO_API_KEY": "your_penlo_api_key_here"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Reload the window.
|
|
64
|
+
|
|
65
|
+
### ChatGPT (Plus, Pro, Business, Enterprise)
|
|
66
|
+
|
|
67
|
+
In ChatGPT settings, enable **Developer Mode** under Connectors, then add a new MCP server with:
|
|
68
|
+
|
|
69
|
+
- **Command:** `npx`
|
|
70
|
+
- **Args:** `-y @penloapp/mcp-server`
|
|
71
|
+
- **Environment variable:** `PENLO_API_KEY=your_penlo_api_key_here`
|
|
72
|
+
|
|
73
|
+
### Claude Code
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
claude mcp add penlo \
|
|
77
|
+
--command npx \
|
|
78
|
+
--args "-y @penloapp/mcp-server" \
|
|
79
|
+
--env PENLO_API_KEY=your_penlo_api_key_here
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Configuration
|
|
83
|
+
|
|
84
|
+
| Variable | Required | Default | Description |
|
|
85
|
+
|---|---|---|---|
|
|
86
|
+
| `PENLO_API_KEY` | ✅ Yes | — | Your Penlo API key. Generate at penlo.app → Settings → API. |
|
|
87
|
+
| `PENLO_API_URL` | No | `https://notes.penlo.app/mcp` | Override the Penlo MCP endpoint (advanced). |
|
|
88
|
+
|
|
89
|
+
## Try it
|
|
90
|
+
|
|
91
|
+
In your AI assistant, ask something like:
|
|
92
|
+
|
|
93
|
+
- *"Search my Penlo notes for [a topic you've written about]."*
|
|
94
|
+
- *"What did I write about most recently?"*
|
|
95
|
+
- *"Find my notebook called [some title] and summarize it."*
|
|
96
|
+
|
|
97
|
+
For more example prompts and a full install walkthrough, see <https://penlo.app/mcp-guide>.
|
|
98
|
+
|
|
99
|
+
## Privacy & security
|
|
100
|
+
|
|
101
|
+
- Your API key is scoped to your own notes only.
|
|
102
|
+
- Penlo only returns notebooks where OCR has completed.
|
|
103
|
+
- The MCP server runs locally on your machine; it talks to Penlo's API directly, not through any third party.
|
|
104
|
+
- See [penlo.app/privacy](https://penlo.app/privacy) for full details.
|
|
105
|
+
|
|
106
|
+
## Troubleshooting
|
|
107
|
+
|
|
108
|
+
**`Missing required environment variable PENLO_API_KEY`**
|
|
109
|
+
Pass `PENLO_API_KEY` in the `env` block of your MCP client's config.
|
|
110
|
+
|
|
111
|
+
**`Invalid API key`**
|
|
112
|
+
The key was rotated or copied with whitespace. Generate a new one in Penlo at Settings → API.
|
|
113
|
+
|
|
114
|
+
**`upgrade_required`**
|
|
115
|
+
MCP access requires the Power plan. Upgrade at penlo.app.
|
|
116
|
+
|
|
117
|
+
**No results from `search_notes`**
|
|
118
|
+
OCR may still be processing. Penlo's MCP server only returns notebooks where OCR has completed. Check sync status in your Penlo dashboard.
|
|
119
|
+
|
|
120
|
+
## Support
|
|
121
|
+
|
|
122
|
+
- Email: <hello@penlo.app>
|
|
123
|
+
- Website: <https://penlo.app>
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import {
|
|
6
|
+
CallToolRequestSchema,
|
|
7
|
+
ListToolsRequestSchema,
|
|
8
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
9
|
+
|
|
10
|
+
const PENLO_API_URL = process.env.PENLO_API_URL || "https://notes.penlo.app/mcp";
|
|
11
|
+
const PENLO_API_KEY = process.env.PENLO_API_KEY;
|
|
12
|
+
|
|
13
|
+
if (!PENLO_API_KEY) {
|
|
14
|
+
console.error(
|
|
15
|
+
"[penlo-mcp] Missing required environment variable PENLO_API_KEY. " +
|
|
16
|
+
"Generate one in Penlo at Settings → API."
|
|
17
|
+
);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const USER_AGENT = "penlo-mcp/1.2.0";
|
|
22
|
+
|
|
23
|
+
async function penloFetch(path, body) {
|
|
24
|
+
const base = PENLO_API_URL.replace(/\/+$/, "");
|
|
25
|
+
const url = base + (path.startsWith("/") ? path : "/" + path);
|
|
26
|
+
|
|
27
|
+
const res = await fetch(url, {
|
|
28
|
+
method: "POST",
|
|
29
|
+
headers: {
|
|
30
|
+
"Content-Type": "application/json",
|
|
31
|
+
"Authorization": `Bearer ${PENLO_API_KEY}`,
|
|
32
|
+
"User-Agent": USER_AGENT,
|
|
33
|
+
},
|
|
34
|
+
body: JSON.stringify(body ?? {}),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
if (!res.ok) {
|
|
38
|
+
const text = await res.text().catch(() => "");
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Penlo API error ${res.status}: ${text || res.statusText}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return res.json();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const server = new Server(
|
|
47
|
+
{ name: "penlo-mcp", version: "1.2.0" },
|
|
48
|
+
{ capabilities: { tools: {} } }
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
52
|
+
tools: [
|
|
53
|
+
{
|
|
54
|
+
name: "search_notes",
|
|
55
|
+
description:
|
|
56
|
+
"Search inside the OCR'd CONTENT of your handwritten notes. Use this when the user is looking for something they WROTE on the page — concepts, ideas, quotes, names mentioned in the body of their notes. Do NOT use this to find a notebook by its title or filename; use find_notebook for that.",
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: "object",
|
|
59
|
+
properties: {
|
|
60
|
+
query: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description:
|
|
63
|
+
"Words or phrases that should appear in the handwritten content (e.g. 'machine learning', 'protein folding', 'reminder about taxes').",
|
|
64
|
+
},
|
|
65
|
+
limit: {
|
|
66
|
+
type: "number",
|
|
67
|
+
description: "Max results to return (default 10, max 20).",
|
|
68
|
+
default: 10,
|
|
69
|
+
minimum: 1,
|
|
70
|
+
maximum: 20,
|
|
71
|
+
},
|
|
72
|
+
start_date: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description:
|
|
75
|
+
"Optional: only include notes created after this ISO 8601 date.",
|
|
76
|
+
},
|
|
77
|
+
end_date: {
|
|
78
|
+
type: "string",
|
|
79
|
+
description:
|
|
80
|
+
"Optional: only include notes created before this ISO 8601 date.",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
required: ["query"],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "find_notebook",
|
|
88
|
+
description:
|
|
89
|
+
"Find notebooks by TITLE or FILENAME. Use this when the user names a specific notebook ('open my Q4 planning notebook', 'find the meeting notes file', 'is there a notebook called Ideas.pdf?'). Matches against both the user-set display name and the original PDF filename, case-insensitive, substring match. Returns notebook metadata, not page content.",
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
query: {
|
|
94
|
+
type: "string",
|
|
95
|
+
description:
|
|
96
|
+
"Title or filename to look for (e.g. 'Q4 planning', 'meeting notes', 'ideas.pdf'). Partial matches are fine.",
|
|
97
|
+
},
|
|
98
|
+
limit: {
|
|
99
|
+
type: "number",
|
|
100
|
+
description: "Max results to return (default 10, max 20).",
|
|
101
|
+
default: 10,
|
|
102
|
+
minimum: 1,
|
|
103
|
+
maximum: 20,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
required: ["query"],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "list_recent_notes",
|
|
111
|
+
description:
|
|
112
|
+
"List the most recently synced notebooks. Use this when the user asks what they've been working on lately, wants a chronological overview, or has no specific search term in mind.",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
limit: {
|
|
117
|
+
type: "number",
|
|
118
|
+
description: "Number of notebooks to return (default 10, max 20).",
|
|
119
|
+
default: 10,
|
|
120
|
+
minimum: 1,
|
|
121
|
+
maximum: 20,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
130
|
+
const { name, arguments: args } = request.params;
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
if (name === "search_notes") {
|
|
134
|
+
const data = await penloFetch("/search", {
|
|
135
|
+
query: args.query,
|
|
136
|
+
limit: Math.min(args.limit ?? 10, 20),
|
|
137
|
+
start_date: args.start_date,
|
|
138
|
+
end_date: args.end_date,
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (name === "find_notebook") {
|
|
146
|
+
const data = await penloFetch("/find", {
|
|
147
|
+
query: args.query,
|
|
148
|
+
limit: Math.min(args.limit ?? 10, 20),
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (name === "list_recent_notes") {
|
|
156
|
+
const data = await penloFetch("/recent", {
|
|
157
|
+
limit: Math.min(args?.limit ?? 10, 20),
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
166
|
+
isError: true,
|
|
167
|
+
};
|
|
168
|
+
} catch (err) {
|
|
169
|
+
return {
|
|
170
|
+
content: [
|
|
171
|
+
{
|
|
172
|
+
type: "text",
|
|
173
|
+
text: `Error calling ${name}: ${err.message ?? String(err)}`,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
isError: true,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const transport = new StdioServerTransport();
|
|
182
|
+
await server.connect(transport);
|
|
183
|
+
console.error("[penlo-mcp] Server running on stdio");
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@penloapp/mcp-server",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "MCP server for Penlo — search your handwritten e-ink notes from Claude, ChatGPT, Cursor, VS Code, and any MCP-compatible AI assistant.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"penlo-mcp-server": "./index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18.0.0"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"mcp",
|
|
20
|
+
"model-context-protocol",
|
|
21
|
+
"penlo",
|
|
22
|
+
"notes",
|
|
23
|
+
"handwriting",
|
|
24
|
+
"ocr",
|
|
25
|
+
"claude",
|
|
26
|
+
"chatgpt",
|
|
27
|
+
"cursor",
|
|
28
|
+
"boox",
|
|
29
|
+
"remarkable",
|
|
30
|
+
"supernote",
|
|
31
|
+
"e-ink"
|
|
32
|
+
],
|
|
33
|
+
"author": "Penlo <hello@penlo.app>",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"homepage": "https://penlo.app",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "mailto:hello@penlo.app"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/penloapp/mcp-server.git"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.0.4"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
}
|
|
49
|
+
}
|