@noesis-brain/mcp-server 2.0.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +218 -0
  3. package/dist/api/NoesisClient.d.ts +501 -0
  4. package/dist/api/NoesisClient.d.ts.map +1 -0
  5. package/dist/api/NoesisClient.js +654 -0
  6. package/dist/api/NoesisClient.js.map +1 -0
  7. package/dist/cli/setup.d.ts +8 -0
  8. package/dist/cli/setup.d.ts.map +1 -0
  9. package/dist/cli/setup.js +148 -0
  10. package/dist/cli/setup.js.map +1 -0
  11. package/dist/database/PostgresAdapter.d.ts +385 -0
  12. package/dist/database/PostgresAdapter.d.ts.map +1 -0
  13. package/dist/database/PostgresAdapter.js +1043 -0
  14. package/dist/database/PostgresAdapter.js.map +1 -0
  15. package/dist/index.d.ts +31 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +126 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/services/embedding.d.ts +38 -0
  20. package/dist/services/embedding.d.ts.map +1 -0
  21. package/dist/services/embedding.js +126 -0
  22. package/dist/services/embedding.js.map +1 -0
  23. package/dist/tools/SyncStateManager.d.ts +65 -0
  24. package/dist/tools/SyncStateManager.d.ts.map +1 -0
  25. package/dist/tools/SyncStateManager.js +217 -0
  26. package/dist/tools/SyncStateManager.js.map +1 -0
  27. package/dist/tools/index.d.ts +14 -0
  28. package/dist/tools/index.d.ts.map +1 -0
  29. package/dist/tools/index.js +3345 -0
  30. package/dist/tools/index.js.map +1 -0
  31. package/dist/tools/navis.d.ts +11 -0
  32. package/dist/tools/navis.d.ts.map +1 -0
  33. package/dist/tools/navis.js +231 -0
  34. package/dist/tools/navis.js.map +1 -0
  35. package/dist/types/index.d.ts +104 -0
  36. package/dist/types/index.d.ts.map +1 -0
  37. package/dist/types/index.js +5 -0
  38. package/dist/types/index.js.map +1 -0
  39. package/dist/utils/suggestPath.d.ts +15 -0
  40. package/dist/utils/suggestPath.d.ts.map +1 -0
  41. package/dist/utils/suggestPath.js +52 -0
  42. package/dist/utils/suggestPath.js.map +1 -0
  43. package/package.json +71 -0
  44. package/scripts/noesis-sync.mjs +469 -0
  45. package/skill-templates/noesis-refine-note.md +92 -0
  46. package/skill-templates/noesis-sync.md +110 -0
  47. package/templates/claude-md-block.md +22 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Noesis
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,218 @@
1
+ # Noesis MCP Server
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@noesis-brain/mcp-server.svg)](https://www.npmjs.com/package/@noesis-brain/mcp-server)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![MCP](https://img.shields.io/badge/MCP-Model%20Context%20Protocol-blue)](https://modelcontextprotocol.io/)
6
+
7
+ Official [Model Context Protocol](https://modelcontextprotocol.io/) server for [Noesis](https://noesisbrain.com) — bring your personal knowledge base into Claude Code. Search, sync, and manage your markdown notes via 19 AI-powered tools.
8
+
9
+ ## What This Is
10
+
11
+ Noesis is a personal knowledge management system: you write markdown notes locally, sync them to the cloud, and chat with them through AI assistants. This MCP server is the bridge between [Claude Code](https://claude.com/claude-code) (or any MCP-compatible client) and your Noesis knowledge base.
12
+
13
+ Once installed and configured, you can ask Claude things like:
14
+ - *"Find my notes about authentication architecture"*
15
+ - *"Show me the version history of `~/Noesis/projects/server-redesign.md`"*
16
+ - *"Sync my local notes with Noesis cloud and resolve any conflicts"*
17
+ - *"Generate AI metadata for the 12 notes I edited this week"*
18
+
19
+ The server is a thin HTTP client to the Noesis cloud API — your data lives in your Noesis account, not in this server.
20
+
21
+ ## Prerequisites
22
+
23
+ - **Node.js 18+**
24
+ - A **Noesis account** at [noesisbrain.com](https://noesisbrain.com) (free tier works)
25
+ - **[Claude Code](https://claude.com/claude-code)** (or another MCP-compatible client like Claude Desktop)
26
+
27
+ ## Quick Start
28
+
29
+ ### 1. Generate your Noesis API token
30
+
31
+ 1. Sign in at [https://noesisbrain.com](https://noesisbrain.com)
32
+ 2. Go to **Settings → API Tokens**
33
+ 3. Click **Generate Token**, copy the value (it looks like `noe_...`)
34
+
35
+ ### 2. Install the MCP server
36
+
37
+ **Recommended: via npm (global install):**
38
+
39
+ ```bash
40
+ npm install -g @noesis-brain/mcp-server
41
+ ```
42
+
43
+ **Alternative: clone and build:**
44
+
45
+ ```bash
46
+ git clone https://github.com/noesis-brain/mcp-server.git
47
+ cd mcp-server
48
+ npm install
49
+ npm run build
50
+ ```
51
+
52
+ ### 3. Register with Claude Code
53
+
54
+ ```bash
55
+ claude mcp add noesis --scope user \
56
+ --env NOESIS_API_TOKEN="noe_your_token_here" \
57
+ --env NOESIS_API_URL="https://noesisbrain.com" \
58
+ --env GEMINI_API_KEY="optional_for_semantic_search" \
59
+ -- noesis-mcp
60
+ ```
61
+
62
+ If you cloned and built locally instead of installing via npm, replace `-- noesis-mcp` with `-- node /path/to/mcp-server/dist/index.js`.
63
+
64
+ ### 4. Restart Claude Code
65
+
66
+ The MCP server loads at session start, so restart the Claude Code CLI (`Ctrl+C` then `claude` again, or restart the IDE extension).
67
+
68
+ You're done. Try `"List my recent Noesis notes"` in Claude Code to verify.
69
+
70
+ ## Configuration
71
+
72
+ | Environment variable | Required | Description |
73
+ |---|---|---|
74
+ | `NOESIS_API_TOKEN` | Yes | Your token from `noesisbrain.com → Settings → API Tokens`. Format: `noe_...`. |
75
+ | `NOESIS_API_URL` | Yes | The Noesis API origin. Production: `https://noesisbrain.com`. Local dev: `http://localhost:5555`. |
76
+ | `GEMINI_API_KEY` | No | Google Gemini API key for semantic-search features. Without it, semantic search falls back to keyword search. Get a key at [aistudio.google.com](https://aistudio.google.com/). |
77
+
78
+ API tokens expire after 90 days. Generate a fresh one and update the env block to renew.
79
+
80
+ ## Features
81
+
82
+ The server exposes 19 MCP tools, grouped by domain:
83
+
84
+ ### Notes — search + retrieval
85
+
86
+ - `search_notes` — keyword search across all your notes (BM25-ranked)
87
+ - `search_semantic` — vector-similarity search (requires `GEMINI_API_KEY`)
88
+ - `get_note` — fetch a note by file path or ID (full content + metadata)
89
+ - `list_notes` — list notes with filters (root, recency, catalog, signal markers like favorite / pinned)
90
+ - `list_notes_needing_enhancement` — find notes where AI-generated metadata is missing or stale
91
+ - `list_edited_online_notes` — find notes edited via the Noesis web UI's Quick Fix that haven't been pulled back to local disk
92
+ - `find_similar_notes` — semantic-similarity neighbors of a given note
93
+ - `get_bookmark_context` — read the paragraphs surrounding a `#bm=` bookmark URL
94
+
95
+ ### Notes — write + management
96
+
97
+ - `sync_notes` — bidirectional sync between local disk and Noesis cloud, with conflict resolution
98
+ - `enhance_note_metadata` — regenerate AI title / description / keywords for a note
99
+ - `move_note` — move a note's file path
100
+ - `trash_note` — soft-delete (recoverable)
101
+ - `set_note_catalogs` — assign catalog tags
102
+ - `set_note_related_codes` — link a note to codebases via the codebase registry
103
+ - `update_relations` — auto-detect and update inter-note relations
104
+ - `update_signals` — set favorite / pinned / importance / quality scores
105
+ - `rate_importance`, `rate_quality` — AI-assisted scoring
106
+
107
+ ### Roots + codebases
108
+
109
+ - `list_roots` — list watched directories
110
+ - `add_root` — register a new directory to watch
111
+ - `list_codebases`, `create_codebase`, `get_codebase`, `update_codebase`, `delete_codebase`, `find_or_create_codebase` — manage the codebase registry (file-path-to-project mappings for `related_codes`)
112
+ - `search_by_related_code` — find all notes linked to a given codebase
113
+
114
+ ### Catalogs + relations
115
+
116
+ - `list_catalogs` — list user-defined catalog tags
117
+ - `get_relation_graph` — return the note-to-note relation graph
118
+
119
+ ### Navis (AI agents)
120
+
121
+ - `list_navis`, `create_navi`, `get_navi`, `update_navi`, `delete_navi`, `duplicate_navi`, `search_navis` — manage custom AI personas
122
+ - `get_chat_session` — retrieve a Navi chat conversation by ID
123
+
124
+ ### Chat + history
125
+
126
+ - `analyze_knowledge_base` — generate a summary report of your note collection
127
+ - `generate_embeddings` — backfill vector embeddings for notes that lack them
128
+
129
+ ### News + bookmarks
130
+
131
+ - `add_news_source`, `get_news_preferences`, `update_news_preferences` — configure the Noesis Daily News tool's feeds
132
+ - `sync_status` — get sync state across all watched roots
133
+
134
+ Full tool schemas (parameters, return types) are available via Claude Code's MCP discovery (`/mcp` then click the noesis server).
135
+
136
+ ## Usage Examples
137
+
138
+ After installation, try these in Claude Code:
139
+
140
+ ```
141
+ "Search my Noesis notes for 'OAuth flow'"
142
+ "Show me notes I edited online via Quick Fix but haven't pulled to disk yet"
143
+ "What does the bookmark at https://noesisbrain.com/notes/2312#bm=384e924d look like?"
144
+ "Sync the notes under C:/Users/me/Noesis/projects/"
145
+ "Enhance the metadata for any notes touched today"
146
+ "Find notes semantically similar to the one I just opened"
147
+ ```
148
+
149
+ ## Development
150
+
151
+ ### Build
152
+
153
+ ```bash
154
+ npm install
155
+ npm run build
156
+ ```
157
+
158
+ ### Watch mode
159
+
160
+ ```bash
161
+ npm run dev
162
+ ```
163
+
164
+ ### Architecture
165
+
166
+ ```
167
+ src/
168
+ ├── index.ts # Entry point + MCP server init
169
+ ├── api/NoesisClient.ts # HTTP client for Noesis cloud API
170
+ ├── tools/
171
+ │ ├── index.ts # MCP tool registrations (19 tools)
172
+ │ ├── navis.ts # Navi management tools
173
+ │ └── SyncStateManager.ts # Bidirectional sync state tracking
174
+ ├── services/embedding.ts # Gemini embedding helper for semantic search
175
+ ├── cli/setup.ts # `noesis-mcp setup` subcommand
176
+ ├── types/index.ts # Shared TypeScript types
177
+ └── utils/suggestPath.ts # Path-completion helpers
178
+
179
+ scripts/
180
+ └── noesis-sync.mjs # Standalone sync script (zero deps, Node 18+)
181
+
182
+ skill-templates/ # Claude Code skill templates
183
+ templates/ # Markdown templates injected into notes
184
+ ```
185
+
186
+ The server is a thin client — almost all logic lives behind the Noesis cloud API. This makes the server safe to run in untrusted environments (no DB access, no file writes outside the user's notes folder).
187
+
188
+ ## Troubleshooting
189
+
190
+ ### "No API token provided"
191
+
192
+ Your `NOESIS_API_TOKEN` env var isn't being passed to the MCP server. Re-run the `claude mcp add` command from Quick Start step 3 with the `--env NOESIS_API_TOKEN=noe_...` flag. Restart Claude Code.
193
+
194
+ ### "fetch failed"
195
+
196
+ Usually means `NOESIS_API_URL` is wrong or unreachable. Confirm `https://noesisbrain.com` loads in your browser. If you're on a local Noesis instance, set `NOESIS_API_URL=http://localhost:5555` instead.
197
+
198
+ ### Token expired
199
+
200
+ Noesis API tokens expire 90 days after creation. Generate a fresh token at `noesisbrain.com → Settings → API Tokens`, then update the env var. Old token rows on the web UI show "Expired" status.
201
+
202
+ ### `noesis-mcp` command not found after `npm install -g`
203
+
204
+ The npm global bin directory isn't on your `PATH`. Run `npm bin -g` to find the path, then add it to your shell config (`~/.bashrc` / `~/.zshrc` / Windows Environment Variables).
205
+
206
+ ### MCP tool calls work but no semantic search
207
+
208
+ Set `GEMINI_API_KEY` in the env block. Without it, `search_semantic` silently falls back to keyword search.
209
+
210
+ ## Contributing
211
+
212
+ Bug reports and pull requests welcome. For major changes, open an issue first to discuss what you'd like to change.
213
+
214
+ This server is the public-facing component of [Noesis](https://noesisbrain.com); the main app stays closed-source. PRs that change the MCP protocol contract (tool signatures, response shapes) need coordination with the backend — flag them in the issue first.
215
+
216
+ ## License
217
+
218
+ [MIT](LICENSE) — Copyright (c) 2026 Noesis