note-mcp 1.1.0 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +82 -10
  2. package/dist/index.js +35 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,16 +5,62 @@ Unofficial stdio MCP server for note.com. It uses cookie-based access to note.co
5
5
  > [!WARNING]
6
6
  > This project is unofficial and not affiliated with note.com. Internal APIs can change without notice. Keep cookies local and never commit them to GitHub, npm, logs, or issue reports.
7
7
 
8
- ## Install / run
8
+ ## Quick start
9
+
10
+ ### Local/desktop agents
11
+
12
+ Use browser login first:
9
13
 
10
14
  ```bash
11
- npx note-mcp
15
+ npx note-mcp auth
16
+ ```
17
+
18
+ After you log in to note.com in the opened browser, `note-mcp` saves the cookie locally and prints the saved file path:
19
+
20
+ ```json
21
+ {
22
+ "authenticated": true,
23
+ "saved": true,
24
+ "configPath": "/Users/you/.config/note-mcp/config.json",
25
+ "cookiePreview": "fp=b…5948",
26
+ "message": "note.com authentication configured from browser login. Cookie saved to /Users/you/.config/note-mcp/config.json."
27
+ }
28
+ ```
29
+
30
+ Then configure your MCP client without putting cookies in the config:
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "note": {
36
+ "command": "npx",
37
+ "args": ["-y", "note-mcp"]
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ### Servers, containers, and CI
44
+
45
+ Do not rely on browser login in headless/container environments. Provide a cookie through env or a mounted config file instead:
46
+
47
+ ```bash
48
+ NOTE_COOKIE='your note.com Cookie header' npx note-mcp
12
49
  ```
13
50
 
14
- For advanced/server setups, you can still provide a Cookie header through the environment:
51
+ Or mount a config file and point `NOTE_MCP_CONFIG` at it:
15
52
 
16
53
  ```bash
17
- NOTE_COOKIE='your note.com cookie string' npx note-mcp
54
+ docker run \
55
+ -v ~/.config/note-mcp/config.json:/run/secrets/note-mcp-config.json:ro \
56
+ -e NOTE_MCP_CONFIG=/run/secrets/note-mcp-config.json \
57
+ your-agent-image
58
+ ```
59
+
60
+ ## Install / run
61
+
62
+ ```bash
63
+ npx note-mcp
18
64
  ```
19
65
 
20
66
  For local development:
@@ -27,7 +73,7 @@ node dist/index.js
27
73
 
28
74
  ## MCP client configuration
29
75
 
30
- Desktop/local browser-login friendly setup:
76
+ Recommended desktop setup after `npx note-mcp auth`:
31
77
 
32
78
  ```json
33
79
  {
@@ -49,7 +95,7 @@ Advanced env-based setup:
49
95
  "command": "npx",
50
96
  "args": ["-y", "note-mcp"],
51
97
  "env": {
52
- "NOTE_COOKIE": "your note.com cookie string"
98
+ "NOTE_COOKIE": "your note.com Cookie header"
53
99
  }
54
100
  }
55
101
  }
@@ -78,7 +124,21 @@ This opens a browser, lets you log in to note.com normally, then stores note.com
78
124
  ~/.config/note-mcp/config.json
79
125
  ```
80
126
 
81
- The config file is written with `0600` permissions where supported.
127
+ The CLI and MCP tool response include the actual `configPath` used.
128
+
129
+ If the browser executable is not installed yet, install Playwright's Chromium once on the same machine/user account, then retry:
130
+
131
+ ```bash
132
+ npx playwright install chromium
133
+ ```
134
+
135
+ When using `note-mcp` only through `npx` and Playwright is not otherwise installed globally/in the project, this form is often more reliable:
136
+
137
+ ```bash
138
+ npx -p playwright playwright install chromium
139
+ ```
140
+
141
+ For remote servers, containers, or CI, prefer the secret/env/config-file path below instead of browser login.
82
142
 
83
143
  Useful CLI commands:
84
144
 
@@ -91,7 +151,7 @@ npx note-mcp auth --headed
91
151
 
92
152
  ### 2. Advanced/server/CI: secret, env, or config file
93
153
 
94
- For remote agents, servers, CI, and secret managers, provide a Cookie header via:
154
+ For remote agents, servers, containers, CI, and secret managers, provide a Cookie header via:
95
155
 
96
156
  - `NOTE_COOKIE`
97
157
  - `NOTE_SESSION_COOKIE`
@@ -113,12 +173,24 @@ Cookie lookup priority:
113
173
  2. `NOTE_SESSION_COOKIE`
114
174
  3. config file cookie
115
175
 
176
+ Default config path:
177
+
178
+ ```text
179
+ ~/.config/note-mcp/config.json
180
+ ```
181
+
182
+ Override config path:
183
+
184
+ ```bash
185
+ NOTE_MCP_CONFIG=/path/to/config.json npx note-mcp
186
+ ```
187
+
116
188
  ## Tools
117
189
 
118
190
  Authentication/setup tools:
119
191
 
120
- - `note_auth_status` — inspect whether auth is configured
121
- - `note_auth_login` — open a browser login flow and save cookies locally
192
+ - `note_auth_status` — inspect whether auth is configured and which config path is used
193
+ - `note_auth_login` — open a browser login flow and save cookies locally; response includes `configPath`
122
194
  - `note_set_cookie` — save a Cookie header to the local config file, optionally verifying it first
123
195
  - `note_clear_cookie` — delete the stored config-file cookie
124
196
  - `note_login_help` — explain supported setup paths
package/dist/index.js CHANGED
@@ -203,7 +203,12 @@ async function runBrowserLogin(options = {}) {
203
203
  const timeoutMs = options.timeoutMs ?? 18e4;
204
204
  const headless = options.headless ?? process.env.NOTE_MCP_HEADLESS === "true";
205
205
  const { chromium } = await importPlaywright();
206
- const browser = await chromium.launch({ headless });
206
+ let browser;
207
+ try {
208
+ browser = await chromium.launch({ headless });
209
+ } catch (error) {
210
+ throw toBrowserLoginError(error);
211
+ }
207
212
  try {
208
213
  const context = await browser.newContext();
209
214
  const page = await context.newPage();
@@ -217,15 +222,9 @@ async function runBrowserLogin(options = {}) {
217
222
  const client = new NoteClient({ cookie });
218
223
  try {
219
224
  await client.authCheck();
220
- if (options.save ?? true) {
221
- await saveCookie(cookie);
222
- }
223
- return {
224
- authenticated: true,
225
- saved: options.save ?? true,
226
- cookiePreview: previewCookie2(cookie),
227
- message: "note.com authentication configured from browser login."
228
- };
225
+ const shouldSave = options.save ?? true;
226
+ const saveStatus = shouldSave ? await saveCookie(cookie) : void 0;
227
+ return buildBrowserLoginResult(cookie, shouldSave, saveStatus);
229
228
  } catch {
230
229
  }
231
230
  }
@@ -245,6 +244,32 @@ async function importPlaywright() {
245
244
  );
246
245
  }
247
246
  }
247
+ function buildBrowserLoginResult(cookie, saved, saveStatus) {
248
+ const configPath = saveStatus?.configPath;
249
+ return {
250
+ authenticated: true,
251
+ saved,
252
+ ...configPath ? { configPath } : {},
253
+ cookiePreview: saveStatus?.cookiePreview ?? previewCookie2(cookie),
254
+ message: configPath ? `note.com authentication configured from browser login. Cookie saved to ${configPath}.` : "note.com authentication configured from browser login."
255
+ };
256
+ }
257
+ function toBrowserLoginError(error) {
258
+ const message = error instanceof Error ? error.message : String(error);
259
+ if (message.includes("Executable doesn't exist") || message.includes("Please run the following command to download new browsers") || message.includes("playwright install")) {
260
+ return new Error(
261
+ [
262
+ "Playwright browser is not installed, so note-mcp cannot open the note.com browser login flow.",
263
+ "Run this once on the same machine/user account, then retry:",
264
+ " npx playwright install chromium",
265
+ "If you are running note-mcp through npx and Playwright is not otherwise installed, use:",
266
+ " npx -p playwright playwright install chromium",
267
+ "For remote servers, containers, or CI, prefer NOTE_COOKIE / NOTE_SESSION_COOKIE or NOTE_MCP_CONFIG instead of browser login."
268
+ ].join("\n")
269
+ );
270
+ }
271
+ return error instanceof Error ? error : new Error(message);
272
+ }
248
273
  function isNoteDomain(domain) {
249
274
  const normalized = domain.replace(/^\./, "").toLowerCase();
250
275
  return normalized === "note.com" || normalized.endsWith(".note.com");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "note-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Unofficial stdio MCP server for note.com using cookie-based internal APIs.",
5
5
  "type": "module",
6
6
  "bin": {