@inkdropapp/mcp-server 1.3.1 → 1.5.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.
@@ -1,7 +1,5 @@
1
1
  {
2
2
  "permissions": {
3
- "allow": [
4
- "Bash(claude mcp list:*)"
5
- ]
3
+ "allow": ["Bash(claude mcp list:*)"]
6
4
  }
7
5
  }
@@ -17,14 +17,14 @@ jobs:
17
17
  # github.event.pull_request.user.login == 'external-contributor' ||
18
18
  # github.event.pull_request.user.login == 'new-developer' ||
19
19
  # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
-
20
+
21
21
  runs-on: ubuntu-latest
22
22
  permissions:
23
23
  contents: read
24
24
  pull-requests: read
25
25
  issues: read
26
26
  id-token: write
27
-
27
+
28
28
  steps:
29
29
  - name: Checkout repository
30
30
  uses: actions/checkout@v4
@@ -39,7 +39,7 @@ jobs:
39
39
 
40
40
  # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
41
41
  # model: "claude-opus-4-20250514"
42
-
42
+
43
43
  # Direct prompt for automated review (no @claude mention needed)
44
44
  direct_prompt: |
45
45
  Please review this pull request and provide feedback on:
@@ -48,12 +48,12 @@ jobs:
48
48
  - Performance considerations
49
49
  - Security concerns
50
50
  - Test coverage
51
-
51
+
52
52
  Be constructive and helpful in your feedback.
53
53
 
54
54
  # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
55
55
  # use_sticky_comment: true
56
-
56
+
57
57
  # Optional: Customize review based on file types
58
58
  # direct_prompt: |
59
59
  # Review this PR focusing on:
@@ -61,18 +61,17 @@ jobs:
61
61
  # - For API endpoints: Security, input validation, and error handling
62
62
  # - For React components: Performance, accessibility, and best practices
63
63
  # - For tests: Coverage, edge cases, and test quality
64
-
64
+
65
65
  # Optional: Different prompts for different authors
66
66
  # direct_prompt: |
67
- # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
67
+ # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
68
68
  # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
69
69
  # 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
70
-
70
+
71
71
  # Optional: Add specific tools for running tests or linting
72
72
  # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
73
-
73
+
74
74
  # Optional: Skip review for certain conditions
75
75
  # if: |
76
76
  # !contains(github.event.pull_request.title, '[skip-review]') &&
77
77
  # !contains(github.event.pull_request.title, '[WIP]')
78
-
@@ -39,26 +39,25 @@ jobs:
39
39
  # This is an optional setting that allows Claude to read CI results on PRs
40
40
  additional_permissions: |
41
41
  actions: read
42
-
42
+
43
43
  # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
44
44
  # model: "claude-opus-4-20250514"
45
-
45
+
46
46
  # Optional: Customize the trigger phrase (default: @claude)
47
47
  # trigger_phrase: "/claude"
48
-
48
+
49
49
  # Optional: Trigger when specific user is assigned to an issue
50
50
  # assignee_trigger: "claude-bot"
51
-
51
+
52
52
  # Optional: Allow Claude to run specific commands
53
53
  # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
54
-
54
+
55
55
  # Optional: Add custom instructions for Claude to customize its behavior for your project
56
56
  # custom_instructions: |
57
57
  # Follow our coding standards
58
58
  # Ensure all new code has tests
59
59
  # Use TypeScript for new files
60
-
60
+
61
61
  # Optional: Custom environment variables for Claude
62
62
  # claude_env: |
63
63
  # NODE_ENV: test
64
-
package/.oxfmtrc.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
+ "arrowParens": "avoid",
4
+ "singleQuote": true,
5
+ "bracketSpacing": true,
6
+ "endOfLine": "lf",
7
+ "semi": false,
8
+ "tabWidth": 2,
9
+ "trailingComma": "none",
10
+ "sortPackageJson": false,
11
+ "ignorePatterns": []
12
+ }
package/README.md CHANGED
@@ -2,33 +2,9 @@
2
2
 
3
3
  A [Model Context Protocol](https://github.com/modelcontextprotocol) server for the [Inkdrop Local HTTP Server API](https://developers.inkdrop.app/data-access/local-http-server).
4
4
 
5
- <a href="https://glama.ai/mcp/servers/c7fgtnckbv">
6
- <img width="380" height="200" src="https://glama.ai/mcp/servers/c7fgtnckbv/badge" alt="Inkdrop Server MCP server" />
7
- </a>
8
-
9
5
  ## Installation
10
6
 
11
- 1. [Set up a local HTTP server](https://developers.inkdrop.app/guides/integrate-with-external-programs)
12
-
13
- 2. Add server config to Claude Desktop:
14
- - MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
15
- - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
16
-
17
- ```json
18
- {
19
- "mcpServers": {
20
- "inkdrop": {
21
- "command": "npx",
22
- "args": ["-y", "@inkdropapp/mcp-server"],
23
- "env": {
24
- "INKDROP_LOCAL_SERVER_URL": "http://localhost:19840",
25
- "INKDROP_LOCAL_USERNAME": "your-local-server-username",
26
- "INKDROP_LOCAL_PASSWORD": "your-local-server-password"
27
- }
28
- }
29
- }
30
- }
31
- ```
7
+ Read [the docs here](https://docs.inkdrop.app/reference/mcp-server).
32
8
 
33
9
  ## Components
34
10
 
@@ -37,12 +13,19 @@ A [Model Context Protocol](https://github.com/modelcontextprotocol) server for t
37
13
  1. **`read-note`**: Retrieve the complete contents of the note by its ID from the database.
38
14
  - Required inputs:
39
15
  - `noteId`: The ID of the note to retrieve. It can be found as `_id` in the note docs. It always starts with `note:`.
40
- 2. **`search-notes`**: List all notes that contain a given keyword.
16
+ - Optional inputs:
17
+ - `includeTemplate`: When `true` and the note has a `sourceTemplateId`, also fetch that template and embed its body (fill-out instructions and examples) as an extra text block. Default: `false`.
18
+ - Note: If the note was created from a template, the response includes a resource link to its source template, whose body holds the fill-out instructions and examples.
19
+ 2. **`read-backlinks`**: Retrieve backlinks for a note — the notes that link to it.
20
+ - Required inputs:
21
+ - `noteId`: The ID of the note to find backlinks for. It always starts with `note:`.
22
+ - Note: Each result is returned as a resource link (`inkdrop://note/<id>`) pointing to the referring note. Backlinks are found by searching all note bodies for the note's link URI.
23
+ 3. **`search-notes`**: List all notes that contain a given keyword.
41
24
  - Required inputs:
42
25
  - `keyword`: Keyword to search for.
43
26
  - Note: Results include truncated note bodies (200 characters). Use `read-note` to get full content.
44
27
  - Supports advanced search qualifiers like `book:`, `tag:`, `status:`, `title:`, etc.
45
- 3. **`list-notes`**: List all notes with specified conditions.
28
+ 4. **`list-notes`**: List all notes with specified conditions.
46
29
  - Required inputs:
47
30
  - `bookId`: The notebook ID. It always starts with 'book:'.
48
31
  - Optional inputs:
@@ -51,7 +34,7 @@ A [Model Context Protocol](https://github.com/modelcontextprotocol) server for t
51
34
  - `sort`: Sort field (`updatedAt`, `createdAt`, or `title`). Default: `updatedAt`.
52
35
  - `descending`: Reverse the order of output. Default: `true`.
53
36
  - Note: Results include truncated note bodies (200 characters). Use `read-note` to get full content.
54
- 4. **`create-note`**: Create a new note in the database.
37
+ 5. **`create-note`**: Create a new note in the database.
55
38
  - Required inputs:
56
39
  - `bookId`: The notebook ID. Must start with 'book:' or be 'trash'.
57
40
  - `title`: The note title.
@@ -59,7 +42,7 @@ A [Model Context Protocol](https://github.com/modelcontextprotocol) server for t
59
42
  - Optional inputs:
60
43
  - `status`: The note status (`none`, `active`, `onHold`, `completed`, `dropped`).
61
44
  - `tags`: An array of tag IDs to assign to the note. Each must start with 'tag:'.
62
- 5. **`update-note`**: Update an existing note in the database. Only the fields you provide will be updated; omitted fields remain unchanged.
45
+ 6. **`update-note`**: Update an existing note in the database. Only the fields you provide will be updated; omitted fields remain unchanged.
63
46
  - Required inputs:
64
47
  - `_id`: The note ID. Must start with 'note:'.
65
48
  - `_rev`: The revision ID (CouchDB MVCC-token).
@@ -69,32 +52,59 @@ A [Model Context Protocol](https://github.com/modelcontextprotocol) server for t
69
52
  - `body`: The content of the note in Markdown.
70
53
  - `status`: The note status (`none`, `active`, `onHold`, `completed`, `dropped`).
71
54
  - `tags`: An array of tag IDs to assign to the note. Each must start with 'tag:'.
72
- 6. **`patch-note`**: Update the body of an existing note by performing an exact string replacement. More efficient than `update-note` for small edits to large notes as it saves tokens. You must first read the note with `read-note` to get the current body.
55
+ 7. **`patch-note`**: Update the body of an existing note by performing an exact string replacement. More efficient than `update-note` for small edits to large notes as it saves tokens. You must first read the note with `read-note` to get the current body.
73
56
  - Required inputs:
74
57
  - `_id`: The note ID. Must start with 'note:'.
75
58
  - `_rev`: The revision ID (CouchDB MVCC-token).
76
59
  - `old_string`: The exact text to find in the note body. Must match exactly one occurrence. Include enough surrounding context to ensure a unique match.
77
60
  - `new_string`: The text to replace `old_string` with. Use an empty string to delete the matched text.
78
- 7. **`list-notebooks`**: Retrieve a list of all notebooks.
79
- 8. **`read-book`**: Retrieve a single notebook by its ID.
61
+ 8. **`list-notebooks`**: Retrieve a list of all notebooks.
62
+ 9. **`read-book`**: Retrieve a single notebook by its ID.
80
63
  - Required inputs:
81
64
  - `bookId`: The notebook ID. Must start with 'book:'.
82
- 9. **`list-tags`**: Retrieve a list of all tags.
83
- 10. **`read-tag`**: Retrieve a single tag by its ID.
65
+ 10. **`create-book`**: Create a new notebook in the database.
66
+ - Required inputs:
67
+ - `name`: The notebook name.
68
+ - Optional inputs:
69
+ - `parentBookId`: The ID of the parent notebook. Must start with 'book:'. Omit it to create the notebook at the root level.
70
+ 11. **`update-book`**: Update an existing notebook in the database. Only the fields you provide will be updated; omitted fields remain unchanged, so you don't need to read the notebook first.
71
+ - Required inputs:
72
+ - `_id`: The notebook ID. Must start with 'book:'.
73
+ - Optional inputs:
74
+ - `_rev`: The revision ID (CouchDB MVCC-token). Only needed as an optimistic-concurrency guard — pass it to make the update fail on a conflicting concurrent edit.
75
+ - `name`: The notebook name.
76
+ - `parentBookId`: The ID of the parent notebook. Pass `null` to move the notebook to the root level.
77
+ 12. **`list-tags`**: Retrieve a list of all tags.
78
+ 13. **`read-tag`**: Retrieve a single tag by its ID.
84
79
  - Required inputs:
85
80
  - `tagId`: The tag ID. Must start with 'tag:'.
86
- 11. **`create-tag`**: Create a new tag in the database.
81
+ 14. **`create-tag`**: Create a new tag in the database.
87
82
  - Required inputs:
88
83
  - `name`: The name of the tag.
89
84
  - Optional inputs:
90
85
  - `color`: The color type of the tag (`default`, `red`, `orange`, `yellow`, `olive`, `green`, `teal`, `blue`, `violet`, `purple`, `pink`, `brown`, `grey`, `black`). Default: `default`.
91
- 12. **`update-tag`**: Update an existing tag in the database.
86
+ 15. **`update-tag`**: Update an existing tag in the database. Only the fields you provide will be updated; omitted fields remain unchanged, so you don't need to read the tag first.
92
87
  - Required inputs:
93
88
  - `_id`: The tag ID. Must start with 'tag:'.
94
- - `_rev`: The revision ID (CouchDB MVCC-token).
89
+ - Optional inputs:
90
+ - `_rev`: The revision ID (CouchDB MVCC-token). Only needed as an optimistic-concurrency guard — pass it to make the update fail on a conflicting concurrent edit.
95
91
  - `name`: The name of the tag.
92
+ - `color`: The color type of the tag. Omit it to keep the tag's current color.
93
+ 16. **`create-file`**: Create a new attachment file in the database from a local image file or from base64 image data. Returns the Markdown to embed the attachment in a note body.
94
+ - Required inputs: exactly one of
95
+ - `filePath`: Absolute path to a local image file to attach. Preferred — it keeps the image bytes out of the conversation.
96
+ - `data`: Base64-encoded image data, without a `data:` URI prefix.
97
+ - Optional inputs:
98
+ - `name`: The file name. Defaults to the file name of `filePath`, or `image.<ext>` when `data` is given.
99
+ - `contentType`: The MIME type (`image/png`, `image/jpeg`, `image/jpg`, `image/svg+xml`, `image/gif`, `image/heic`, `image/heif`). Inferred from the `filePath` extension when omitted, so it is required with `data`.
100
+ - `publicIn`: An array of note IDs where the attachment is included. Each must start with 'note:'.
101
+ - Note: Attachments are limited to 10MB.
102
+ 17. **`read-file`**: Retrieve an attachment file by its ID. Returns the file metadata, and the image itself when it is a PNG, JPEG or GIF.
103
+ - Required inputs:
104
+ - `fileId`: The attachment ID. Must start with 'file:'.
96
105
  - Optional inputs:
97
- - `color`: The color type of the tag. Default: `default`.
106
+ - `outputPath`: Absolute path to write the attachment to. When given, the file is saved there and its bytes are not returned inline. Required to get at SVG, HEIC and HEIF attachments, which cannot be displayed inline.
107
+ - `includeImage`: Whether to return the image alongside the metadata. Default: `true`. Set to `false` to fetch only the metadata of a large attachment.
98
108
 
99
109
  ## Debugging
100
110
 
package/Session.vim ADDED
@@ -0,0 +1,122 @@
1
+ let SessionLoad = 1
2
+ let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
3
+ let v:this_session=expand("<sfile>:p")
4
+ doautoall SessionLoadPre
5
+ silent only
6
+ silent tabonly
7
+ cd ~/Developments/inkdrop/mcp-server
8
+ if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
9
+ let s:wipebuf = bufnr('%')
10
+ endif
11
+ let s:shortmess_save = &shortmess
12
+ set shortmess+=aoO
13
+ badd +34 package.json
14
+ badd +79 src/index.ts
15
+ badd +258 node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts
16
+ badd +6 src/utils.ts
17
+ argglobal
18
+ %argdel
19
+ $argadd package.json
20
+ edit src/index.ts
21
+ let s:save_splitbelow = &splitbelow
22
+ let s:save_splitright = &splitright
23
+ set splitbelow splitright
24
+ wincmd _ | wincmd |
25
+ vsplit
26
+ wincmd _ | wincmd |
27
+ vsplit
28
+ 2wincmd h
29
+ wincmd w
30
+ wincmd w
31
+ let &splitbelow = s:save_splitbelow
32
+ let &splitright = s:save_splitright
33
+ wincmd t
34
+ let s:save_winminheight = &winminheight
35
+ let s:save_winminwidth = &winminwidth
36
+ set winminheight=0
37
+ set winheight=1
38
+ set winminwidth=0
39
+ set winwidth=1
40
+ exe 'vert 1resize ' . ((&columns * 153 + 230) / 460)
41
+ exe 'vert 2resize ' . ((&columns * 153 + 230) / 460)
42
+ exe 'vert 3resize ' . ((&columns * 152 + 230) / 460)
43
+ argglobal
44
+ balt package.json
45
+ setlocal foldmethod=expr
46
+ setlocal foldexpr=nvim_treesitter#foldexpr()
47
+ setlocal foldmarker={{{,}}}
48
+ setlocal foldignore=#
49
+ setlocal foldlevel=99
50
+ setlocal foldminlines=1
51
+ setlocal foldnestmax=20
52
+ setlocal foldenable
53
+ let s:l = 79 - ((41 * winheight(0) + 40) / 81)
54
+ if s:l < 1 | let s:l = 1 | endif
55
+ keepjumps exe s:l
56
+ normal! zt
57
+ keepjumps 79
58
+ normal! 031|
59
+ wincmd w
60
+ argglobal
61
+ if bufexists(fnamemodify("src/index.ts", ":p")) | buffer src/index.ts | else | edit src/index.ts | endif
62
+ if &buftype ==# 'terminal'
63
+ silent file src/index.ts
64
+ endif
65
+ balt package.json
66
+ setlocal foldmethod=expr
67
+ setlocal foldexpr=nvim_treesitter#foldexpr()
68
+ setlocal foldmarker={{{,}}}
69
+ setlocal foldignore=#
70
+ setlocal foldlevel=99
71
+ setlocal foldminlines=1
72
+ setlocal foldnestmax=20
73
+ setlocal foldenable
74
+ let s:l = 389 - ((37 * winheight(0) + 40) / 81)
75
+ if s:l < 1 | let s:l = 1 | endif
76
+ keepjumps exe s:l
77
+ normal! zt
78
+ keepjumps 389
79
+ normal! 010|
80
+ wincmd w
81
+ argglobal
82
+ if bufexists(fnamemodify("package.json", ":p")) | buffer package.json | else | edit package.json | endif
83
+ if &buftype ==# 'terminal'
84
+ silent file package.json
85
+ endif
86
+ balt src/index.ts
87
+ setlocal foldmethod=expr
88
+ setlocal foldexpr=nvim_treesitter#foldexpr()
89
+ setlocal foldmarker={{{,}}}
90
+ setlocal foldignore=#
91
+ setlocal foldlevel=99
92
+ setlocal foldminlines=1
93
+ setlocal foldnestmax=20
94
+ setlocal foldenable
95
+ let s:l = 34 - ((33 * winheight(0) + 40) / 81)
96
+ if s:l < 1 | let s:l = 1 | endif
97
+ keepjumps exe s:l
98
+ normal! zt
99
+ keepjumps 34
100
+ normal! 025|
101
+ wincmd w
102
+ exe 'vert 1resize ' . ((&columns * 153 + 230) / 460)
103
+ exe 'vert 2resize ' . ((&columns * 153 + 230) / 460)
104
+ exe 'vert 3resize ' . ((&columns * 152 + 230) / 460)
105
+ tabnext 1
106
+ if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
107
+ silent exe 'bwipe ' . s:wipebuf
108
+ endif
109
+ unlet! s:wipebuf
110
+ set winheight=1 winwidth=20
111
+ let &shortmess = s:shortmess_save
112
+ let &winminheight = s:save_winminheight
113
+ let &winminwidth = s:save_winminwidth
114
+ let s:sx = expand("<sfile>:p:r")."x.vim"
115
+ if filereadable(s:sx)
116
+ exe "source " . fnameescape(s:sx)
117
+ endif
118
+ let &g:so = s:so_save | let &g:siso = s:siso_save
119
+ set hlsearch
120
+ doautoall SessionLoadPost
121
+ unlet SessionLoad
122
+ " vim: set ft=vim :
package/dist/api.js CHANGED
@@ -6,10 +6,10 @@ exports.postJSON = postJSON;
6
6
  const config = {
7
7
  baseUrl: process.env.INKDROP_LOCAL_SERVER_URL,
8
8
  username: process.env.INKDROP_LOCAL_USERNAME,
9
- password: process.env.INKDROP_LOCAL_PASSWORD,
9
+ password: process.env.INKDROP_LOCAL_PASSWORD
10
10
  };
11
11
  function getAuthHeaders() {
12
- const token = Buffer.from(`${config.username}:${config.password}`).toString("base64");
12
+ const token = Buffer.from(`${config.username}:${config.password}`).toString('base64');
13
13
  return {
14
14
  Authorization: `Basic ${token}`
15
15
  };
@@ -28,20 +28,20 @@ async function fetchJSON(path, qs = {}) {
28
28
  if (!resp.ok) {
29
29
  throw new Error(`Fetch error [${resp.status}] ${resp.statusText}`);
30
30
  }
31
- return await resp.json();
31
+ return (await resp.json());
32
32
  }
33
33
  async function postJSON(path, body) {
34
34
  const url = buildUrl(path);
35
35
  const resp = await fetch(url, {
36
- method: "POST",
36
+ method: 'POST',
37
37
  headers: {
38
38
  ...getAuthHeaders(),
39
- "Content-Type": "application/json"
39
+ 'Content-Type': 'application/json'
40
40
  },
41
41
  body: JSON.stringify(body)
42
42
  });
43
43
  if (!resp.ok) {
44
44
  throw new Error(`Fetch error [${resp.status}] ${resp.statusText}`);
45
45
  }
46
- return await resp.json();
46
+ return (await resp.json());
47
47
  }