@ainote/mcp 1.3.1 → 1.3.3

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 CHANGED
@@ -1,778 +1,801 @@
1
- # AI Note MCP Server
2
-
3
- [![npm version](https://badge.fury.io/js/%40ainote%2Fmcp-server.svg)](https://badge.fury.io/js/%40ainote%2Fmcp-server)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
-
6
- A Model Context Protocol (MCP) server that connects AI assistants to your AI Note task management system. This package enables direct interaction with your AI Note tasks through natural language conversations in Claude Desktop and other MCP-compatible platforms.
7
-
8
- > 📚 **[Complete Project Guide](../docs/PROJECT_GUIDE.md)** - 전체 프로젝트 가이드 및 아키텍처 정보
9
-
10
- ## Table of Contents
11
-
12
- - [Access Methods](#access-methods)
13
- - [Features](#features)
14
- - [Authentication](#authentication)
15
- - [Prerequisites](#prerequisites)
16
- - [Installation](#installation)
17
- - [Configuration](#configuration)
18
- - [Usage](#usage)
19
- - [HTTP Endpoint](#http-endpoint)
20
- - [Available Tools](#available-tools)
21
- - [API Reference](#api-reference)
22
- - [Development](#development)
23
- - [Troubleshooting](#troubleshooting)
24
- - [Contributing](#contributing)
25
- - [License](#license)
26
-
27
- ## Access Methods
28
-
29
- AI Note MCP server is available through three transport options to cover different integration scenarios:
30
-
31
- ### 1. **stdio Mode (This Package)** - For Personal Use
32
- - **Installation**: `npm install -g @ainote/mcp`
33
- - **Usage**: Claude Desktop and other stdio-based MCP clients
34
- - **Setup**: Local installation with API key configuration
35
- - **Best for**: Individual users connecting their personal AI Note account to Claude Desktop
36
-
37
- ### 2. **Local SSE Bridge (ChatGPT / MCP Apps)**
38
- - **Command**: `ainote-mcp-http`
39
- - **Protocol**: Server-Sent Events (SSE) + JSON-RPC over HTTP POST
40
- - **Usage**: ChatGPT Model Context Protocol connectors, other SSE-capable MCP clients
41
- - **Setup**: Run locally alongside your browser; supports API key or (optional) OAuth bearer tokens
42
- - **Best for**: Users wanting to expose AI Note tools to ChatGPT without deploying infrastructure
43
-
44
- ### 3. **Hosted HTTP Endpoint** - For Platform Integration
45
- - **URL**: `https://api.ainote.dev/api/mcp`
46
- - **Protocol**: JSON-RPC 2.0 over HTTP
47
- - **Usage**: Platform integrations (Kakao PlayMCP, etc.)
48
- - **Setup**: No installation required, direct API access
49
- - **Best for**: Third-party platforms and services integrating AI Note functionality
50
-
51
- All transports expose the same tool catalog. Choose the option that matches your hosting model and client capabilities.
52
-
53
- ## Features
54
-
55
- - 📝 **Task Management**: Create, update, delete, and list tasks directly from Claude Desktop
56
- - 📄 **Dev Docs**: Manage CLAUDE.md, Cursor rules, Windsurf rules, and dev documents centrally via MCP
57
- - 🗂️ **Dev Category Hierarchy**: Auto-organized under `dev/` with subcategories (claude, cursor, windsurf, copilot, docs, skills, agents, commands, hooks, mcp)
58
- - 🔄 **Claude Environment Sync**: Push/pull `~/.claude/` skills, agents, commands, hooks across machines (macOS/WSL/Linux)
59
- - 🔐 **End-to-End Encryption**: `mcp` category (mcpServers + API keys) auto-encrypted client-side with age; server never sees plaintext
60
- - 🪪 **OS Keychain Integration**: Per-machine age identity stored in macOS Keychain / libsecret / Credential Manager (file fallback supported)
61
- - 🤝 **Session Handoffs**: `handoff_save` / `handoff_list` / `handoff_get` with optional `time: HHMM` for same-day disambiguation — saved under the primary vault, auto-purged after 7 days
62
- - 📦 **Multi-Device File Sync**: `sync_push` / `sync_pull` / `sync_list` push markdown notes into the user's git-backed primary vault — works across macOS, Linux, iOS shortcuts
63
- - 🏛️ **GitHub-Backed Vaults**: `vault_create` / `vault_clone` / `vault_sync` provision a private GitHub repo per vault; ainote indexes contents but never proxies git traffic
64
- - 🛡️ **MCP Tool Annotations**: Every tool advertises `readOnlyHint` / `destructiveHint` / `idempotentHint` / `openWorldHint` so autonomous agent runtimes can gate destructive calls
65
- - 🏷️ **Category Support**: Organize tasks with categories
66
- - 🔍 **Advanced Filtering**: 18+ filter options including date ranges, location, overdue tasks
67
- - ⭐ **Priority Management**: Mark tasks as important
68
- - 📅 **Smart Due Dates**: Human-readable format with relative time (e.g., `'26.1.25 14:30 - 오늘`)
69
- - 🔒 **Dual Authentication**: Support for both User API Key (24-char) and MCP Key (64-char)
70
- - 📊 **Usage Tracking**: Automatic API usage statistics per MCP key
71
- - 🌊 **Streaming API**: Real-time streaming for bulk operations and large datasets
72
- - 🤖 **Bot Integration**: Telegram bot support via Clawdbot + mcporter
73
-
74
- ## Quick Start (No Account Needed)
75
-
76
- You can start using AI Note MCP **without an existing account**. The MCP server includes onboarding tools that let you sign up and get an API key directly from Claude:
77
-
78
- ### 1. Add to your MCP config (no API key yet)
79
-
80
- ```json
81
- {
82
- "mcpServers": {
83
- "ainote": {
84
- "command": "npx",
85
- "args": ["-y", "@ainote/mcp"]
86
- }
87
- }
88
- }
89
- ```
90
-
91
- ### 2. Restart Claude Desktop
92
-
93
- ### 3. Ask Claude to sign you up
94
-
95
- > "Sign me up for AI Note with email user@example.com and password mypassword123"
96
-
97
- Claude will call the `signup_and_get_key` tool and return your MCP API key.
98
-
99
- ### 4. Add the API key to your config
100
-
101
- ```json
102
- {
103
- "mcpServers": {
104
- "ainote": {
105
- "command": "npx",
106
- "args": ["-y", "@ainote/mcp"],
107
- "env": {
108
- "AINOTE_API_KEY": "<your-key-from-step-3>"
109
- }
110
- }
111
- }
112
- }
113
- ```
114
-
115
- ### 5. Restart Claude Desktop again
116
-
117
- Now all tools (tasks, dev docs, etc.) are available.
118
-
119
- ### CLI Signup
120
-
121
- You can also sign up directly from the terminal:
122
-
123
- ```bash
124
- npx @ainote/mcp signup
125
- ```
126
-
127
- This will interactively ask for email, password, and name, then return your MCP API key.
128
-
129
- ### Onboarding MCP Tools
130
-
131
- These tools also work inside Claude (no API key needed):
132
-
133
- | Tool | Description |
134
- |------|-------------|
135
- | `signup_and_get_key` | Create account + get MCP key |
136
- | `login_and_get_key` | Login + get MCP key (existing account) |
137
- | `get_setup_guide` | Setup instructions |
138
-
139
- ## Authentication
140
-
141
- The CLI supports browser-based login as a more secure alternative to manually pasting API keys into your MCP config. Tokens and the MCP key are stored in the OS keychain.
142
-
143
- ### Quick start
144
-
145
- ```bash
146
- ainote-mcp login # browser-based, recommended
147
- ainote-mcp whoami # verify current login
148
- ainote-mcp logout # revoke + clear keychain
149
- ```
150
-
151
- ### How it works
152
-
153
- `ainote-mcp login` runs an [RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628) OAuth 2.0 Device Authorization Grant. The CLI generates a PKCE pair locally, opens your browser to sign in via the AI Note web app, and polls the backend until you approve. On success it stores an access token, a refresh token, and an MCP key in the OS keychain. The default MCP stdio mode automatically uses the stored MCP key — no `AINOTE_API_KEY` env var needed.
154
-
155
- ### Storage locations
156
-
157
- | OS | Location |
158
- |----------|---------------------------------------------------------------------------|
159
- | macOS | Keychain Access — service `@ainote/cli` |
160
- | Linux | libsecret (gnome-keyring / kwallet) — service `@ainote/cli` |
161
- | Windows | Credential Manager — target `@ainote/cli` |
162
- | Fallback | `${XDG_CONFIG_HOME:-~/.config}/ainote/credentials.json` (mode `0600`) |
163
-
164
- The fallback file is only used when no system keychain is available (e.g. headless servers without `libsecret`).
165
-
166
- ### CLI flags
167
-
168
- - `--scope=mcp,read,write` — comma-separated scopes requested for the token (default: `mcp,read,write`)
169
- - `--no-browser` — print the verification URL instead of auto-opening a browser (use this on SSH/CI)
170
-
171
- ### Environment overrides
172
-
173
- - `AINOTE_API_URL` — backend URL (default `https://api.ainote.dev`)
174
- - `AINOTE_API_KEY` — pre-provisioned MCP key. When set, the login flow is bypassed entirely and this key is used as-is.
175
-
176
- ### Headless / CI usage
177
-
178
- For SSH sessions, devcontainers, or CI runners that cannot open a browser, use `--no-browser`. The CLI will print a short user code and a verification URL; open the URL on any device (laptop, phone) signed in to your AI Note account, approve the request, then return to the terminal:
179
-
180
- ```bash
181
- $ ainote-mcp login --no-browser
182
- Open this URL in any browser:
183
- https://ainote.dev/oauth/cli/device?user_code=BCDF-GHJK
184
- Waiting for approval...
185
- ✓ Logged in as you@example.com
186
- ```
187
-
188
- After login, subsequent invocations (`ainote-mcp`, `ainote-mcp whoami`) work normally with no further interaction.
189
-
190
- ### Troubleshooting
191
-
192
- | Symptom | Fix |
193
- |-----------------------------------------------|-------------------------------------------------------------------------------------------|
194
- | `LOGIN_HINT` error on any subcommand | Run `ainote-mcp login` |
195
- | macOS Keychain prompt every run | Open Keychain Access, find `@ainote/cli`, set access control to "Always allow" for `node` |
196
- | Browser does not open | Re-run with `--no-browser` and copy the URL manually |
197
- | Persistent 401 after login | Tokens were revoked server-side. Run `ainote-mcp login` again |
198
- | `libsecret not available` on Linux | Install `gnome-keyring` / `libsecret-1-0`, or rely on the file fallback (still encrypted at-rest by the OS) |
199
-
200
- See [`docs/architecture/CLI_AUTH.md`](../docs/architecture/CLI_AUTH.md) for the full protocol specification, sequence diagram, and security model.
201
-
202
- ## Prerequisites
203
-
204
- - Node.js >= 18.0.0
205
- - npm or yarn
206
- - Claude Desktop with MCP support enabled
207
-
208
- ## Installation
209
-
210
- ### Option 1: Install from npm
211
-
212
- ```bash
213
- npm install -g @ainote/mcp
214
- ```
215
-
216
- ### Option 2: Install from source
217
-
218
- ```bash
219
- git clone https://github.com/ainote-dev/ainote-mcp.git
220
- cd ainote-mcp-server
221
- npm install
222
- ```
223
-
224
- ## Update
225
-
226
- ### Update from npm (Recommended)
227
-
228
- To update to the latest version when installed via npm:
229
-
230
- ```bash
231
- npm update -g @ainote/mcp
232
- ```
233
-
234
- Or to install a specific version:
235
-
236
- ```bash
237
- npm install -g @ainote/mcp@1.0.2
238
- ```
239
-
240
- ### Update from source
241
-
242
- If you installed from source:
243
-
244
- ```bash
245
- cd ainote-mcp-server
246
- git pull origin main
247
- npm install
248
- ```
249
-
250
- After updating, **restart Claude Desktop** to load the new version.
251
-
252
- ## Configuration
253
-
254
- To connect the MCP server with Claude Desktop, follow these steps.
255
-
256
- ### Step 1: Get your AI Note API Key
257
-
258
- You need an API key from your AI Note account to allow Claude to access your tasks. You can find or generate your API key in the AI Note app's settings screen.
259
-
260
- ### Step 2: Configure Claude Desktop
261
-
262
- Add the `ainote-mcp` server to your Claude Desktop configuration file. This file is located at:
263
- - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
264
- - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
265
-
266
- Open the file and add the following JSON block inside the `mcpServers` object. **Replace `your-api-key-here` with your actual AI Note API key.**
267
-
268
- ```json
269
- {
270
- "mcpServers": {
271
- "ainote": {
272
- "command": "ainote-mcp",
273
- "env": {
274
- "AINOTE_API_KEY": "your-api-key-here"
275
- }
276
- }
277
- }
278
- }
279
- ```
280
-
281
- *Note: If you need to connect to a self-hosted or different AI Note server, you can add the `AINOTE_API_URL` environment variable as well.*
282
-
283
- ```json
284
- "env": {
285
- "AINOTE_API_KEY": "your-api-key-here",
286
- "AINOTE_API_URL": "https://your-custom-api-url.com"
287
- }
288
- ```
289
-
290
- ### Step 3: Restart Claude Desktop
291
-
292
- After saving the configuration file, **restart Claude Desktop** completely. The new MCP server will be loaded, and you can start managing your AI Note tasks through Claude.
293
-
294
-
295
- ## Usage
296
-
297
- Once configured, you can interact with your AI Note tasks through Claude:
298
-
299
- ### Example Conversations
300
-
301
- ```
302
- You: "Show me my pending tasks"
303
- Claude: I'll retrieve your pending tasks from AI Note...
304
-
305
- You: "Create a new task to review the quarterly report by Friday"
306
- Claude: I'll create that task for you with a due date set for Friday...
307
-
308
- You: "Mark task ID 123 as completed"
309
- Claude: I'll mark that task as completed...
310
- ```
311
-
312
- ## HTTP Endpoint
313
-
314
- For platform integrations and services that prefer HTTP over stdio, AI Note provides a direct HTTP endpoint:
315
-
316
- ### Endpoint URL
317
- ```
318
- POST https://api.ainote.dev/api/mcp
319
- Content-Type: application/json
320
- ```
321
-
322
- ### Authentication
323
- ```http
324
- Authorization: Bearer YOUR_API_KEY
325
- ```
326
-
327
- ### Request Format (JSON-RPC 2.0)
328
- ```json
329
- {
330
- "jsonrpc": "2.0",
331
- "method": "tools/list",
332
- "id": 1
333
- }
334
- ```
335
-
336
- ### Response Format
337
- ```json
338
- {
339
- "jsonrpc": "2.0",
340
- "result": {
341
- "tools": [...]
342
- },
343
- "id": 1
344
- }
345
- ```
346
-
347
- ### Supported Methods
348
- - `ping` - Health check
349
- - `capabilities` - Server capabilities
350
- - `tools/list` - List available tools
351
- - `tools/call` - Execute a specific tool
352
-
353
- ### Platform Integration Examples
354
- - **Kakao PlayMCP**: Use the HTTP endpoint for seamless integration
355
- - **Custom Applications**: Build your own MCP client using the HTTP API
356
- - **Enterprise Solutions**: Direct server-to-server communication
357
-
358
- This HTTP endpoint provides identical functionality to the stdio version, making AI Note MCP accessible to a broader range of platforms and integration scenarios.
359
-
360
- ### 4. **Streaming API** - For Large Data Operations
361
- - **URL**: `POST https://api.ainote.dev/api/mcp/stream`
362
- - **Protocol**: Server-Sent Events (SSE)
363
- - **Usage**: Bulk operations, large task lists, real-time progress
364
- - **Best for**: Applications that need to handle large datasets or show progress indicators
365
-
366
- #### Streaming Methods
367
- | Method | Description |
368
- |--------|-------------|
369
- | `tasks/list` | Stream task list with filters |
370
- | `tasks/create` | Create single task with progress |
371
- | `tasks/analyze` | Get task statistics and insights |
372
- | `tasks/bulk_update` | Update multiple tasks with progress |
373
- | `tasks/bulk_create` | Create up to 1000 tasks at once |
374
-
375
- #### Streaming Events
376
- ```
377
- event: progress
378
- data: {"status": "starting", "total": 100}
379
-
380
- event: data
381
- data: {"type": "task", "data": {...}}
382
-
383
- event: result
384
- data: {"status": "success", "count": 100}
385
- ```
386
-
387
- ### 5. **Telegram Bot Integration** - Via Clawdbot
388
- - **Setup Guide**: [CLAWDBOT_SETUP.md](./CLAWDBOT_SETUP.md)
389
- - **Tool**: mcporter for MCP server bridging
390
- - **Usage**: Natural language task management in Telegram
391
-
392
- ```bash
393
- # Quick setup
394
- npm install -g mcporter
395
- mcporter call ainote.list_tasks
396
- ```
397
-
398
- ### Local Development Bridge (`ainote-mcp-http`)
399
-
400
- Run the bundled HTTP/SSE bridge when you need a local endpoint for ChatGPT or other MCP clients that speak SSE:
401
-
402
- ```bash
403
- ainote-mcp-http
404
- ```
405
-
406
- By default the server listens on `http://localhost:3030` and exposes two endpoints:
407
-
408
- - `GET /sse` – establishes the SSE stream and returns the `sessionId`
409
- - `POST /messages?sessionId=...` – receives JSON-RPC payloads from the client
410
- - `GET /health` – simple health probe for monitoring
411
-
412
- #### Configuration
413
-
414
- Environment variable | Description | Default
415
- ---|---|---
416
- `AINOTE_API_KEY` | API key used for MCP key authentication | **required**
417
- `AINOTE_API_URL` | Target AI Note API base URL | `https://api.ainote.dev`
418
- `AINOTE_MCP_HTTP_PORT` | Local port for the SSE server | `3030`
419
- `AINOTE_MCP_ALLOWED_ORIGINS` | Comma-separated list of allowed browser origins | _any_
420
- `AINOTE_MCP_ALLOWED_HOSTS` | Comma-separated list of allowed `Host` headers | _any_
421
- `AINOTE_ENABLE_OAUTH_AUTH` | Set to `true` to allow Bearer tokens (OAuth) | `false`
422
-
423
- When OAuth is enabled the server expects `Authorization: Bearer ...` headers from the client and forwards them to the AI Note API.
424
-
425
- ## Available Tools
426
-
427
- ### list_tasks
428
-
429
- List tasks from AI Note with advanced filtering options.
430
-
431
- **Basic Parameters:**
432
- - `status` (optional): Filter by status - "pending" or "completed"
433
- - `limit` (optional): Maximum number of tasks (default: 25, max: 500)
434
- - `search` (optional): Search keyword in task content
435
- - `is_important` (optional): Filter important tasks only
436
-
437
- **Location & Category:**
438
- - `location` (optional): Filter by location (partial match, e.g., "여의도")
439
- - `category_id` (optional): Filter by category UUID
440
-
441
- **Date Range Filters:**
442
- - `due_date_start` / `due_date_end`: Filter by due date range
443
- - `completed_date_start` / `completed_date_end`: Filter by completion date
444
- - `created_date_start` / `created_date_end`: Filter by creation date
445
-
446
- **Special Filters:**
447
- - `overdue` (optional): Filter overdue incomplete tasks
448
- - `due_today` (optional): Filter tasks due today
449
- - `has_notification` (optional): Filter by notification status
450
-
451
- **Sorting:**
452
- - `sort_by` (optional): Sort field - "due_date", "created_at", "completed_at", "updated_at", "is_important"
453
- - `sort_order` (optional): Sort direction - "asc" or "desc"
454
-
455
- ### create_task
456
-
457
- Create a new task in AI Note.
458
-
459
- **Parameters:**
460
- - `content` (required): Task description
461
- - `is_important` (optional): Mark as important (boolean)
462
- - `due_date` (optional): Due date in ISO format
463
- - `category_id` (optional): Category ID to assign
464
-
465
- ### update_task
466
-
467
- Update an existing task.
468
-
469
- **Parameters:**
470
- - `id` (required): Task ID
471
- - `content` (optional): New task content
472
- - `is_important` (optional): Update important status
473
- - `completed_at` (optional): Mark as completed (ISO format) or null to uncomplete
474
-
475
- ### delete_task
476
-
477
- Soft delete a task.
478
-
479
- **Parameters:**
480
- - `id` (required): Task ID to delete
481
-
482
- ### list_categories
483
-
484
- List all available categories.
485
-
486
- **Parameters:** None
487
-
488
- ---
489
-
490
- ### Dev Doc Tools (v1.1.0+)
491
-
492
- Manage AI coding tool configuration files and dev documents centrally. All docs are organized under the `dev/` category hierarchy.
493
-
494
- #### list_dev_docs
495
-
496
- List dev documents with optional filtering.
497
-
498
- **Parameters:**
499
- - `category` (optional): Subcategory filter (claude, cursor, windsurf, copilot, docs)
500
- - `search` (optional): Search keyword in document title
501
- - `content_type` (optional): Filter by type - "markdown", "json", "yaml", "text"
502
-
503
- #### get_dev_doc
504
-
505
- Get a single dev document by title or id.
506
-
507
- **Parameters:**
508
- - `title` or `id` (one required): Document identifier
509
- - `category` (optional): Subcategory to disambiguate title
510
- - `include_versions` (optional): Include version history
511
-
512
- #### create_dev_doc
513
-
514
- Create a new dev document under `dev/` category.
515
-
516
- **Parameters:**
517
- - `title` (required): Document title (e.g., "project-a-claude.md")
518
- - `content` (required): Document content
519
- - `category` (optional): Subcategory (default: "docs")
520
- - `content_type` (optional): Auto-detected from title extension
521
-
522
- #### update_dev_doc
523
-
524
- Update a dev document with replace, append, or prepend modes.
525
-
526
- **Parameters:**
527
- - `title` or `id` (one required): Document identifier
528
- - `content` (required): New content
529
- - `mode` (optional): "replace" (default), "append", or "prepend"
530
-
531
- #### delete_dev_doc
532
-
533
- Soft delete a dev document.
534
-
535
- **Parameters:**
536
- - `title` or `id` (one required): Document identifier
537
-
538
- #### list_dev_categories
539
-
540
- List all subcategories under `dev/` with document counts.
541
-
542
- **Parameters:** None
543
-
544
- #### Example: Store CLAUDE.md in ainote
545
-
546
- ```
547
- You: "Save this project's CLAUDE.md content to ainote"
548
- Claude: I'll create a dev doc in the claude category...
549
- → create_dev_doc(title: "myproject-claude.md", content: "...", category: "claude")
550
-
551
- You: "Update my cursor rules in ainote"
552
- Claude: I'll update the cursor rules doc...
553
- → update_dev_doc(title: "api-rules.mdc", category: "cursor", content: "...")
554
-
555
- You: "Show me all my dev docs"
556
- Claude: I'll list all documents under dev/...
557
- → list_dev_docs()
558
- ```
559
-
560
- ### Session Handoffs (cross-session / cross-device continuation)
561
-
562
- Save a self-contained handoff note when the context window fills up or when you need to continue on another machine. Stored in the user's primary vault under `handoffs/`, auto-purged after 7 days.
563
-
564
- | Tool | Purpose |
565
- |------|---------|
566
- | `handoff_save` | Write a handoff (`project`, `topic`, `content`, optional `date`, optional `time` HHMM for same-day disambiguation) |
567
- | `handoff_list` | Most-recent-first list, optionally filtered by project. ⚠️ Triggers the 7-day stale purge as a side effect |
568
- | `handoff_get` | Fetch by `project` + `topic` (+ optional `date`/`time`). Returns latest if `date` omitted. Same purge side effect |
569
-
570
- ```text
571
- You: "Save a handoff for the logi-phase4 work I'm wrapping up"
572
- Claude: → handoff_save({project: "logi", topic: "phase4", time: "1555", content: "..."})
573
- Stored at handoffs/logi-phase4-1555-2026-05-14.txt
574
-
575
- (later, on the laptop):
576
- You: "Pick up the logi-phase4 handoff"
577
- Claude: → handoff_get({project: "logi", topic: "phase4"})
578
- ```
579
-
580
- ### Multi-Device File Sync (`sync_*` / `vault_sync`)
581
-
582
- `sync_push` / `sync_pull` / `sync_list` operate on the user's git-backed primary vault. `vault_sync` is the unified entrypoint that accepts an `action: list|pull|push` argument.
583
-
584
- | Tool | Purpose |
585
- |------|---------|
586
- | `sync_push` | Push a markdown note (path + content) into the vault repo |
587
- | `sync_pull` | Read a markdown note from the vault by path |
588
- | `sync_list` | Enumerate vault paths (optionally filtered) |
589
- | `vault_sync` | Unified wrapper around the above three |
590
-
591
- ### GitHub-Backed Vaults
592
-
593
- | Tool | Purpose |
594
- |------|---------|
595
- | `vault_list` | List the user's vaults + sync status + indexed file counts |
596
- | `vault_create` | Create a new private vault as a GitHub repo (requires the ainote GitHub App install) |
597
- | `vault_clone` | Return the git clone URL for an existing vault. ainote does **not** proxy git traffic — use your usual GitHub credentials |
598
- | `vault_connect_status` | Check whether the ainote GitHub App is installed for this user; returns an install URL otherwise |
599
-
600
- ---
601
-
602
- ## Annotations Reference
603
-
604
- Every tool advertises four MCP-spec annotations on `tools/list` so autonomous agent runtimes can reason about safety:
605
-
606
- | Hint | Meaning | Agent action |
607
- |------|---------|--------------|
608
- | `readOnlyHint: true` | Tool does not mutate any server state | Safe to call without consent gates |
609
- | `destructiveHint: true` | Tool deletes / overwrites / purges state | Require explicit user consent or transaction boundary |
610
- | `idempotentHint: true` | Repeating the call with same args ends in the same state | Safe to retry on timeout / network error |
611
- | `openWorldHint: true` | Tool reaches an external system (GitHub, SMTP, third-party) | Outcomes may be non-deterministic; cache cautiously |
612
-
613
- **Notable annotations:**
614
-
615
- - `handoff_list` / `handoff_get` are marked `destructiveHint: true` because they run a 7-day stale-handoff purge on every call.
616
- - `login_and_get_key` is marked `readOnlyHint: false` because it creates a default MCP key when the user has none.
617
- - `vault_sync` is conservatively `destructiveHint: true` because `action=push` with empty content can delete an indexed file.
618
-
619
- See the source-of-truth mapping at [`docs/todo/MCP_TOOL_ANNOTATIONS_MAPPING.md`](https://github.com/seunghan91/ainote/blob/main/docs/todo/MCP_TOOL_ANNOTATIONS_MAPPING.md) in the ainote repo.
620
-
621
- ---
622
-
623
- ## Agent Compatibility
624
-
625
- ainote MCP works with any client that speaks Model Context Protocol over stdio or HTTP. Tested setups:
626
-
627
- ### Claude Desktop / Claude Code (stdio via this npm package)
628
-
629
- ```json
630
- {
631
- "mcpServers": {
632
- "ainote": {
633
- "command": "npx",
634
- "args": ["-y", "@ainote/mcp"],
635
- "env": { "AINOTE_API_KEY": "..." }
636
- }
637
- }
638
- }
639
- ```
640
-
641
- ### Claude Code (direct HTTP — recommended for full feature set)
642
-
643
- ```json
644
- {
645
- "mcpServers": {
646
- "ainote": {
647
- "type": "http",
648
- "url": "https://api.ainote.dev/api/mcp",
649
- "headers": { "Authorization": "McpKey <YOUR_MCP_KEY>" }
650
- }
651
- }
652
- }
653
- ```
654
-
655
- > The `type: "http"` field is required — without it, Claude Code's user-level MCP loader silently rejects the entire `mcpServers` block.
656
-
657
- ### Cursor / Windsurf (stdio)
658
-
659
- Same as Claude Desktop config — both editors accept the `command + args + env` shape.
660
-
661
- ### ChatGPT / OpenAI Custom GPTs
662
-
663
- Use the hosted HTTP endpoint via OpenAI Connectors or Custom GPT Actions. The MCP JSON-RPC body works as a regular HTTPS POST. An OpenAPI 3.1 mirror of the tool surface is planned (see `docs/todo/AGENT_INTEROP_ROADMAP_2026.md` Phase 1.4).
664
-
665
- ### LangChain / LangGraph
666
-
667
- Wrap the HTTP endpoint as a remote tool. Pass `Authorization: McpKey <YOUR_MCP_KEY>` and POST JSON-RPC requests. Tool definitions can be discovered via `tools/list`.
668
-
669
- ---
670
-
671
- ## API Reference
672
-
673
- The MCP server communicates with the AI Note API using the following endpoints:
674
-
675
- - `GET /api/mcp/tasks` - List tasks
676
- - `POST /api/mcp/tasks` - Create task
677
- - `PUT /api/mcp/tasks/:id` - Update task
678
- - `DELETE /api/mcp/tasks/:id` - Delete task
679
- - `GET /api/mcp/categories` - List categories
680
-
681
- All requests require authentication via the `Authorization` header with your API key.
682
-
683
- ## Development
684
-
685
- ### Running Locally
686
-
687
- ```bash
688
- # Clone the repository
689
- git clone https://github.com/ainote-dev/ainote-mcp.git
690
- cd ainote-mcp-server
691
-
692
- # Install dependencies
693
- npm install
694
-
695
- # Run the server
696
- npm start
697
- ```
698
-
699
- ### Testing with Claude Desktop
700
-
701
- 1. Update your Claude Desktop config to point to your local development server
702
- 2. Set environment variables for testing
703
- 3. Restart Claude Desktop
704
- 4. Check the MCP connection status in Claude Desktop settings
705
-
706
- ### Project Structure
707
-
708
- ```
709
- ainote-mcp-server/
710
- ├── index.js # Main server implementation
711
- ├── package.json # Package configuration
712
- ├── README.md # English documentation
713
- ├── README-ko.md # Korean documentation
714
- └── LICENSE # MIT license
715
- ```
716
-
717
- ## Troubleshooting
718
-
719
- ### Common Issues
720
-
721
- 1. **"API key not found" error**
722
- - Ensure `AINOTE_API_KEY` is set in your environment or Claude config
723
- - Check that the API key is valid and has proper permissions
724
-
725
- 2. **"Connection refused" error**
726
- - Verify the API URL is correct
727
- - Check network connectivity
728
- - Ensure the AI Note API server is running
729
-
730
- 3. **"Tool not found" error**
731
- - Restart Claude Desktop after configuration changes
732
- - Verify the MCP server is properly configured in Claude Desktop
733
-
734
- 4. **Tasks not appearing**
735
- - Check API key permissions
736
- - Verify you're querying the correct status (pending/completed)
737
- - Try using the search parameter
738
-
739
- ### Debug Mode
740
-
741
- To enable debug logging:
742
-
743
- ```bash
744
- export DEBUG=mcp:*
745
- ```
746
-
747
- ## Contributing
748
-
749
- We welcome contributions! Please follow these steps:
750
-
751
- 1. Fork the repository
752
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
753
- 3. Commit your changes (`git commit -m 'Add amazing feature'`)
754
- 4. Push to the branch (`git push origin feature/amazing-feature`)
755
- 5. Open a Pull Request
756
-
757
- ### Development Guidelines
758
-
759
- - Follow the existing code style
760
- - Add tests for new features
761
- - Update documentation as needed
762
- - Ensure all tests pass before submitting PR
763
-
764
- ## License
765
-
766
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
767
-
768
- ## Support
769
-
770
- - 📧 Email: support@ainote.dev
771
- - 🐛 Issues: [GitHub Issues](https://github.com/ainote-dev/ainote-mcp/issues)
772
- - 💬 Discord: [Join our community](https://discord.gg/ainote)
773
-
774
- ## Acknowledgments
775
-
776
- - Built with [Model Context Protocol SDK](https://github.com/modelcontextprotocol/sdk)
777
- - Powered by [AI Note](https://ainote.dev)
1
+ # AI Note MCP Server
2
+
3
+ [![npm version](https://badge.fury.io/js/%40ainote%2Fmcp-server.svg)](https://badge.fury.io/js/%40ainote%2Fmcp-server)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A Model Context Protocol (MCP) server that connects AI assistants to your AI Note task management system. This package enables direct interaction with your AI Note tasks through natural language conversations in Claude Desktop and other MCP-compatible platforms.
7
+
8
+ > 📚 **[Complete Project Guide](../docs/PROJECT_GUIDE.md)** - 전체 프로젝트 가이드 및 아키텍처 정보
9
+
10
+ ## Table of Contents
11
+
12
+ - [Access Methods](#access-methods)
13
+ - [Features](#features)
14
+ - [Authentication](#authentication)
15
+ - [Prerequisites](#prerequisites)
16
+ - [Installation](#installation)
17
+ - [Configuration](#configuration)
18
+ - [Usage](#usage)
19
+ - [HTTP Endpoint](#http-endpoint)
20
+ - [Available Tools](#available-tools)
21
+ - [API Reference](#api-reference)
22
+ - [Development](#development)
23
+ - [Troubleshooting](#troubleshooting)
24
+ - [Contributing](#contributing)
25
+ - [License](#license)
26
+
27
+ ## Access Methods
28
+
29
+ AI Note MCP server is available through three transport options to cover different integration scenarios:
30
+
31
+ ### 1. **stdio Mode (This Package)** - For Personal Use
32
+ - **Installation**: `npm install -g @ainote/mcp`
33
+ - **Usage**: Claude Desktop and other stdio-based MCP clients
34
+ - **Setup**: Local installation with API key configuration
35
+ - **Best for**: Individual users connecting their personal AI Note account to Claude Desktop
36
+
37
+ ### 2. **Local SSE Bridge (ChatGPT / MCP Apps)**
38
+ - **Command**: `ainote-mcp-http`
39
+ - **Protocol**: Server-Sent Events (SSE) + JSON-RPC over HTTP POST
40
+ - **Usage**: ChatGPT Model Context Protocol connectors, other SSE-capable MCP clients
41
+ - **Setup**: Run locally alongside your browser; supports API key or (optional) OAuth bearer tokens
42
+ - **Best for**: Users wanting to expose AI Note tools to ChatGPT without deploying infrastructure
43
+
44
+ ### 3. **Hosted HTTP Endpoint** - For Platform Integration
45
+ - **URL**: `https://api.ainote.dev/api/mcp`
46
+ - **Protocol**: JSON-RPC 2.0 over HTTP
47
+ - **Usage**: Platform integrations (Kakao PlayMCP, etc.)
48
+ - **Setup**: No installation required, direct API access
49
+ - **Best for**: Third-party platforms and services integrating AI Note functionality
50
+
51
+ All transports expose the same tool catalog. Choose the option that matches your hosting model and client capabilities.
52
+
53
+ ## Features
54
+
55
+ - 📝 **Task Management**: Create, update, delete, and list tasks directly from Claude Desktop
56
+ - 📄 **Dev Docs**: Manage CLAUDE.md, Cursor rules, Windsurf rules, and dev documents centrally via MCP
57
+ - 🗂️ **Dev Category Hierarchy**: Auto-organized under `dev/` with subcategories (claude, cursor, windsurf, copilot, docs, skills, agents, commands, hooks, mcp)
58
+ - 🔄 **Claude Environment Sync**: Push/pull `~/.claude/` skills, agents, commands, hooks across machines (macOS/WSL/Linux)
59
+ - 🔐 **End-to-End Encryption**: `mcp` category (mcpServers + API keys) auto-encrypted client-side with age; server never sees plaintext
60
+ - 🪪 **OS Keychain Integration**: Per-machine age identity stored in macOS Keychain / libsecret / Credential Manager (file fallback supported)
61
+ - 🤝 **Session Handoffs**: `handoff_save` / `handoff_list` / `handoff_get` with optional `time: HHMM` for same-day disambiguation — saved under the primary vault, auto-purged after 7 days
62
+ - 📦 **Multi-Device File Sync**: `sync_push` / `sync_pull` / `sync_list` push markdown notes into the user's git-backed primary vault — works across macOS, Linux, iOS shortcuts
63
+ - 🏛️ **GitHub-Backed Vaults**: `vault_create` / `vault_clone` / `vault_sync` provision a private GitHub repo per vault; ainote indexes contents but never proxies git traffic
64
+ - 🛡️ **MCP Tool Annotations**: Every tool advertises `readOnlyHint` / `destructiveHint` / `idempotentHint` / `openWorldHint` so autonomous agent runtimes can gate destructive calls
65
+ - 🏷️ **Category Support**: Organize tasks with categories
66
+ - 🔍 **Advanced Filtering**: 18+ filter options including date ranges, location, overdue tasks
67
+ - ⭐ **Priority Management**: Mark tasks as important
68
+ - 📅 **Smart Due Dates**: Human-readable format with relative time (e.g., `'26.1.25 14:30 - 오늘`)
69
+ - 🔒 **Dual Authentication**: Support for both User API Key (24-char) and MCP Key (64-char)
70
+ - 📊 **Usage Tracking**: Automatic API usage statistics per MCP key
71
+ - 🌊 **Streaming API**: Real-time streaming for bulk operations and large datasets
72
+ - 🤖 **Bot Integration**: Telegram bot support via Clawdbot + mcporter
73
+
74
+ ## Quick Start (No Account Needed)
75
+
76
+ You can start using AI Note MCP **without an existing account**. The MCP server includes onboarding tools that let you sign up and get an API key directly from Claude:
77
+
78
+ ### 1. Add to your MCP config (no API key yet)
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "ainote": {
84
+ "command": "npx",
85
+ "args": ["-y", "@ainote/mcp"]
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ ### 2. Restart Claude Desktop
92
+
93
+ ### 3. Ask Claude to sign you up
94
+
95
+ > "Sign me up for AI Note with email user@example.com and password mypassword123"
96
+
97
+ Claude will call the `signup_and_get_key` tool and return your MCP API key.
98
+
99
+ ### 4. Add the API key to your config
100
+
101
+ ```json
102
+ {
103
+ "mcpServers": {
104
+ "ainote": {
105
+ "command": "npx",
106
+ "args": ["-y", "@ainote/mcp"],
107
+ "env": {
108
+ "AINOTE_API_KEY": "<your-key-from-step-3>"
109
+ }
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ ### 5. Restart Claude Desktop again
116
+
117
+ Now all tools (tasks, dev docs, etc.) are available.
118
+
119
+ ### CLI Signup
120
+
121
+ You can also sign up directly from the terminal:
122
+
123
+ ```bash
124
+ npx @ainote/mcp signup
125
+ ```
126
+
127
+ This will interactively ask for email, password, and name, then return your MCP API key.
128
+
129
+ ### CLI Tool Invocation (`call`)
130
+
131
+ Run any of the 26 ainote tools directly from the shell — no Claude / Cursor / MCP host required. Useful for scripts, alfred / raycast workflows, automation, and one-off queries.
132
+
133
+ ```bash
134
+ # List all tasks due today
135
+ npx @ainote/mcp call list_tasks --due_today=true
136
+
137
+ # Save a handoff (JSON form)
138
+ npx @ainote/mcp call handoff_save \
139
+ --json '{"project":"demo","topic":"poc","content":"..."}'
140
+
141
+ # Get a handoff
142
+ npx @ainote/mcp call handoff_get --project=demo --topic=poc
143
+
144
+ # Read a resource URI as JSON (load all tasks at once)
145
+ npx @ainote/mcp call list_tasks --limit=500
146
+ ```
147
+
148
+ Flag parsing: `--key=value` is JSON.parse-d (numbers/booleans/null/arrays/objects work directly; raw strings fall back). Pass the entire arguments object via `--json '<obj>'`. Add `--raw` for the full JSON-RPC envelope.
149
+
150
+ Auth resolution order: `AINOTE_API_KEY` env var → OS keychain (from `ainote-mcp login`).
151
+
152
+ ### Onboarding MCP Tools
153
+
154
+ These tools also work inside Claude (no API key needed):
155
+
156
+ | Tool | Description |
157
+ |------|-------------|
158
+ | `signup_and_get_key` | Create account + get MCP key |
159
+ | `login_and_get_key` | Login + get MCP key (existing account) |
160
+ | `get_setup_guide` | Setup instructions |
161
+
162
+ ## Authentication
163
+
164
+ The CLI supports browser-based login as a more secure alternative to manually pasting API keys into your MCP config. Tokens and the MCP key are stored in the OS keychain.
165
+
166
+ ### Quick start
167
+
168
+ ```bash
169
+ ainote-mcp login # browser-based, recommended
170
+ ainote-mcp whoami # verify current login
171
+ ainote-mcp logout # revoke + clear keychain
172
+ ```
173
+
174
+ ### How it works
175
+
176
+ `ainote-mcp login` runs an [RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628) OAuth 2.0 Device Authorization Grant. The CLI generates a PKCE pair locally, opens your browser to sign in via the AI Note web app, and polls the backend until you approve. On success it stores an access token, a refresh token, and an MCP key in the OS keychain. The default MCP stdio mode automatically uses the stored MCP key — no `AINOTE_API_KEY` env var needed.
177
+
178
+ ### Storage locations
179
+
180
+ | OS | Location |
181
+ |----------|---------------------------------------------------------------------------|
182
+ | macOS | Keychain Access — service `@ainote/cli` |
183
+ | Linux | libsecret (gnome-keyring / kwallet) — service `@ainote/cli` |
184
+ | Windows | Credential Manager — target `@ainote/cli` |
185
+ | Fallback | `${XDG_CONFIG_HOME:-~/.config}/ainote/credentials.json` (mode `0600`) |
186
+
187
+ The fallback file is only used when no system keychain is available (e.g. headless servers without `libsecret`).
188
+
189
+ ### CLI flags
190
+
191
+ - `--scope=mcp,read,write` — comma-separated scopes requested for the token (default: `mcp,read,write`)
192
+ - `--no-browser` — print the verification URL instead of auto-opening a browser (use this on SSH/CI)
193
+
194
+ ### Environment overrides
195
+
196
+ - `AINOTE_API_URL` — backend URL (default `https://api.ainote.dev`)
197
+ - `AINOTE_API_KEY` — pre-provisioned MCP key. When set, the login flow is bypassed entirely and this key is used as-is.
198
+
199
+ ### Headless / CI usage
200
+
201
+ For SSH sessions, devcontainers, or CI runners that cannot open a browser, use `--no-browser`. The CLI will print a short user code and a verification URL; open the URL on any device (laptop, phone) signed in to your AI Note account, approve the request, then return to the terminal:
202
+
203
+ ```bash
204
+ $ ainote-mcp login --no-browser
205
+ Open this URL in any browser:
206
+ https://ainote.dev/oauth/cli/device?user_code=BCDF-GHJK
207
+ Waiting for approval...
208
+ ✓ Logged in as you@example.com
209
+ ```
210
+
211
+ After login, subsequent invocations (`ainote-mcp`, `ainote-mcp whoami`) work normally with no further interaction.
212
+
213
+ ### Troubleshooting
214
+
215
+ | Symptom | Fix |
216
+ |-----------------------------------------------|-------------------------------------------------------------------------------------------|
217
+ | `LOGIN_HINT` error on any subcommand | Run `ainote-mcp login` |
218
+ | macOS Keychain prompt every run | Open Keychain Access, find `@ainote/cli`, set access control to "Always allow" for `node` |
219
+ | Browser does not open | Re-run with `--no-browser` and copy the URL manually |
220
+ | Persistent 401 after login | Tokens were revoked server-side. Run `ainote-mcp login` again |
221
+ | `libsecret not available` on Linux | Install `gnome-keyring` / `libsecret-1-0`, or rely on the file fallback (still encrypted at-rest by the OS) |
222
+
223
+ See [`docs/architecture/CLI_AUTH.md`](../docs/architecture/CLI_AUTH.md) for the full protocol specification, sequence diagram, and security model.
224
+
225
+ ## Prerequisites
226
+
227
+ - Node.js >= 18.0.0
228
+ - npm or yarn
229
+ - Claude Desktop with MCP support enabled
230
+
231
+ ## Installation
232
+
233
+ ### Option 1: Install from npm
234
+
235
+ ```bash
236
+ npm install -g @ainote/mcp
237
+ ```
238
+
239
+ ### Option 2: Install from source
240
+
241
+ ```bash
242
+ git clone https://github.com/ainote-dev/ainote-mcp.git
243
+ cd ainote-mcp-server
244
+ npm install
245
+ ```
246
+
247
+ ## Update
248
+
249
+ ### Update from npm (Recommended)
250
+
251
+ To update to the latest version when installed via npm:
252
+
253
+ ```bash
254
+ npm update -g @ainote/mcp
255
+ ```
256
+
257
+ Or to install a specific version:
258
+
259
+ ```bash
260
+ npm install -g @ainote/mcp@1.0.2
261
+ ```
262
+
263
+ ### Update from source
264
+
265
+ If you installed from source:
266
+
267
+ ```bash
268
+ cd ainote-mcp-server
269
+ git pull origin main
270
+ npm install
271
+ ```
272
+
273
+ After updating, **restart Claude Desktop** to load the new version.
274
+
275
+ ## Configuration
276
+
277
+ To connect the MCP server with Claude Desktop, follow these steps.
278
+
279
+ ### Step 1: Get your AI Note API Key
280
+
281
+ You need an API key from your AI Note account to allow Claude to access your tasks. You can find or generate your API key in the AI Note app's settings screen.
282
+
283
+ ### Step 2: Configure Claude Desktop
284
+
285
+ Add the `ainote-mcp` server to your Claude Desktop configuration file. This file is located at:
286
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
287
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
288
+
289
+ Open the file and add the following JSON block inside the `mcpServers` object. **Replace `your-api-key-here` with your actual AI Note API key.**
290
+
291
+ ```json
292
+ {
293
+ "mcpServers": {
294
+ "ainote": {
295
+ "command": "ainote-mcp",
296
+ "env": {
297
+ "AINOTE_API_KEY": "your-api-key-here"
298
+ }
299
+ }
300
+ }
301
+ }
302
+ ```
303
+
304
+ *Note: If you need to connect to a self-hosted or different AI Note server, you can add the `AINOTE_API_URL` environment variable as well.*
305
+
306
+ ```json
307
+ "env": {
308
+ "AINOTE_API_KEY": "your-api-key-here",
309
+ "AINOTE_API_URL": "https://your-custom-api-url.com"
310
+ }
311
+ ```
312
+
313
+ ### Step 3: Restart Claude Desktop
314
+
315
+ After saving the configuration file, **restart Claude Desktop** completely. The new MCP server will be loaded, and you can start managing your AI Note tasks through Claude.
316
+
317
+
318
+ ## Usage
319
+
320
+ Once configured, you can interact with your AI Note tasks through Claude:
321
+
322
+ ### Example Conversations
323
+
324
+ ```
325
+ You: "Show me my pending tasks"
326
+ Claude: I'll retrieve your pending tasks from AI Note...
327
+
328
+ You: "Create a new task to review the quarterly report by Friday"
329
+ Claude: I'll create that task for you with a due date set for Friday...
330
+
331
+ You: "Mark task ID 123 as completed"
332
+ Claude: I'll mark that task as completed...
333
+ ```
334
+
335
+ ## HTTP Endpoint
336
+
337
+ For platform integrations and services that prefer HTTP over stdio, AI Note provides a direct HTTP endpoint:
338
+
339
+ ### Endpoint URL
340
+ ```
341
+ POST https://api.ainote.dev/api/mcp
342
+ Content-Type: application/json
343
+ ```
344
+
345
+ ### Authentication
346
+ ```http
347
+ Authorization: Bearer YOUR_API_KEY
348
+ ```
349
+
350
+ ### Request Format (JSON-RPC 2.0)
351
+ ```json
352
+ {
353
+ "jsonrpc": "2.0",
354
+ "method": "tools/list",
355
+ "id": 1
356
+ }
357
+ ```
358
+
359
+ ### Response Format
360
+ ```json
361
+ {
362
+ "jsonrpc": "2.0",
363
+ "result": {
364
+ "tools": [...]
365
+ },
366
+ "id": 1
367
+ }
368
+ ```
369
+
370
+ ### Supported Methods
371
+ - `ping` - Health check
372
+ - `capabilities` - Server capabilities
373
+ - `tools/list` - List available tools
374
+ - `tools/call` - Execute a specific tool
375
+
376
+ ### Platform Integration Examples
377
+ - **Kakao PlayMCP**: Use the HTTP endpoint for seamless integration
378
+ - **Custom Applications**: Build your own MCP client using the HTTP API
379
+ - **Enterprise Solutions**: Direct server-to-server communication
380
+
381
+ This HTTP endpoint provides identical functionality to the stdio version, making AI Note MCP accessible to a broader range of platforms and integration scenarios.
382
+
383
+ ### 4. **Streaming API** - For Large Data Operations
384
+ - **URL**: `POST https://api.ainote.dev/api/mcp/stream`
385
+ - **Protocol**: Server-Sent Events (SSE)
386
+ - **Usage**: Bulk operations, large task lists, real-time progress
387
+ - **Best for**: Applications that need to handle large datasets or show progress indicators
388
+
389
+ #### Streaming Methods
390
+ | Method | Description |
391
+ |--------|-------------|
392
+ | `tasks/list` | Stream task list with filters |
393
+ | `tasks/create` | Create single task with progress |
394
+ | `tasks/analyze` | Get task statistics and insights |
395
+ | `tasks/bulk_update` | Update multiple tasks with progress |
396
+ | `tasks/bulk_create` | Create up to 1000 tasks at once |
397
+
398
+ #### Streaming Events
399
+ ```
400
+ event: progress
401
+ data: {"status": "starting", "total": 100}
402
+
403
+ event: data
404
+ data: {"type": "task", "data": {...}}
405
+
406
+ event: result
407
+ data: {"status": "success", "count": 100}
408
+ ```
409
+
410
+ ### 5. **Telegram Bot Integration** - Via Clawdbot
411
+ - **Setup Guide**: [CLAWDBOT_SETUP.md](./CLAWDBOT_SETUP.md)
412
+ - **Tool**: mcporter for MCP server bridging
413
+ - **Usage**: Natural language task management in Telegram
414
+
415
+ ```bash
416
+ # Quick setup
417
+ npm install -g mcporter
418
+ mcporter call ainote.list_tasks
419
+ ```
420
+
421
+ ### Local Development Bridge (`ainote-mcp-http`)
422
+
423
+ Run the bundled HTTP/SSE bridge when you need a local endpoint for ChatGPT or other MCP clients that speak SSE:
424
+
425
+ ```bash
426
+ ainote-mcp-http
427
+ ```
428
+
429
+ By default the server listens on `http://localhost:3030` and exposes two endpoints:
430
+
431
+ - `GET /sse` – establishes the SSE stream and returns the `sessionId`
432
+ - `POST /messages?sessionId=...` – receives JSON-RPC payloads from the client
433
+ - `GET /health` – simple health probe for monitoring
434
+
435
+ #### Configuration
436
+
437
+ Environment variable | Description | Default
438
+ ---|---|---
439
+ `AINOTE_API_KEY` | API key used for MCP key authentication | **required**
440
+ `AINOTE_API_URL` | Target AI Note API base URL | `https://api.ainote.dev`
441
+ `AINOTE_MCP_HTTP_PORT` | Local port for the SSE server | `3030`
442
+ `AINOTE_MCP_ALLOWED_ORIGINS` | Comma-separated list of allowed browser origins | _any_
443
+ `AINOTE_MCP_ALLOWED_HOSTS` | Comma-separated list of allowed `Host` headers | _any_
444
+ `AINOTE_ENABLE_OAUTH_AUTH` | Set to `true` to allow Bearer tokens (OAuth) | `false`
445
+
446
+ When OAuth is enabled the server expects `Authorization: Bearer ...` headers from the client and forwards them to the AI Note API.
447
+
448
+ ## Available Tools
449
+
450
+ ### list_tasks
451
+
452
+ List tasks from AI Note with advanced filtering options.
453
+
454
+ **Basic Parameters:**
455
+ - `status` (optional): Filter by status - "pending" or "completed"
456
+ - `limit` (optional): Maximum number of tasks (default: 25, max: 500)
457
+ - `search` (optional): Search keyword in task content
458
+ - `is_important` (optional): Filter important tasks only
459
+
460
+ **Location & Category:**
461
+ - `location` (optional): Filter by location (partial match, e.g., "여의도")
462
+ - `category_id` (optional): Filter by category UUID
463
+
464
+ **Date Range Filters:**
465
+ - `due_date_start` / `due_date_end`: Filter by due date range
466
+ - `completed_date_start` / `completed_date_end`: Filter by completion date
467
+ - `created_date_start` / `created_date_end`: Filter by creation date
468
+
469
+ **Special Filters:**
470
+ - `overdue` (optional): Filter overdue incomplete tasks
471
+ - `due_today` (optional): Filter tasks due today
472
+ - `has_notification` (optional): Filter by notification status
473
+
474
+ **Sorting:**
475
+ - `sort_by` (optional): Sort field - "due_date", "created_at", "completed_at", "updated_at", "is_important"
476
+ - `sort_order` (optional): Sort direction - "asc" or "desc"
477
+
478
+ ### create_task
479
+
480
+ Create a new task in AI Note.
481
+
482
+ **Parameters:**
483
+ - `content` (required): Task description
484
+ - `is_important` (optional): Mark as important (boolean)
485
+ - `due_date` (optional): Due date in ISO format
486
+ - `category_id` (optional): Category ID to assign
487
+
488
+ ### update_task
489
+
490
+ Update an existing task.
491
+
492
+ **Parameters:**
493
+ - `id` (required): Task ID
494
+ - `content` (optional): New task content
495
+ - `is_important` (optional): Update important status
496
+ - `completed_at` (optional): Mark as completed (ISO format) or null to uncomplete
497
+
498
+ ### delete_task
499
+
500
+ Soft delete a task.
501
+
502
+ **Parameters:**
503
+ - `id` (required): Task ID to delete
504
+
505
+ ### list_categories
506
+
507
+ List all available categories.
508
+
509
+ **Parameters:** None
510
+
511
+ ---
512
+
513
+ ### Dev Doc Tools (v1.1.0+)
514
+
515
+ Manage AI coding tool configuration files and dev documents centrally. All docs are organized under the `dev/` category hierarchy.
516
+
517
+ #### list_dev_docs
518
+
519
+ List dev documents with optional filtering.
520
+
521
+ **Parameters:**
522
+ - `category` (optional): Subcategory filter (claude, cursor, windsurf, copilot, docs)
523
+ - `search` (optional): Search keyword in document title
524
+ - `content_type` (optional): Filter by type - "markdown", "json", "yaml", "text"
525
+
526
+ #### get_dev_doc
527
+
528
+ Get a single dev document by title or id.
529
+
530
+ **Parameters:**
531
+ - `title` or `id` (one required): Document identifier
532
+ - `category` (optional): Subcategory to disambiguate title
533
+ - `include_versions` (optional): Include version history
534
+
535
+ #### create_dev_doc
536
+
537
+ Create a new dev document under `dev/` category.
538
+
539
+ **Parameters:**
540
+ - `title` (required): Document title (e.g., "project-a-claude.md")
541
+ - `content` (required): Document content
542
+ - `category` (optional): Subcategory (default: "docs")
543
+ - `content_type` (optional): Auto-detected from title extension
544
+
545
+ #### update_dev_doc
546
+
547
+ Update a dev document with replace, append, or prepend modes.
548
+
549
+ **Parameters:**
550
+ - `title` or `id` (one required): Document identifier
551
+ - `content` (required): New content
552
+ - `mode` (optional): "replace" (default), "append", or "prepend"
553
+
554
+ #### delete_dev_doc
555
+
556
+ Soft delete a dev document.
557
+
558
+ **Parameters:**
559
+ - `title` or `id` (one required): Document identifier
560
+
561
+ #### list_dev_categories
562
+
563
+ List all subcategories under `dev/` with document counts.
564
+
565
+ **Parameters:** None
566
+
567
+ #### Example: Store CLAUDE.md in ainote
568
+
569
+ ```
570
+ You: "Save this project's CLAUDE.md content to ainote"
571
+ Claude: I'll create a dev doc in the claude category...
572
+ → create_dev_doc(title: "myproject-claude.md", content: "...", category: "claude")
573
+
574
+ You: "Update my cursor rules in ainote"
575
+ Claude: I'll update the cursor rules doc...
576
+ → update_dev_doc(title: "api-rules.mdc", category: "cursor", content: "...")
577
+
578
+ You: "Show me all my dev docs"
579
+ Claude: I'll list all documents under dev/...
580
+ → list_dev_docs()
581
+ ```
582
+
583
+ ### Session Handoffs (cross-session / cross-device continuation)
584
+
585
+ Save a self-contained handoff note when the context window fills up or when you need to continue on another machine. Stored in the user's primary vault under `handoffs/`, auto-purged after 7 days.
586
+
587
+ | Tool | Purpose |
588
+ |------|---------|
589
+ | `handoff_save` | Write a handoff (`project`, `topic`, `content`, optional `date`, optional `time` HHMM for same-day disambiguation) |
590
+ | `handoff_list` | Most-recent-first list, optionally filtered by project. ⚠️ Triggers the 7-day stale purge as a side effect |
591
+ | `handoff_get` | Fetch by `project` + `topic` (+ optional `date`/`time`). Returns latest if `date` omitted. Same purge side effect |
592
+
593
+ ```text
594
+ You: "Save a handoff for the logi-phase4 work I'm wrapping up"
595
+ Claude: → handoff_save({project: "logi", topic: "phase4", time: "1555", content: "..."})
596
+ Stored at handoffs/logi-phase4-1555-2026-05-14.txt
597
+
598
+ (later, on the laptop):
599
+ You: "Pick up the logi-phase4 handoff"
600
+ Claude: → handoff_get({project: "logi", topic: "phase4"})
601
+ ```
602
+
603
+ ### Multi-Device File Sync (`sync_*` / `vault_sync`)
604
+
605
+ `sync_push` / `sync_pull` / `sync_list` operate on the user's git-backed primary vault. `vault_sync` is the unified entrypoint that accepts an `action: list|pull|push` argument.
606
+
607
+ | Tool | Purpose |
608
+ |------|---------|
609
+ | `sync_push` | Push a markdown note (path + content) into the vault repo |
610
+ | `sync_pull` | Read a markdown note from the vault by path |
611
+ | `sync_list` | Enumerate vault paths (optionally filtered) |
612
+ | `vault_sync` | Unified wrapper around the above three |
613
+
614
+ ### GitHub-Backed Vaults
615
+
616
+ | Tool | Purpose |
617
+ |------|---------|
618
+ | `vault_list` | List the user's vaults + sync status + indexed file counts |
619
+ | `vault_create` | Create a new private vault as a GitHub repo (requires the ainote GitHub App install) |
620
+ | `vault_clone` | Return the git clone URL for an existing vault. ainote does **not** proxy git traffic — use your usual GitHub credentials |
621
+ | `vault_connect_status` | Check whether the ainote GitHub App is installed for this user; returns an install URL otherwise |
622
+
623
+ ---
624
+
625
+ ## Annotations Reference
626
+
627
+ Every tool advertises four MCP-spec annotations on `tools/list` so autonomous agent runtimes can reason about safety:
628
+
629
+ | Hint | Meaning | Agent action |
630
+ |------|---------|--------------|
631
+ | `readOnlyHint: true` | Tool does not mutate any server state | Safe to call without consent gates |
632
+ | `destructiveHint: true` | Tool deletes / overwrites / purges state | Require explicit user consent or transaction boundary |
633
+ | `idempotentHint: true` | Repeating the call with same args ends in the same state | Safe to retry on timeout / network error |
634
+ | `openWorldHint: true` | Tool reaches an external system (GitHub, SMTP, third-party) | Outcomes may be non-deterministic; cache cautiously |
635
+
636
+ **Notable annotations:**
637
+
638
+ - `handoff_list` / `handoff_get` are marked `destructiveHint: true` because they run a 7-day stale-handoff purge on every call.
639
+ - `login_and_get_key` is marked `readOnlyHint: false` because it creates a default MCP key when the user has none.
640
+ - `vault_sync` is conservatively `destructiveHint: true` because `action=push` with empty content can delete an indexed file.
641
+
642
+ See the source-of-truth mapping at [`docs/todo/MCP_TOOL_ANNOTATIONS_MAPPING.md`](https://github.com/seunghan91/ainote/blob/main/docs/todo/MCP_TOOL_ANNOTATIONS_MAPPING.md) in the ainote repo.
643
+
644
+ ---
645
+
646
+ ## Agent Compatibility
647
+
648
+ ainote MCP works with any client that speaks Model Context Protocol over stdio or HTTP. Tested setups:
649
+
650
+ ### Claude Desktop / Claude Code (stdio via this npm package)
651
+
652
+ ```json
653
+ {
654
+ "mcpServers": {
655
+ "ainote": {
656
+ "command": "npx",
657
+ "args": ["-y", "@ainote/mcp"],
658
+ "env": { "AINOTE_API_KEY": "..." }
659
+ }
660
+ }
661
+ }
662
+ ```
663
+
664
+ ### Claude Code (direct HTTP — recommended for full feature set)
665
+
666
+ ```json
667
+ {
668
+ "mcpServers": {
669
+ "ainote": {
670
+ "type": "http",
671
+ "url": "https://api.ainote.dev/api/mcp",
672
+ "headers": { "Authorization": "McpKey <YOUR_MCP_KEY>" }
673
+ }
674
+ }
675
+ }
676
+ ```
677
+
678
+ > The `type: "http"` field is required — without it, Claude Code's user-level MCP loader silently rejects the entire `mcpServers` block.
679
+
680
+ ### Cursor / Windsurf (stdio)
681
+
682
+ Same as Claude Desktop config — both editors accept the `command + args + env` shape.
683
+
684
+ ### ChatGPT / OpenAI Custom GPTs
685
+
686
+ Use the hosted HTTP endpoint via OpenAI Connectors or Custom GPT Actions. The MCP JSON-RPC body works as a regular HTTPS POST. An OpenAPI 3.1 mirror of the tool surface is planned (see `docs/todo/AGENT_INTEROP_ROADMAP_2026.md` Phase 1.4).
687
+
688
+ ### LangChain / LangGraph
689
+
690
+ Wrap the HTTP endpoint as a remote tool. Pass `Authorization: McpKey <YOUR_MCP_KEY>` and POST JSON-RPC requests. Tool definitions can be discovered via `tools/list`.
691
+
692
+ ---
693
+
694
+ ## API Reference
695
+
696
+ The MCP server communicates with the AI Note API using the following endpoints:
697
+
698
+ - `GET /api/mcp/tasks` - List tasks
699
+ - `POST /api/mcp/tasks` - Create task
700
+ - `PUT /api/mcp/tasks/:id` - Update task
701
+ - `DELETE /api/mcp/tasks/:id` - Delete task
702
+ - `GET /api/mcp/categories` - List categories
703
+
704
+ All requests require authentication via the `Authorization` header with your API key.
705
+
706
+ ## Development
707
+
708
+ ### Running Locally
709
+
710
+ ```bash
711
+ # Clone the repository
712
+ git clone https://github.com/ainote-dev/ainote-mcp.git
713
+ cd ainote-mcp-server
714
+
715
+ # Install dependencies
716
+ npm install
717
+
718
+ # Run the server
719
+ npm start
720
+ ```
721
+
722
+ ### Testing with Claude Desktop
723
+
724
+ 1. Update your Claude Desktop config to point to your local development server
725
+ 2. Set environment variables for testing
726
+ 3. Restart Claude Desktop
727
+ 4. Check the MCP connection status in Claude Desktop settings
728
+
729
+ ### Project Structure
730
+
731
+ ```
732
+ ainote-mcp-server/
733
+ ├── index.js # Main server implementation
734
+ ├── package.json # Package configuration
735
+ ├── README.md # English documentation
736
+ ├── README-ko.md # Korean documentation
737
+ └── LICENSE # MIT license
738
+ ```
739
+
740
+ ## Troubleshooting
741
+
742
+ ### Common Issues
743
+
744
+ 1. **"API key not found" error**
745
+ - Ensure `AINOTE_API_KEY` is set in your environment or Claude config
746
+ - Check that the API key is valid and has proper permissions
747
+
748
+ 2. **"Connection refused" error**
749
+ - Verify the API URL is correct
750
+ - Check network connectivity
751
+ - Ensure the AI Note API server is running
752
+
753
+ 3. **"Tool not found" error**
754
+ - Restart Claude Desktop after configuration changes
755
+ - Verify the MCP server is properly configured in Claude Desktop
756
+
757
+ 4. **Tasks not appearing**
758
+ - Check API key permissions
759
+ - Verify you're querying the correct status (pending/completed)
760
+ - Try using the search parameter
761
+
762
+ ### Debug Mode
763
+
764
+ To enable debug logging:
765
+
766
+ ```bash
767
+ export DEBUG=mcp:*
768
+ ```
769
+
770
+ ## Contributing
771
+
772
+ We welcome contributions! Please follow these steps:
773
+
774
+ 1. Fork the repository
775
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
776
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
777
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
778
+ 5. Open a Pull Request
779
+
780
+ ### Development Guidelines
781
+
782
+ - Follow the existing code style
783
+ - Add tests for new features
784
+ - Update documentation as needed
785
+ - Ensure all tests pass before submitting PR
786
+
787
+ ## License
788
+
789
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
790
+
791
+ ## Support
792
+
793
+ - 📧 Email: support@ainote.dev
794
+ - 🐛 Issues: [GitHub Issues](https://github.com/ainote-dev/ainote-mcp/issues)
795
+ - 💬 Discord: [Join our community](https://discord.gg/ainote)
796
+
797
+ ## Acknowledgments
798
+
799
+ - Built with [Model Context Protocol SDK](https://github.com/modelcontextprotocol/sdk)
800
+ - Powered by [AI Note](https://ainote.dev)
778
801
  - Made for [Claude Desktop](https://claude.ai/desktop)