obsidian-mcp-server 2.0.4 → 2.0.6

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 (44) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +80 -88
  3. package/dist/mcp-server/server.js +8 -8
  4. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/index.d.ts +4 -4
  5. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/index.js +4 -4
  6. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/logic.d.ts +9 -9
  7. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/logic.js +6 -6
  8. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/registration.d.ts +2 -2
  9. package/dist/mcp-server/tools/{obsidianDeleteFileTool → obsidianDeleteNoteTool}/registration.js +12 -12
  10. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/index.d.ts +4 -4
  11. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/index.js +4 -4
  12. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/logic.d.ts +10 -10
  13. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/logic.js +14 -13
  14. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/registration.d.ts +4 -4
  15. package/dist/mcp-server/tools/{obsidianListFilesTool → obsidianListNotesTool}/registration.js +14 -14
  16. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/index.d.ts +4 -4
  17. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/index.js +4 -4
  18. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/logic.d.ts +9 -9
  19. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/logic.js +8 -8
  20. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/registration.d.ts +2 -2
  21. package/dist/mcp-server/tools/{obsidianReadFileTool → obsidianReadNoteTool}/registration.js +12 -12
  22. package/dist/mcp-server/tools/{obsidianUpdateFileTool → obsidianUpdateNoteTool}/index.d.ts +4 -4
  23. package/dist/mcp-server/tools/{obsidianUpdateFileTool → obsidianUpdateNoteTool}/index.js +4 -4
  24. package/dist/mcp-server/tools/{obsidianUpdateFileTool → obsidianUpdateNoteTool}/logic.d.ts +8 -8
  25. package/dist/mcp-server/tools/{obsidianUpdateFileTool → obsidianUpdateNoteTool}/logic.js +7 -7
  26. package/dist/mcp-server/tools/{obsidianUpdateFileTool → obsidianUpdateNoteTool}/registration.d.ts +2 -2
  27. package/dist/mcp-server/tools/{obsidianUpdateFileTool → obsidianUpdateNoteTool}/registration.js +13 -13
  28. package/dist/mcp-server/transports/{authentication → auth/core}/authContext.d.ts +2 -2
  29. package/dist/mcp-server/transports/{authentication → auth/core}/authContext.js +1 -1
  30. package/dist/mcp-server/transports/{authentication/types.d.ts → auth/core/authTypes.d.ts} +1 -1
  31. package/dist/mcp-server/transports/{authentication/types.js → auth/core/authTypes.js} +1 -1
  32. package/dist/mcp-server/transports/{authentication → auth/core}/authUtils.d.ts +1 -1
  33. package/dist/mcp-server/transports/{authentication → auth/core}/authUtils.js +3 -3
  34. package/dist/mcp-server/transports/auth/index.d.ts +10 -0
  35. package/dist/mcp-server/transports/auth/index.js +9 -0
  36. package/dist/mcp-server/transports/{authentication/authMiddleware.d.ts → auth/strategies/jwt/jwtMiddleware.d.ts} +4 -7
  37. package/dist/mcp-server/transports/{authentication/authMiddleware.js → auth/strategies/jwt/jwtMiddleware.js} +40 -36
  38. package/dist/mcp-server/transports/{authentication → auth/strategies/oauth}/oauthMiddleware.d.ts +2 -6
  39. package/dist/mcp-server/transports/{authentication → auth/strategies/oauth}/oauthMiddleware.js +33 -18
  40. package/dist/mcp-server/transports/httpErrorHandler.d.ts +26 -0
  41. package/dist/mcp-server/transports/httpErrorHandler.js +73 -0
  42. package/dist/mcp-server/transports/httpTransport.d.ts +11 -14
  43. package/dist/mcp-server/transports/httpTransport.js +91 -379
  44. package/package.json +14 -19
package/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.6] - 2025-06-20
9
+
10
+ ### Changed
11
+
12
+ - **Tool Renaming**: Renamed `obsidian_read_file`, `obsidian_delete_file`, and `obsidian_list_files` to `obsidian_read_note`, `obsidian_delete_note`, and `obsidian_list_notes` respectively. This change improves semantic clarity and aligns the tool names more closely with Obsidian's terminology, reducing ambiguity for AI agents.
13
+ - **Dependency Updates**: Updated all dependencies to their latest versions.
14
+ - **Documentation Improvements**: Updated `.clinerules` to reflect the new tool names and ensure all documentation is current.
15
+
16
+ ## [2.0.5] - 2025-06-20
17
+
18
+ ### Changed
19
+
20
+ - **Tool Renaming**: Renamed the `obsidian_update_file` tool to `obsidian_update_note` to avoid conflicts and better reflect its function. During agentic use, LLMs confused this tool with filesystem operations, leading to errors. The new name clarifies that it operates on Obsidian notes specifically.
21
+ - **HTTP Transport Refactor**: Restructured the HTTP transport layer for improved clarity and robustness. Authentication logic is now more modular, and a centralized error handler has been implemented.
22
+ - **Dependency Updates**: Updated all dependencies to their latest versions.
23
+ - **Documentation Improvements**: Enhanced the documentation around installation & MCP Client configuration. Suggested by [@bgheneti](https://github.com/bgheneti) in [PR #14](https://github.com/cyanheads/obsidian-mcp-server/pull/14). Thanks!
24
+
8
25
  ## [2.0.4] - 2025-06-13
9
26
 
10
27
  ### Added
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Obsidian MCP Server
2
2
 
3
3
  [![TypeScript](https://img.shields.io/badge/TypeScript-^5.8.3-blue.svg)](https://www.typescriptlang.org/)
4
- [![Model Context Protocol](https://img.shields.io/badge/MCP%20SDK-^1.12.1-green.svg)](https://modelcontextprotocol.io/)
5
- [![Version](https://img.shields.io/badge/Version-2.0.3-blue.svg)](./CHANGELOG.md)
4
+ [![Model Context Protocol](https://img.shields.io/badge/MCP%20SDK-^1.13.0-green.svg)](https://modelcontextprotocol.io/)
5
+ [![Version](https://img.shields.io/badge/Version-2.0.6-blue.svg)](./CHANGELOG.md)
6
6
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
7
  [![Status](https://img.shields.io/badge/Status-Production-brightgreen.svg)](https://github.com/cyanheads/obsidian-mcp-server/issues)
8
8
  [![GitHub](https://img.shields.io/github/stars/cyanheads/obsidian-mcp-server?style=social)](https://github.com/cyanheads/obsidian-mcp-server)
@@ -20,7 +20,7 @@ This server equips your AI with specialized tools to interact with your Obsidian
20
20
  | Tool Name | Description | Key Features |
21
21
  | :------------------------------------------------------------------------------------- | :-------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |
22
22
  | [`obsidian_read_file`](./src/mcp-server/tools/obsidianReadFileTool/) | Retrieves the content and metadata of a specified file. | - Read in `markdown` or `json` format.<br/>- Case-insensitive path fallback.<br/>- Includes file stats (creation/modification time). |
23
- | [`obsidian_update_file`](./src/mcp-server/tools/obsidianUpdateFileTool/) | Modifies notes using whole-file operations. | - `append`, `prepend`, or `overwrite` content.<br/>- Can create files if they don't exist.<br/>- Targets files by path, active note, or periodic note. |
23
+ | [`obsidian_update_note`](./src/mcp-server/tools/obsidianUpdateNoteTool/) | Modifies notes using whole-file operations. | - `append`, `prepend`, or `overwrite` content.<br/>- Can create files if they don't exist.<br/>- Targets files by path, active note, or periodic note. |
24
24
  | [`obsidian_search_replace`](./src/mcp-server/tools/obsidianSearchReplaceTool/) | Performs search-and-replace operations within a target note. | - Supports string or regex search.<br/>- Options for case sensitivity, whole word, and replacing all occurrences. |
25
25
  | [`obsidian_global_search`](./src/mcp-server/tools/obsidianGlobalSearchTool/) | Performs a search across the entire vault. | - Text or regex search.<br/>- Filter by path and modification date.<br/>- Paginated results. |
26
26
  | [`obsidian_list_files`](./src/mcp-server/tools/obsidianListFilesTool/) | Lists files and subdirectories within a specified vault folder. | - Filter by file extension or name regex.<br/>- Provides a formatted tree view of the directory. |
@@ -32,8 +32,8 @@ This server equips your AI with specialized tools to interact with your Obsidian
32
32
 
33
33
  ## Table of Contents
34
34
 
35
- | [Overview](#overview) | [Features](#features) | [Installation](#installation) |
36
- | [Configuration](#configuration) | [Project Structure](#project-structure) | [Vault Cache Service](#vault-cache-service) |
35
+ | [Overview](#overview) | [Features](#features) | [Configuration](#configuration) |
36
+ | [Project Structure](#project-structure) | [Vault Cache Service](#vault-cache-service) |
37
37
  | [Tools](#tools) | [Resources](#resources) | [Development](#development) | [License](#license) |
38
38
 
39
39
  ## Overview
@@ -54,7 +54,7 @@ Built on the robust `mcp-ts-template`, this server provides a standardized, secu
54
54
 
55
55
  ### Core Utilities
56
56
 
57
- Leverages the robust utilities provided by the `mcp-ts-template`:
57
+ Leverages the robust utilities provided by `cyanheads/mcp-ts-template`:
58
58
 
59
59
  - **Logging**: Structured, configurable logging (file rotation, console, MCP notifications) with sensitive data redaction.
60
60
  - **Error Handling**: Centralized error processing, standardized error types (`McpError`), and automatic logging.
@@ -62,7 +62,7 @@ Leverages the robust utilities provided by the `mcp-ts-template`:
62
62
  - **Input Validation/Sanitization**: Uses `zod` for schema validation and custom sanitization logic.
63
63
  - **Request Context**: Tracking and correlation of operations via unique request IDs.
64
64
  - **Type Safety**: Strong typing enforced by TypeScript and Zod schemas.
65
- - **HTTP Transport Option**: Built-in Hono server with SSE, session management, CORS support, and JWT authentication.
65
+ - **HTTP Transport Option**: Built-in Hono server with SSE, session management, CORS support, and pluggable authentication strategies (JWT and OAuth 2.1).
66
66
 
67
67
  ### Obsidian Integration
68
68
 
@@ -82,52 +82,73 @@ Leverages the robust utilities provided by the `mcp-ts-template`:
82
82
  3. **API Key**: Configure an API key within the Local REST API plugin settings in Obsidian. You will need this key to configure the server.
83
83
  4. **Node.js & npm**: Ensure you have Node.js (v18 or later recommended) and npm installed.
84
84
 
85
- ### Install via npm (Recommended)
85
+ ## Configuration
86
86
 
87
- ```bash
88
- npm install obsidian-mcp-server
89
- ```
87
+ ### MCP Client Settings
90
88
 
91
- ### Install from Source
92
-
93
- 1. Clone the repository:
94
- ```bash
95
- git clone https://github.com/cyanheads/obsidian-mcp-server.git
96
- cd obsidian-mcp-server
97
- ```
98
- 2. Install dependencies:
99
- ```bash
100
- npm install
101
- ```
102
- 3. Build the project:
103
- ```bash
104
- npm run build
105
- ```
106
- This compiles the TypeScript code to JavaScript in the `dist/` directory and makes the entry point executable.
89
+ Add the following to your MCP client's configuration file (e.g., `cline_mcp_settings.json`). This configuration uses `npx` to run the server, which will automatically download & install the package if not already present:
107
90
 
108
- ## Configuration
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "obsidian-mcp-server": {
95
+ "command": "npx",
96
+ "args": ["obsidian-mcp-server"],
97
+ "env": {
98
+ "OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
99
+ "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
100
+ "OBSIDIAN_VERIFY_SSL": "false",
101
+ "OBSIDIAN_ENABLE_CACHE": "true"
102
+ },
103
+ "disabled": false,
104
+ "autoApprove": []
105
+ }
106
+ }
107
+ }
108
+ ```
109
109
 
110
- ### Environment Variables
110
+ **Note**: Verify SSL is set to false here because the Obsidian Local REST API plugin uses a self-signed certificate by default. If you are deploying this in a production environment, consider using the encrypted HTTPS endpoint and set `OBSIDIAN_VERIFY_SSL` to `true` after configuring your server to trust the self-signed certificate.
111
111
 
112
- Configure the server using environment variables.
112
+ If you installed from source, change `command` and `args` to point to your local build:
113
113
 
114
- These variables must be set in the MCP client configuration (e.g., `cline_mcp_settings.json`) or in your environment before starting the server (if running directly).
114
+ ```json
115
+ {
116
+ "mcpServers": {
117
+ "obsidian-mcp-server": {
118
+ "command": "node",
119
+ "args": ["/path/to/your/obsidian-mcp-server/dist/index.js"],
120
+ "env": {
121
+ "OBSIDIAN_API_KEY": "YOUR_OBSIDIAN_API_KEY",
122
+ "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
123
+ "OBSIDIAN_VERIFY_SSL": "false",
124
+ "OBSIDIAN_ENABLE_CACHE": "true"
125
+ }
126
+ }
127
+ }
128
+ }
129
+ ```
115
130
 
116
- If running directly, they can be set in a `.env` file in the project root or directly in your environment.
131
+ ### Environment Variables
117
132
 
118
- | Variable | Description | Required | Default |
119
- | :------------------------------------ | :-------------------------------------------------------- | :---------------- | :----------------------- |
120
- | **`OBSIDIAN_API_KEY`** | API Key from the Obsidian Local REST API plugin. | **Yes** | `undefined` |
121
- | **`OBSIDIAN_BASE_URL`** | Base URL of your Obsidian Local REST API. | **Yes** | `http://127.0.0.1:27123` |
122
- | `MCP_TRANSPORT_TYPE` | Server transport: `stdio` or `http`. | No | `stdio` |
123
- | `MCP_HTTP_PORT` | Port for the HTTP server. | No | `3010` |
124
- | `MCP_HTTP_HOST` | Host for the HTTP server. | No | `127.0.0.1` |
125
- | `MCP_ALLOWED_ORIGINS` | Comma-separated origins for CORS. **Set for production.** | No | (none) |
126
- | **`MCP_AUTH_SECRET_KEY`** | 32+ char secret for JWT auth. **Required for HTTP.** | **Yes (if HTTP)** | `undefined` |
127
- | `MCP_LOG_LEVEL` | Logging level (`debug`, `info`, `error`, etc.). | No | `info` |
128
- | `OBSIDIAN_VERIFY_SSL` | Set to `false` to disable SSL verification. | No | `true` |
129
- | `OBSIDIAN_ENABLE_CACHE` | Set to `true` to enable the in-memory vault cache. | No | `true` |
130
- | `OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN` | Refresh interval for the vault cache in minutes. | No | `10` |
133
+ Configure the server using environment variables. These environmental variables are set within your MCP client config/settings (e.g. `cline_mcp_settings.json` for Cline, `claude_desktop_config.json` for Claude Desktop).
134
+
135
+ | Variable | Description | Required | Default |
136
+ | :------------------------------------ | :----------------------------------------------------------------------- | :------------------- | :----------------------- |
137
+ | **`OBSIDIAN_API_KEY`** | API Key from the Obsidian Local REST API plugin. | **Yes** | `undefined` |
138
+ | **`OBSIDIAN_BASE_URL`** | Base URL of your Obsidian Local REST API. | **Yes** | `http://127.0.0.1:27123` |
139
+ | `MCP_TRANSPORT_TYPE` | Server transport: `stdio` or `http`. | No | `stdio` |
140
+ | `MCP_HTTP_PORT` | Port for the HTTP server. | No | `3010` |
141
+ | `MCP_HTTP_HOST` | Host for the HTTP server. | No | `127.0.0.1` |
142
+ | `MCP_ALLOWED_ORIGINS` | Comma-separated origins for CORS. **Set for production.** | No | (none) |
143
+ | `MCP_AUTH_MODE` | Authentication strategy: `jwt` or `oauth`. | No | (none) |
144
+ | **`MCP_AUTH_SECRET_KEY`** | 32+ char secret for JWT. **Required for `jwt` mode.** | **Yes (if `jwt`)** | `undefined` |
145
+ | `OAUTH_ISSUER_URL` | URL of the OAuth 2.1 issuer. | **Yes (if `oauth`)** | `undefined` |
146
+ | `OAUTH_AUDIENCE` | Audience claim for OAuth tokens. | **Yes (if `oauth`)** | `undefined` |
147
+ | `OAUTH_JWKS_URI` | URI for the JSON Web Key Set (optional, derived from issuer if omitted). | No | (derived) |
148
+ | `MCP_LOG_LEVEL` | Logging level (`debug`, `info`, `error`, etc.). | No | `info` |
149
+ | `OBSIDIAN_VERIFY_SSL` | Set to `false` to disable SSL verification. | No | `true` |
150
+ | `OBSIDIAN_ENABLE_CACHE` | Set to `true` to enable the in-memory vault cache. | No | `true` |
151
+ | `OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN` | Refresh interval for the vault cache in minutes. | No | `10` |
131
152
 
132
153
  ### Connecting to the Obsidian API
133
154
 
@@ -165,27 +186,6 @@ _Using the encrypted HTTPS URL:_
165
186
  }
166
187
  ```
167
188
 
168
- ### MCP Client Settings
169
-
170
- Add to your MCP client settings (e.g., `cline_mcp_settings.json`):
171
-
172
- ```json
173
- {
174
- "mcpServers": {
175
- "obsidian-mcp-server": {
176
- "command": "node",
177
- "args": ["/path/to/your/obsidian-mcp-server/dist/index.js"],
178
- "env": {
179
- "OBSIDIAN_API_KEY": "YOUR_OBSIDIAN_API_KEY",
180
- "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
181
- "OBSIDIAN_VERIFY_SSL": "false",
182
- "OBSIDIAN_ENABLE_CACHE": "true"
183
- }
184
- }
185
- }
186
- }
187
- ```
188
-
189
189
  ## Project Structure
190
190
 
191
191
  The codebase follows a modular structure within the `src/` directory:
@@ -199,7 +199,8 @@ src/
199
199
  │ ├── server.ts # Server setup, transport handling, tool/resource registration
200
200
  │ ├── resources/ # MCP Resource implementations (currently none)
201
201
  │ ├── tools/ # MCP Tool implementations (subdirs per tool)
202
- │ └── transports/ # Stdio and HTTP transport logic, auth middleware
202
+ │ └── transports/ # Stdio and HTTP transport logic
203
+ │ └── auth/ # Authentication strategies (JWT, OAuth)
203
204
  ├── services/ # Abstractions for external APIs or internal caching
204
205
  │ └── obsidianRestAPI/ # Typed client for Obsidian Local REST API
205
206
  ├── types-global/ # Shared TypeScript type definitions (errors, etc.)
@@ -239,7 +240,7 @@ The Obsidian MCP Server provides a suite of tools for interacting with your vaul
239
240
  | Tool Name | Description | Key Arguments |
240
241
  | :---------------------------- | :-------------------------------------------------------- | :------------------------------------------------------------ |
241
242
  | `obsidian_read_file` | Retrieves the content and metadata of a file. | `filePath`, `format?`, `includeStat?` |
242
- | `obsidian_update_file` | Modifies a file by appending, prepending, or overwriting. | `targetType`, `content`, `targetIdentifier?`, `wholeFileMode` |
243
+ | `obsidian_update_note` | Modifies a file by appending, prepending, or overwriting. | `targetType`, `content`, `targetIdentifier?`, `wholeFileMode` |
243
244
  | `obsidian_search_replace` | Performs search-and-replace operations in a note. | `targetType`, `replacements`, `useRegex?`, `replaceAll?` |
244
245
  | `obsidian_global_search` | Searches the entire vault for content. | `query`, `searchInPath?`, `useRegex?`, `page?`, `pageSize?` |
245
246
  | `obsidian_list_files` | Lists files and subdirectories in a folder. | `dirPath`, `fileExtensionFilter?`, `nameRegexFilter?` |
@@ -259,32 +260,23 @@ This server currently focuses on providing interactive tools for vault manipulat
259
260
 
260
261
  ### Build and Test
261
262
 
263
+ To get started with development, clone the repository, install dependencies, and use the following scripts:
264
+
262
265
  ```bash
263
- # Build the project (compile TS to JS in dist/ and make executable)
264
- npm run build
266
+ # Install dependencies
267
+ npm install
265
268
 
266
- # Format code using Prettier
267
- npm run format
269
+ # Build the project (compile TS to JS in dist/ and make executable)
270
+ npm run rebuild
268
271
 
269
- # Test the server locally using stdio transport
270
- npm start
271
- # or specifically:
272
- npm run start:stdio
272
+ # Start the server locally using stdio transport
273
+ npm start:stdio
273
274
 
274
- # Test the server locally using http transport
275
+ # Start the server using http transport
275
276
  npm run start:http
276
277
 
277
- # Generate a file tree representation for documentation (runs scripts/tree.ts)
278
- npm run tree
279
-
280
- # Clean build artifacts and then rebuild the project
281
- npm run rebuild
282
-
283
- # Fetch the Obsidian API spec (requires Obsidian running with Local REST API)
284
- npm run fetch:spec http://127.0.0.1:27123/ docs/obsidian-api/obsidian_rest_api_spec
285
-
286
- # Generate API documentation using TypeDoc
287
- npm run docs:generate
278
+ # Format code using Prettier
279
+ npm run format
288
280
 
289
281
  # Inspect the server's capabilities using the MCP Inspector tool
290
282
  npm run inspect:stdio
@@ -19,12 +19,12 @@ import { config, environment } from "../config/index.js";
19
19
  // Import core utilities: ErrorHandler, logger, requestContextService.
20
20
  import { ErrorHandler, logger, requestContextService } from "../utils/index.js";
21
21
  // Import registration functions for specific resources and tools.
22
- import { registerObsidianDeleteFileTool } from "./tools/obsidianDeleteFileTool/index.js";
22
+ import { registerObsidianDeleteNoteTool } from "./tools/obsidianDeleteNoteTool/index.js";
23
23
  import { registerObsidianGlobalSearchTool } from "./tools/obsidianGlobalSearchTool/index.js";
24
- import { registerObsidianListFilesTool } from "./tools/obsidianListFilesTool/index.js";
25
- import { registerObsidianReadFileTool } from "./tools/obsidianReadFileTool/index.js";
24
+ import { registerObsidianListNotesTool } from "./tools/obsidianListNotesTool/index.js";
25
+ import { registerObsidianReadNoteTool } from "./tools/obsidianReadNoteTool/index.js";
26
26
  import { registerObsidianSearchReplaceTool } from "./tools/obsidianSearchReplaceTool/index.js";
27
- import { registerObsidianUpdateFileTool } from "./tools/obsidianUpdateFileTool/index.js";
27
+ import { registerObsidianUpdateNoteTool } from "./tools/obsidianUpdateNoteTool/index.js";
28
28
  import { registerObsidianManageFrontmatterTool } from "./tools/obsidianManageFrontmatterTool/index.js";
29
29
  import { registerObsidianManageTagsTool } from "./tools/obsidianManageTagsTool/index.js";
30
30
  // Import transport setup functions.
@@ -83,9 +83,9 @@ async function createMcpServerInstance(obsidianService, vaultCacheService) {
83
83
  try {
84
84
  logger.debug("Registering resources and tools using shared services...", context);
85
85
  // Register all tools, passing the vaultCacheService which may be undefined
86
- await registerObsidianListFilesTool(server, obsidianService);
87
- await registerObsidianReadFileTool(server, obsidianService);
88
- await registerObsidianDeleteFileTool(server, obsidianService, vaultCacheService);
86
+ await registerObsidianListNotesTool(server, obsidianService);
87
+ await registerObsidianReadNoteTool(server, obsidianService);
88
+ await registerObsidianDeleteNoteTool(server, obsidianService, vaultCacheService);
89
89
  if (vaultCacheService) {
90
90
  await registerObsidianGlobalSearchTool(server, obsidianService, vaultCacheService);
91
91
  }
@@ -93,7 +93,7 @@ async function createMcpServerInstance(obsidianService, vaultCacheService) {
93
93
  logger.warning("Skipping registration of 'obsidian_global_search' because the Vault Cache Service is disabled.", context);
94
94
  }
95
95
  await registerObsidianSearchReplaceTool(server, obsidianService, vaultCacheService);
96
- await registerObsidianUpdateFileTool(server, obsidianService, vaultCacheService);
96
+ await registerObsidianUpdateNoteTool(server, obsidianService, vaultCacheService);
97
97
  await registerObsidianManageFrontmatterTool(server, obsidianService, vaultCacheService);
98
98
  await registerObsidianManageTagsTool(server, obsidianService, vaultCacheService);
99
99
  logger.info("Resources and tools registered successfully", context);
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_delete_file' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_delete_note' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_delete_file tool module.
5
- * It re-exports the primary registration function (`registerObsidianDeleteFileTool`)
4
+ * This file serves as the public entry point for the obsidian_delete_note tool module.
5
+ * It re-exports the primary registration function (`registerObsidianDeleteNoteTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianDeleteFileTool } from "./registration.js";
12
+ export { registerObsidianDeleteNoteTool } from "./registration.js";
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_delete_file' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_delete_note' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_delete_file tool module.
5
- * It re-exports the primary registration function (`registerObsidianDeleteFileTool`)
4
+ * This file serves as the public entry point for the obsidian_delete_note tool module.
5
+ * It re-exports the primary registration function (`registerObsidianDeleteNoteTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianDeleteFileTool } from "./registration.js";
12
+ export { registerObsidianDeleteNoteTool } from "./registration.js";
@@ -2,9 +2,9 @@ import { z } from "zod";
2
2
  import { ObsidianRestApiService, VaultCacheService } from "../../../services/obsidianRestAPI/index.js";
3
3
  import { RequestContext } from "../../../utils/index.js";
4
4
  /**
5
- * Zod schema for validating the input parameters of the 'obsidian_delete_file' tool.
5
+ * Zod schema for validating the input parameters of the 'obsidian_delete_note' tool.
6
6
  */
7
- export declare const ObsidianDeleteFileInputSchema: z.ZodObject<{
7
+ export declare const ObsidianDeleteNoteInputSchema: z.ZodObject<{
8
8
  /**
9
9
  * The vault-relative path to the file to be permanently deleted.
10
10
  * Must include the file extension (e.g., "Old Notes/Obsolete File.md").
@@ -18,15 +18,15 @@ export declare const ObsidianDeleteFileInputSchema: z.ZodObject<{
18
18
  filePath: string;
19
19
  }>;
20
20
  /**
21
- * TypeScript type inferred from the input schema (`ObsidianDeleteFileInputSchema`).
21
+ * TypeScript type inferred from the input schema (`ObsidianDeleteNoteInputSchema`).
22
22
  * Represents the validated input parameters used within the core processing logic.
23
23
  */
24
- export type ObsidianDeleteFileInput = z.infer<typeof ObsidianDeleteFileInputSchema>;
24
+ export type ObsidianDeleteNoteInput = z.infer<typeof ObsidianDeleteNoteInputSchema>;
25
25
  /**
26
- * Defines the structure of the successful response returned by the `processObsidianDeleteFile` function.
26
+ * Defines the structure of the successful response returned by the `processObsidianDeleteNote` function.
27
27
  * This object is typically serialized to JSON and sent back to the client.
28
28
  */
29
- export interface ObsidianDeleteFileResponse {
29
+ export interface ObsidianDeleteNoteResponse {
30
30
  /** Indicates whether the deletion operation was successful. */
31
31
  success: boolean;
32
32
  /** A human-readable message confirming the deletion and specifying the path used. */
@@ -40,12 +40,12 @@ export interface ObsidianDeleteFileResponse {
40
40
  * it lists the directory, finds a unique case-insensitive match for the filename,
41
41
  * and retries the deletion with the corrected path.
42
42
  *
43
- * @param {ObsidianDeleteFileInput} params - The validated input parameters.
43
+ * @param {ObsidianDeleteNoteInput} params - The validated input parameters.
44
44
  * @param {RequestContext} context - The request context for logging and correlation.
45
45
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
46
- * @returns {Promise<ObsidianDeleteFileResponse>} A promise resolving to the structured success response
46
+ * @returns {Promise<ObsidianDeleteNoteResponse>} A promise resolving to the structured success response
47
47
  * containing a confirmation message.
48
48
  * @throws {McpError} Throws an McpError if the file cannot be found (even with fallback),
49
49
  * if there's an ambiguous fallback match, or if any other API interaction fails.
50
50
  */
51
- export declare const processObsidianDeleteFile: (params: ObsidianDeleteFileInput, context: RequestContext, obsidianService: ObsidianRestApiService, vaultCacheService: VaultCacheService | undefined) => Promise<ObsidianDeleteFileResponse>;
51
+ export declare const processObsidianDeleteNote: (params: ObsidianDeleteNoteInput, context: RequestContext, obsidianService: ObsidianRestApiService, vaultCacheService: VaultCacheService | undefined) => Promise<ObsidianDeleteNoteResponse>;
@@ -6,9 +6,9 @@ import { logger, retryWithDelay, } from "../../../utils/index.js";
6
6
  // Schema Definitions for Input Validation
7
7
  // ====================================================================================
8
8
  /**
9
- * Zod schema for validating the input parameters of the 'obsidian_delete_file' tool.
9
+ * Zod schema for validating the input parameters of the 'obsidian_delete_note' tool.
10
10
  */
11
- export const ObsidianDeleteFileInputSchema = z
11
+ export const ObsidianDeleteNoteInputSchema = z
12
12
  .object({
13
13
  /**
14
14
  * The vault-relative path to the file to be permanently deleted.
@@ -33,18 +33,18 @@ export const ObsidianDeleteFileInputSchema = z
33
33
  * it lists the directory, finds a unique case-insensitive match for the filename,
34
34
  * and retries the deletion with the corrected path.
35
35
  *
36
- * @param {ObsidianDeleteFileInput} params - The validated input parameters.
36
+ * @param {ObsidianDeleteNoteInput} params - The validated input parameters.
37
37
  * @param {RequestContext} context - The request context for logging and correlation.
38
38
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
39
- * @returns {Promise<ObsidianDeleteFileResponse>} A promise resolving to the structured success response
39
+ * @returns {Promise<ObsidianDeleteNoteResponse>} A promise resolving to the structured success response
40
40
  * containing a confirmation message.
41
41
  * @throws {McpError} Throws an McpError if the file cannot be found (even with fallback),
42
42
  * if there's an ambiguous fallback match, or if any other API interaction fails.
43
43
  */
44
- export const processObsidianDeleteFile = async (params, context, obsidianService, vaultCacheService) => {
44
+ export const processObsidianDeleteNote = async (params, context, obsidianService, vaultCacheService) => {
45
45
  const { filePath: originalFilePath } = params;
46
46
  let effectiveFilePath = originalFilePath; // Track the path actually used for deletion
47
- logger.debug(`Processing obsidian_delete_file request for path: ${originalFilePath}`, context);
47
+ logger.debug(`Processing obsidian_delete_note request for path: ${originalFilePath}`, context);
48
48
  const shouldRetryNotFound = (err) => err instanceof McpError && err.code === BaseErrorCode.NOT_FOUND;
49
49
  try {
50
50
  // --- Attempt 1: Delete using the provided path (case-sensitive) ---
@@ -1,7 +1,7 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { ObsidianRestApiService, VaultCacheService } from "../../../services/obsidianRestAPI/index.js";
3
3
  /**
4
- * Registers the 'obsidian_delete_file' tool with the MCP server.
4
+ * Registers the 'obsidian_delete_note' tool with the MCP server.
5
5
  *
6
6
  * This tool permanently deletes a specified file from the user's Obsidian vault.
7
7
  * It requires the vault-relative path, including the file extension. The tool
@@ -16,4 +16,4 @@ import { ObsidianRestApiService, VaultCacheService } from "../../../services/obs
16
16
  * @returns {Promise<void>} A promise that resolves when the tool registration is complete or rejects on error.
17
17
  * @throws {McpError} Throws an McpError if registration fails critically.
18
18
  */
19
- export declare const registerObsidianDeleteFileTool: (server: McpServer, obsidianService: ObsidianRestApiService, vaultCacheService: VaultCacheService | undefined) => Promise<void>;
19
+ export declare const registerObsidianDeleteNoteTool: (server: McpServer, obsidianService: ObsidianRestApiService, vaultCacheService: VaultCacheService | undefined) => Promise<void>;
@@ -1,8 +1,8 @@
1
1
  import { BaseErrorCode, McpError } from "../../../types-global/errors.js";
2
2
  import { ErrorHandler, logger, requestContextService, } from "../../../utils/index.js";
3
- import { ObsidianDeleteFileInputSchema, processObsidianDeleteFile, } from "./logic.js";
3
+ import { ObsidianDeleteNoteInputSchema, processObsidianDeleteNote, } from "./logic.js";
4
4
  /**
5
- * Registers the 'obsidian_delete_file' tool with the MCP server.
5
+ * Registers the 'obsidian_delete_note' tool with the MCP server.
6
6
  *
7
7
  * This tool permanently deletes a specified file from the user's Obsidian vault.
8
8
  * It requires the vault-relative path, including the file extension. The tool
@@ -17,26 +17,26 @@ import { ObsidianDeleteFileInputSchema, processObsidianDeleteFile, } from "./log
17
17
  * @returns {Promise<void>} A promise that resolves when the tool registration is complete or rejects on error.
18
18
  * @throws {McpError} Throws an McpError if registration fails critically.
19
19
  */
20
- export const registerObsidianDeleteFileTool = async (server, obsidianService, vaultCacheService) => {
21
- const toolName = "obsidian_delete_file";
20
+ export const registerObsidianDeleteNoteTool = async (server, obsidianService, vaultCacheService) => {
21
+ const toolName = "obsidian_delete_note";
22
22
  // Updated description to accurately reflect the response (no timestamp)
23
23
  const toolDescription = "Permanently deletes a specified file from the Obsidian vault. Tries the exact path first, then attempts a case-insensitive fallback if the file is not found. Requires the vault-relative path including the file extension. Returns a success message.";
24
24
  // Create a context specifically for the registration process.
25
25
  const registrationContext = requestContextService.createRequestContext({
26
- operation: "RegisterObsidianDeleteFileTool",
26
+ operation: "RegisterObsidianDeleteNoteTool",
27
27
  toolName: toolName,
28
- module: "ObsidianDeleteFileRegistration", // Identify the module
28
+ module: "ObsidianDeleteNoteRegistration", // Identify the module
29
29
  });
30
30
  logger.info(`Attempting to register tool: ${toolName}`, registrationContext);
31
31
  // Wrap the registration logic in a tryCatch block for robust error handling during server setup.
32
32
  await ErrorHandler.tryCatch(async () => {
33
33
  // Use the high-level SDK method `server.tool` for registration.
34
- server.tool(toolName, toolDescription, ObsidianDeleteFileInputSchema.shape, // Provide the Zod schema shape for input definition.
34
+ server.tool(toolName, toolDescription, ObsidianDeleteNoteInputSchema.shape, // Provide the Zod schema shape for input definition.
35
35
  /**
36
- * The handler function executed when the 'obsidian_delete_file' tool is called by the client.
36
+ * The handler function executed when the 'obsidian_delete_note' tool is called by the client.
37
37
  *
38
- * @param {ObsidianDeleteFileInput} params - The input parameters received from the client,
39
- * validated against the ObsidianDeleteFileInputSchema shape.
38
+ * @param {ObsidianDeleteNoteInput} params - The input parameters received from the client,
39
+ * validated against the ObsidianDeleteNoteInputSchema shape.
40
40
  * @returns {Promise<CallToolResult>} A promise resolving to the structured result for the MCP client,
41
41
  * containing either the successful response data (serialized JSON) or an error indication.
42
42
  */
@@ -45,7 +45,7 @@ export const registerObsidianDeleteFileTool = async (server, obsidianService, va
45
45
  // Create a specific context for this handler invocation.
46
46
  const handlerContext = requestContextService.createRequestContext({
47
47
  parentContext: registrationContext, // Link to registration context
48
- operation: "HandleObsidianDeleteFileRequest",
48
+ operation: "HandleObsidianDeleteNoteRequest",
49
49
  toolName: toolName,
50
50
  params: { filePath: params.filePath }, // Log the file path being targeted
51
51
  });
@@ -54,7 +54,7 @@ export const registerObsidianDeleteFileTool = async (server, obsidianService, va
54
54
  return await ErrorHandler.tryCatch(async () => {
55
55
  // Delegate the actual file deletion logic to the processing function.
56
56
  // Note: Input schema and shape are identical, no separate refinement parse needed here.
57
- const response = await processObsidianDeleteFile(params, handlerContext, obsidianService, vaultCacheService);
57
+ const response = await processObsidianDeleteNote(params, handlerContext, obsidianService, vaultCacheService);
58
58
  logger.debug(`'${toolName}' processed successfully`, handlerContext);
59
59
  // Format the successful response object from the logic function into the required MCP CallToolResult structure.
60
60
  // The response object (success, message) is serialized to JSON.
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_list_files' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_list_notes' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_list_files tool module.
5
- * It re-exports the primary registration function (`registerObsidianListFilesTool`)
4
+ * This file serves as the public entry point for the obsidian_list_notes tool module.
5
+ * It re-exports the primary registration function (`registerObsidianListNotesTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianListFilesTool } from "./registration.js";
12
+ export { registerObsidianListNotesTool } from "./registration.js";
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @fileoverview Barrel file for the 'obsidian_list_files' MCP tool.
2
+ * @fileoverview Barrel file for the 'obsidian_list_notes' MCP tool.
3
3
  *
4
- * This file serves as the public entry point for the obsidian_list_files tool module.
5
- * It re-exports the primary registration function (`registerObsidianListFilesTool`)
4
+ * This file serves as the public entry point for the obsidian_list_notes tool module.
5
+ * It re-exports the primary registration function (`registerObsidianListNotesTool`)
6
6
  * from the './registration.js' module. This pattern simplifies imports for consumers
7
7
  * of the tool, allowing them to import necessary components from a single location.
8
8
  *
9
9
  * Consumers (like the main server setup) should import the registration function
10
10
  * from this file to integrate the tool into the MCP server instance.
11
11
  */
12
- export { registerObsidianListFilesTool } from "./registration.js";
12
+ export { registerObsidianListNotesTool } from "./registration.js";
@@ -1,16 +1,16 @@
1
1
  /**
2
- * @fileoverview Core logic for the 'obsidian_list_files' tool.
2
+ * @fileoverview Core logic for the 'obsidian_list_notes' tool.
3
3
  * This module defines the input schema, response types, and processing logic for
4
4
  * recursively listing files and directories in an Obsidian vault with filtering.
5
- * @module src/mcp-server/tools/obsidianListFilesTool/logic
5
+ * @module src/mcp-server/tools/obsidianListNotesTool/logic
6
6
  */
7
7
  import { z } from "zod";
8
8
  import { ObsidianRestApiService } from "../../../services/obsidianRestAPI/index.js";
9
9
  import { RequestContext } from "../../../utils/index.js";
10
10
  /**
11
- * Zod schema for validating the input parameters of the 'obsidian_list_files' tool.
11
+ * Zod schema for validating the input parameters of the 'obsidian_list_notes' tool.
12
12
  */
13
- export declare const ObsidianListFilesInputSchema: z.ZodObject<{
13
+ export declare const ObsidianListNotesInputSchema: z.ZodObject<{
14
14
  /**
15
15
  * The vault-relative path to the directory whose contents should be listed.
16
16
  * The path is treated as case-sensitive by the underlying Obsidian API.
@@ -45,13 +45,13 @@ export declare const ObsidianListFilesInputSchema: z.ZodObject<{
45
45
  recursionDepth?: number | undefined;
46
46
  }>;
47
47
  /**
48
- * TypeScript type inferred from the input schema (`ObsidianListFilesInputSchema`).
48
+ * TypeScript type inferred from the input schema (`ObsidianListNotesInputSchema`).
49
49
  */
50
- export type ObsidianListFilesInput = z.infer<typeof ObsidianListFilesInputSchema>;
50
+ export type ObsidianListNotesInput = z.infer<typeof ObsidianListNotesInputSchema>;
51
51
  /**
52
52
  * Defines the structure of the successful response returned by the core logic function.
53
53
  */
54
- export interface ObsidianListFilesResponse {
54
+ export interface ObsidianListNotesResponse {
55
55
  directoryPath: string;
56
56
  tree: string;
57
57
  totalEntries: number;
@@ -59,10 +59,10 @@ export interface ObsidianListFilesResponse {
59
59
  /**
60
60
  * Processes the core logic for listing files and directories recursively within the Obsidian vault.
61
61
  *
62
- * @param {ObsidianListFilesInput} params - The validated input parameters.
62
+ * @param {ObsidianListNotesInput} params - The validated input parameters.
63
63
  * @param {RequestContext} context - The request context for logging and correlation.
64
64
  * @param {ObsidianRestApiService} obsidianService - An instance of the Obsidian REST API service.
65
- * @returns {Promise<ObsidianListFilesResponse>} A promise resolving to the structured success response.
65
+ * @returns {Promise<ObsidianListNotesResponse>} A promise resolving to the structured success response.
66
66
  * @throws {McpError} Throws an McpError if the initial directory is not found or another error occurs.
67
67
  */
68
- export declare const processObsidianListFiles: (params: ObsidianListFilesInput, context: RequestContext, obsidianService: ObsidianRestApiService) => Promise<ObsidianListFilesResponse>;
68
+ export declare const processObsidianListNotes: (params: ObsidianListNotesInput, context: RequestContext, obsidianService: ObsidianRestApiService) => Promise<ObsidianListNotesResponse>;