obsidian-mcp-server 1.5.8 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +248 -104
- package/dist/config/index.d.ts +41 -0
- package/dist/config/index.js +191 -0
- package/dist/index.d.ts +1 -5
- package/dist/index.js +296 -18
- package/dist/mcp-server/server.d.ts +33 -0
- package/dist/mcp-server/server.js +211 -0
- package/dist/mcp-server/tools/obsidianDeleteFileTool/index.d.ts +12 -0
- package/dist/mcp-server/tools/obsidianDeleteFileTool/index.js +12 -0
- package/dist/mcp-server/tools/obsidianDeleteFileTool/logic.d.ts +51 -0
- package/dist/mcp-server/tools/obsidianDeleteFileTool/logic.js +168 -0
- package/dist/mcp-server/tools/obsidianDeleteFileTool/registration.d.ts +19 -0
- package/dist/mcp-server/tools/obsidianDeleteFileTool/registration.js +91 -0
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.d.ts +12 -0
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.js +12 -0
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.d.ts +77 -0
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.js +341 -0
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.d.ts +18 -0
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.js +69 -0
- package/dist/mcp-server/tools/obsidianListFilesTool/index.d.ts +12 -0
- package/dist/mcp-server/tools/obsidianListFilesTool/index.js +12 -0
- package/dist/mcp-server/tools/obsidianListFilesTool/logic.d.ts +64 -0
- package/dist/mcp-server/tools/obsidianListFilesTool/logic.js +179 -0
- package/dist/mcp-server/tools/obsidianListFilesTool/registration.d.ts +19 -0
- package/dist/mcp-server/tools/obsidianListFilesTool/registration.js +96 -0
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.d.ts +3 -0
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.js +2 -0
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.d.ts +42 -0
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.js +152 -0
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.d.ts +3 -0
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.js +52 -0
- package/dist/mcp-server/tools/obsidianManageTagsTool/index.d.ts +3 -0
- package/dist/mcp-server/tools/obsidianManageTagsTool/index.js +2 -0
- package/dist/mcp-server/tools/obsidianManageTagsTool/logic.d.ts +28 -0
- package/dist/mcp-server/tools/obsidianManageTagsTool/logic.js +161 -0
- package/dist/mcp-server/tools/obsidianManageTagsTool/registration.d.ts +3 -0
- package/dist/mcp-server/tools/obsidianManageTagsTool/registration.js +52 -0
- package/dist/mcp-server/tools/obsidianReadFileTool/index.d.ts +12 -0
- package/dist/mcp-server/tools/obsidianReadFileTool/index.js +12 -0
- package/dist/mcp-server/tools/obsidianReadFileTool/logic.d.ts +87 -0
- package/dist/mcp-server/tools/obsidianReadFileTool/logic.js +216 -0
- package/dist/mcp-server/tools/obsidianReadFileTool/registration.d.ts +20 -0
- package/dist/mcp-server/tools/obsidianReadFileTool/registration.js +101 -0
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.d.ts +12 -0
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.js +12 -0
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.d.ts +255 -0
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.js +583 -0
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.d.ts +22 -0
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.js +111 -0
- package/dist/mcp-server/tools/obsidianUpdateFileTool/index.d.ts +12 -0
- package/dist/mcp-server/tools/obsidianUpdateFileTool/index.js +12 -0
- package/dist/mcp-server/tools/obsidianUpdateFileTool/logic.d.ts +183 -0
- package/dist/mcp-server/tools/obsidianUpdateFileTool/logic.js +490 -0
- package/dist/mcp-server/tools/obsidianUpdateFileTool/registration.d.ts +21 -0
- package/dist/mcp-server/tools/obsidianUpdateFileTool/registration.js +108 -0
- package/dist/mcp-server/transports/authentication/authContext.d.ts +33 -0
- package/dist/mcp-server/transports/authentication/authContext.js +24 -0
- package/dist/mcp-server/transports/authentication/authMiddleware.d.ts +30 -0
- package/dist/mcp-server/transports/authentication/authMiddleware.js +145 -0
- package/dist/mcp-server/transports/authentication/authUtils.d.ts +18 -0
- package/dist/mcp-server/transports/authentication/authUtils.js +45 -0
- package/dist/mcp-server/transports/authentication/oauthMiddleware.d.ts +24 -0
- package/dist/mcp-server/transports/authentication/oauthMiddleware.js +109 -0
- package/dist/mcp-server/transports/authentication/types.d.ts +17 -0
- package/dist/mcp-server/transports/authentication/types.js +5 -0
- package/dist/mcp-server/transports/httpTransport.d.ts +24 -0
- package/dist/mcp-server/transports/httpTransport.js +496 -0
- package/dist/mcp-server/transports/stdioTransport.d.ts +42 -0
- package/dist/mcp-server/transports/stdioTransport.js +63 -0
- package/dist/services/obsidianRestAPI/index.d.ts +15 -0
- package/dist/services/obsidianRestAPI/index.js +17 -0
- package/dist/services/obsidianRestAPI/methods/activeFileMethods.d.ts +38 -0
- package/dist/services/obsidianRestAPI/methods/activeFileMethods.js +62 -0
- package/dist/services/obsidianRestAPI/methods/commandMethods.d.ts +22 -0
- package/dist/services/obsidianRestAPI/methods/commandMethods.js +31 -0
- package/dist/services/obsidianRestAPI/methods/openMethods.d.ts +16 -0
- package/dist/services/obsidianRestAPI/methods/openMethods.js +21 -0
- package/dist/services/obsidianRestAPI/methods/patchMethods.d.ts +37 -0
- package/dist/services/obsidianRestAPI/methods/patchMethods.js +94 -0
- package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.d.ts +42 -0
- package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.js +66 -0
- package/dist/services/obsidianRestAPI/methods/searchMethods.d.ts +25 -0
- package/dist/services/obsidianRestAPI/methods/searchMethods.js +36 -0
- package/dist/services/obsidianRestAPI/methods/vaultMethods.d.ts +58 -0
- package/dist/services/obsidianRestAPI/methods/vaultMethods.js +144 -0
- package/dist/services/obsidianRestAPI/service.d.ts +195 -0
- package/dist/services/obsidianRestAPI/service.js +379 -0
- package/dist/services/obsidianRestAPI/types.d.ts +127 -0
- package/dist/services/obsidianRestAPI/types.js +7 -0
- package/dist/services/obsidianRestAPI/vaultCache/index.d.ts +4 -0
- package/dist/services/obsidianRestAPI/vaultCache/index.js +4 -0
- package/dist/services/obsidianRestAPI/vaultCache/service.d.ts +88 -0
- package/dist/services/obsidianRestAPI/vaultCache/service.js +299 -0
- package/dist/types-global/errors.d.ts +73 -0
- package/dist/types-global/errors.js +71 -0
- package/dist/utils/index.d.ts +5 -8
- package/dist/utils/index.js +13 -9
- package/dist/utils/internal/asyncUtils.d.ts +54 -0
- package/dist/utils/internal/asyncUtils.js +101 -0
- package/dist/utils/internal/errorHandler.d.ts +176 -0
- package/dist/utils/internal/errorHandler.js +351 -0
- package/dist/utils/internal/index.d.ts +4 -0
- package/dist/utils/internal/index.js +4 -0
- package/dist/utils/internal/logger.d.ts +141 -0
- package/dist/utils/internal/logger.js +406 -0
- package/dist/utils/internal/requestContext.d.ts +83 -0
- package/dist/utils/internal/requestContext.js +72 -0
- package/dist/utils/metrics/index.d.ts +1 -0
- package/dist/utils/metrics/index.js +1 -0
- package/dist/utils/metrics/tokenCounter.d.ts +27 -0
- package/dist/utils/metrics/tokenCounter.js +128 -0
- package/dist/utils/obsidian/index.d.ts +5 -0
- package/dist/utils/obsidian/index.js +5 -0
- package/dist/utils/obsidian/obsidianApiUtils.d.ts +14 -0
- package/dist/utils/obsidian/obsidianApiUtils.js +29 -0
- package/dist/utils/obsidian/obsidianStatUtils.d.ts +68 -0
- package/dist/utils/obsidian/obsidianStatUtils.js +143 -0
- package/dist/utils/parsing/dateParser.d.ts +56 -0
- package/dist/utils/parsing/dateParser.js +104 -0
- package/dist/utils/parsing/index.d.ts +2 -0
- package/dist/utils/parsing/index.js +3 -0
- package/dist/utils/parsing/jsonParser.d.ts +80 -0
- package/dist/utils/parsing/jsonParser.js +133 -0
- package/dist/utils/security/idGenerator.d.ts +140 -0
- package/dist/utils/security/idGenerator.js +194 -0
- package/dist/utils/security/index.d.ts +3 -0
- package/dist/utils/security/index.js +3 -0
- package/dist/utils/security/rateLimiter.d.ts +156 -0
- package/dist/utils/security/rateLimiter.js +235 -0
- package/dist/utils/security/sanitization.d.ts +244 -0
- package/dist/utils/security/sanitization.js +599 -0
- package/package.json +58 -37
- package/dist/index.js.map +0 -1
- package/dist/mcp/handlers.d.ts +0 -29
- package/dist/mcp/handlers.js +0 -305
- package/dist/mcp/handlers.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -6
- package/dist/mcp/index.js +0 -7
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -18
- package/dist/mcp/server.js +0 -240
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/types.d.ts +0 -70
- package/dist/mcp/types.js +0 -49
- package/dist/mcp/types.js.map +0 -1
- package/dist/obsidian/client.d.ts +0 -109
- package/dist/obsidian/client.js +0 -403
- package/dist/obsidian/client.js.map +0 -1
- package/dist/obsidian/errors.d.ts +0 -28
- package/dist/obsidian/errors.js +0 -75
- package/dist/obsidian/errors.js.map +0 -1
- package/dist/obsidian/index.d.ts +0 -6
- package/dist/obsidian/index.js +0 -7
- package/dist/obsidian/index.js.map +0 -1
- package/dist/obsidian/types.d.ts +0 -107
- package/dist/obsidian/types.js +0 -12
- package/dist/obsidian/types.js.map +0 -1
- package/dist/resources/index.d.ts +0 -13
- package/dist/resources/index.js +0 -15
- package/dist/resources/index.js.map +0 -1
- package/dist/resources/tags.d.ts +0 -39
- package/dist/resources/tags.js +0 -257
- package/dist/resources/tags.js.map +0 -1
- package/dist/resources/types.d.ts +0 -27
- package/dist/resources/types.js +0 -5
- package/dist/resources/types.js.map +0 -1
- package/dist/tools/base.d.ts +0 -46
- package/dist/tools/base.js +0 -88
- package/dist/tools/base.js.map +0 -1
- package/dist/tools/files/content.d.ts +0 -58
- package/dist/tools/files/content.js +0 -171
- package/dist/tools/files/content.js.map +0 -1
- package/dist/tools/files/index.d.ts +0 -14
- package/dist/tools/files/index.js +0 -22
- package/dist/tools/files/index.js.map +0 -1
- package/dist/tools/files/list.d.ts +0 -35
- package/dist/tools/files/list.js +0 -133
- package/dist/tools/files/list.js.map +0 -1
- package/dist/tools/index.d.ts +0 -21
- package/dist/tools/index.js +0 -31
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/properties/index.d.ts +0 -14
- package/dist/tools/properties/index.js +0 -19
- package/dist/tools/properties/index.js.map +0 -1
- package/dist/tools/properties/manager.d.ts +0 -62
- package/dist/tools/properties/manager.js +0 -302
- package/dist/tools/properties/manager.js.map +0 -1
- package/dist/tools/properties/tools.d.ts +0 -47
- package/dist/tools/properties/tools.js +0 -239
- package/dist/tools/properties/tools.js.map +0 -1
- package/dist/tools/properties/types.d.ts +0 -141
- package/dist/tools/properties/types.js +0 -70
- package/dist/tools/properties/types.js.map +0 -1
- package/dist/tools/search/complex.d.ts +0 -38
- package/dist/tools/search/complex.js +0 -270
- package/dist/tools/search/complex.js.map +0 -1
- package/dist/tools/search/index.d.ts +0 -14
- package/dist/tools/search/index.js +0 -20
- package/dist/tools/search/index.js.map +0 -1
- package/dist/tools/search/simple.d.ts +0 -25
- package/dist/tools/search/simple.js +0 -127
- package/dist/tools/search/simple.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -24
- package/dist/utils/errors.js +0 -59
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/idGenerator.d.ts +0 -15
- package/dist/utils/idGenerator.js +0 -21
- package/dist/utils/idGenerator.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logging.d.ts +0 -245
- package/dist/utils/logging.js +0 -417
- package/dist/utils/logging.js.map +0 -1
- package/dist/utils/rate-limiting.d.ts +0 -50
- package/dist/utils/rate-limiting.js +0 -94
- package/dist/utils/rate-limiting.js.map +0 -1
- package/dist/utils/tokenization.d.ts +0 -28
- package/dist/utils/tokenization.js +0 -75
- package/dist/utils/tokenization.js.map +0 -1
- package/dist/utils/validation.d.ts +0 -22
- package/dist/utils/validation.js +0 -92
- package/dist/utils/validation.js.map +0 -1
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../../utils/logging.js";
|
|
2
|
-
import { BaseToolHandler } from "../base.js";
|
|
3
|
-
// Create a logger for search operations
|
|
4
|
-
const logger = createLogger('SimpleSearchTools');
|
|
5
|
-
/**
|
|
6
|
-
* Tool name for simple search
|
|
7
|
-
*/
|
|
8
|
-
export const SIMPLE_SEARCH_TOOL_NAME = "obsidian_find_in_file";
|
|
9
|
-
/**
|
|
10
|
-
* Tool handler for simple text search across files
|
|
11
|
-
*/
|
|
12
|
-
export class FindInFileToolHandler extends BaseToolHandler {
|
|
13
|
-
constructor(client) {
|
|
14
|
-
super(SIMPLE_SEARCH_TOOL_NAME, client);
|
|
15
|
-
}
|
|
16
|
-
getToolDescription() {
|
|
17
|
-
return {
|
|
18
|
-
name: this.name,
|
|
19
|
-
description: "Performs a full-text search across all files in your Obsidian vault. Returns matching files with context around each match. If more than 5 files match, only filenames and match counts are returned to avoid excessive output. Ideal for locating specific text, tags, or patterns.",
|
|
20
|
-
examples: [
|
|
21
|
-
{
|
|
22
|
-
description: "Search for a specific term with custom context length",
|
|
23
|
-
args: {
|
|
24
|
-
query: "neural networks",
|
|
25
|
-
contextLength: 20
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
description: "Search with default context",
|
|
30
|
-
args: {
|
|
31
|
-
query: "#todo"
|
|
32
|
-
},
|
|
33
|
-
response: {
|
|
34
|
-
"message": "Found 1 file with matches:",
|
|
35
|
-
"results": [
|
|
36
|
-
{
|
|
37
|
-
"filename": "Projects/AI.md",
|
|
38
|
-
"matches": [
|
|
39
|
-
{
|
|
40
|
-
"context": "Research needed:\n#todo Implement transformer architecture\nDeadline: Next week",
|
|
41
|
-
"match": { "start": 15, "end": 45 }
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
description: "Example response with many matches (file-only format)",
|
|
50
|
-
args: {
|
|
51
|
-
query: "API"
|
|
52
|
-
},
|
|
53
|
-
response: {
|
|
54
|
-
"message": "Found 92 files with matches. Showing file names only:",
|
|
55
|
-
"results": [
|
|
56
|
-
{
|
|
57
|
-
"filename": "Developer/Documentation/API.md",
|
|
58
|
-
"matchCount": 43
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"filename": "Projects/API_Design.md",
|
|
62
|
-
"matchCount": 34
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
inputSchema: {
|
|
69
|
-
type: "object",
|
|
70
|
-
properties: {
|
|
71
|
-
query: {
|
|
72
|
-
type: "string",
|
|
73
|
-
description: "Text pattern to search for. Can include tags, keywords, or phrases."
|
|
74
|
-
},
|
|
75
|
-
contextLength: {
|
|
76
|
-
type: "integer",
|
|
77
|
-
description: "Number of characters surrounding each match to provide context (default: 10).",
|
|
78
|
-
default: 10
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
required: ["query"]
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
async runTool(args) {
|
|
86
|
-
try {
|
|
87
|
-
logger.debug(`Searching for "${args.query}" with context length: ${args.contextLength || 10}`); // Align debug log default
|
|
88
|
-
const results = await this.client.search(args.query, args.contextLength ?? 10); // Align implemented default
|
|
89
|
-
// If more than 5 results, only return filenames and match counts to prevent overwhelming responses
|
|
90
|
-
if (results.length > 5) {
|
|
91
|
-
const fileOnlyResults = results.map(result => ({
|
|
92
|
-
filename: result.filename,
|
|
93
|
-
matchCount: result.matches.length
|
|
94
|
-
}));
|
|
95
|
-
logger.debug(`Found ${results.length} files with matches, returning file-only format`);
|
|
96
|
-
return this.createResponse({
|
|
97
|
-
message: `Found ${results.length} files with matches. Showing file names only:`,
|
|
98
|
-
results: fileOnlyResults
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
// Otherwise return full context as before
|
|
102
|
-
const formattedResults = results.map(result => ({
|
|
103
|
-
filename: result.filename,
|
|
104
|
-
matches: result.matches.map(match => ({
|
|
105
|
-
context: match.context,
|
|
106
|
-
match: {
|
|
107
|
-
text: match.context.substring(match.match.start, match.match.end),
|
|
108
|
-
position: {
|
|
109
|
-
start: match.match.start,
|
|
110
|
-
end: match.match.end
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
})),
|
|
114
|
-
score: result.score
|
|
115
|
-
}));
|
|
116
|
-
logger.debug(`Found ${results.length} files with matches, returning with context`);
|
|
117
|
-
return this.createResponse({
|
|
118
|
-
message: `Found ${results.length} file(s) with matches:`,
|
|
119
|
-
results: formattedResults
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
return this.handleError(error);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=simple.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simple.js","sourceRoot":"","sources":["../../../src/tools/search/simple.ts"],"names":[],"mappings":"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"}
|
package/dist/utils/errors.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error handling utilities for the Obsidian MCP Server
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Standard error interface for API responses
|
|
6
|
-
*/
|
|
7
|
-
export interface ApiError {
|
|
8
|
-
errorCode: number;
|
|
9
|
-
message: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Error class for Obsidian MCP Server specific errors
|
|
13
|
-
*/
|
|
14
|
-
export declare class ObsidianError extends Error implements ApiError {
|
|
15
|
-
readonly details?: unknown | undefined;
|
|
16
|
-
readonly errorCode: number;
|
|
17
|
-
constructor(message: string, errorCode?: number, // Default server error code
|
|
18
|
-
details?: unknown | undefined);
|
|
19
|
-
toApiError(): ApiError;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Maps HTTP status codes to internal error codes
|
|
23
|
-
*/
|
|
24
|
-
export declare function getErrorCodeFromStatus(status: number): number;
|
package/dist/utils/errors.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error handling utilities for the Obsidian MCP Server
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Error class for Obsidian MCP Server specific errors
|
|
6
|
-
*/
|
|
7
|
-
export class ObsidianError extends Error {
|
|
8
|
-
details;
|
|
9
|
-
errorCode;
|
|
10
|
-
constructor(message, errorCode = 50000, // Default server error code
|
|
11
|
-
details) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.details = details;
|
|
14
|
-
this.name = "ObsidianError";
|
|
15
|
-
// Ensure 5-digit error code
|
|
16
|
-
if (errorCode < 10000 || errorCode > 99999) {
|
|
17
|
-
// Convert HTTP status codes to 5-digit codes
|
|
18
|
-
// 4xx -> 4xxxx
|
|
19
|
-
// 5xx -> 5xxxx
|
|
20
|
-
this.errorCode = errorCode < 1000 ? errorCode * 100 : 50000;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.errorCode = errorCode;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// Convert to API error format
|
|
27
|
-
toApiError() {
|
|
28
|
-
return {
|
|
29
|
-
errorCode: this.errorCode,
|
|
30
|
-
message: this.message
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Maps HTTP status codes to internal error codes
|
|
36
|
-
*/
|
|
37
|
-
export function getErrorCodeFromStatus(status) {
|
|
38
|
-
switch (status) {
|
|
39
|
-
case 400: return 40000; // Bad request
|
|
40
|
-
case 401: return 40100; // Unauthorized
|
|
41
|
-
case 403: return 40300; // Forbidden
|
|
42
|
-
case 404: return 40400; // Not found
|
|
43
|
-
case 405: return 40500; // Method not allowed
|
|
44
|
-
case 409: return 40900; // Conflict
|
|
45
|
-
case 429: return 42900; // Too many requests
|
|
46
|
-
case 500: return 50000; // Internal server error
|
|
47
|
-
case 501: return 50100; // Not implemented
|
|
48
|
-
case 502: return 50200; // Bad gateway
|
|
49
|
-
case 503: return 50300; // Service unavailable
|
|
50
|
-
case 504: return 50400; // Gateway timeout
|
|
51
|
-
default:
|
|
52
|
-
if (status >= 400 && status < 500)
|
|
53
|
-
return 40000 + (status - 400) * 100;
|
|
54
|
-
if (status >= 500 && status < 600)
|
|
55
|
-
return 50000 + (status - 500) * 100;
|
|
56
|
-
return 50000;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/utils/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAMpB;IALF,SAAS,CAAS;IAElC,YACE,OAAe,EACf,YAAoB,KAAK,EAAE,4BAA4B;IACvC,OAAiB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,YAAO,GAAP,OAAO,CAAU;QAGjC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAE5B,4BAA4B;QAC5B,IAAI,SAAS,GAAG,KAAK,IAAI,SAAS,GAAG,KAAK,EAAE,CAAC;YAC3C,6CAA6C;YAC7C,eAAe;YACf,eAAe;YACf,IAAI,CAAC,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,8BAA8B;IAC9B,UAAU;QACR,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,cAAc;QACtC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,eAAe;QACvC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,YAAY;QACpC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,YAAY;QACpC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,qBAAqB;QAC7C,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,WAAW;QACnC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,oBAAoB;QAC5C,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,wBAAwB;QAChD,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,kBAAkB;QAC1C,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,cAAc;QACtC,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,sBAAsB;QAC9C,KAAK,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,kBAAkB;QAC1C;YACE,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;gBAAE,OAAO,KAAK,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YACvE,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;gBAAE,OAAO,KAAK,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YACvE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a unique, URL-friendly, 6-character alphanumeric ID.
|
|
3
|
-
* Uses nanoid's default alphabet (A-Za-z0-9_-).
|
|
4
|
-
*
|
|
5
|
-
* @returns A 6-character string ID.
|
|
6
|
-
*/
|
|
7
|
-
export declare function generateShortId(): string;
|
|
8
|
-
/**
|
|
9
|
-
* Generates a unique ID with a specified prefix and length.
|
|
10
|
-
*
|
|
11
|
-
* @param prefix - The prefix for the ID (e.g., 'prj', 'tsk', 'knw').
|
|
12
|
-
* @param length - The desired length of the random part of the ID (default: 10).
|
|
13
|
-
* @returns A prefixed ID string (e.g., 'prj_aBcDeFgHiJ').
|
|
14
|
-
*/
|
|
15
|
-
export declare function generatePrefixedId(prefix: string, length?: number): string;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { nanoid } from 'nanoid';
|
|
2
|
-
/**
|
|
3
|
-
* Generates a unique, URL-friendly, 6-character alphanumeric ID.
|
|
4
|
-
* Uses nanoid's default alphabet (A-Za-z0-9_-).
|
|
5
|
-
*
|
|
6
|
-
* @returns A 6-character string ID.
|
|
7
|
-
*/
|
|
8
|
-
export function generateShortId() {
|
|
9
|
-
return nanoid(6);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Generates a unique ID with a specified prefix and length.
|
|
13
|
-
*
|
|
14
|
-
* @param prefix - The prefix for the ID (e.g., 'prj', 'tsk', 'knw').
|
|
15
|
-
* @param length - The desired length of the random part of the ID (default: 10).
|
|
16
|
-
* @returns A prefixed ID string (e.g., 'prj_aBcDeFgHiJ').
|
|
17
|
-
*/
|
|
18
|
-
export function generatePrefixedId(prefix, length = 10) {
|
|
19
|
-
return `${prefix}_${nanoid(length)}`;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=idGenerator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"idGenerator.js","sourceRoot":"","sources":["../../src/utils/idGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,SAAiB,EAAE;IACpE,OAAO,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;AACvC,CAAC"}
|
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
|
package/dist/utils/logging.d.ts
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standardized Logging System for the Obsidian MCP Server
|
|
3
|
-
*
|
|
4
|
-
* This module provides structured logging capabilities aligned with MCP best practices.
|
|
5
|
-
* It supports categorized errors, severity levels, context tracking, performance
|
|
6
|
-
* monitoring, and secure logging patterns.
|
|
7
|
-
*
|
|
8
|
-
* @module utils/logging
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Error categories following MCP standards
|
|
12
|
-
*/
|
|
13
|
-
export declare enum ErrorCategoryType {
|
|
14
|
-
CATEGORY_VALIDATION = "VALIDATION",
|
|
15
|
-
CATEGORY_AUTHENTICATION = "AUTHENTICATION",
|
|
16
|
-
CATEGORY_AUTHORIZATION = "AUTHORIZATION",
|
|
17
|
-
CATEGORY_BUSINESS_LOGIC = "BUSINESS_LOGIC",
|
|
18
|
-
CATEGORY_DATA_ACCESS = "DATA_ACCESS",
|
|
19
|
-
CATEGORY_EXTERNAL_SERVICE = "EXTERNAL_SERVICE",
|
|
20
|
-
CATEGORY_SYSTEM = "SYSTEM",
|
|
21
|
-
CATEGORY_UNKNOWN = "UNKNOWN"
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Log levels aligned with MCP's ErrorSeverityLevel
|
|
25
|
-
*/
|
|
26
|
-
export declare enum LogLevel {
|
|
27
|
-
/** Critical errors that require immediate attention */
|
|
28
|
-
ERROR = 0,
|
|
29
|
-
/** Potentially harmful situations that should be reviewed */
|
|
30
|
-
WARN = 1,
|
|
31
|
-
/** General informational messages about system operation */
|
|
32
|
-
INFO = 2,
|
|
33
|
-
/** Detailed information for debugging purposes */
|
|
34
|
-
DEBUG = 3,
|
|
35
|
-
/** Highly detailed tracing information */
|
|
36
|
-
TRACE = 4
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Maps LogLevel to MCP severity level for integration with MCP error handling
|
|
40
|
-
*/
|
|
41
|
-
export declare const logLevelToMcpSeverity: {
|
|
42
|
-
0: number;
|
|
43
|
-
1: number;
|
|
44
|
-
2: number;
|
|
45
|
-
3: number;
|
|
46
|
-
4: number;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Structured log entry interface that follows MCP standards
|
|
50
|
-
*/
|
|
51
|
-
export interface StructuredLogEntry {
|
|
52
|
-
/** Timestamp when the log was created */
|
|
53
|
-
timestamp: string;
|
|
54
|
-
/** Log message */
|
|
55
|
-
message: string;
|
|
56
|
-
/** Component that generated the log */
|
|
57
|
-
component: string;
|
|
58
|
-
/** Log level */
|
|
59
|
-
level: LogLevel;
|
|
60
|
-
/** Optional context data for the log entry */
|
|
61
|
-
context?: Record<string, unknown>;
|
|
62
|
-
/** Optional error information */
|
|
63
|
-
error?: StandardizedErrorObject;
|
|
64
|
-
/** Optional processing time in milliseconds */
|
|
65
|
-
processingTimeMs?: number;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Standardized error object following MCP conventions
|
|
69
|
-
*/
|
|
70
|
-
export interface StandardizedErrorObject {
|
|
71
|
-
/** Human-readable error message */
|
|
72
|
-
errorMessage: string;
|
|
73
|
-
/** Machine-readable error code */
|
|
74
|
-
errorCode: string;
|
|
75
|
-
/** System area affected by the error */
|
|
76
|
-
errorCategory: ErrorCategoryType;
|
|
77
|
-
/** How critical the error is */
|
|
78
|
-
errorSeverity: LogLevel;
|
|
79
|
-
/** When the error occurred */
|
|
80
|
-
errorTimestamp: string;
|
|
81
|
-
/** Additional relevant data */
|
|
82
|
-
errorContext?: Record<string, unknown>;
|
|
83
|
-
/** Stack trace if available */
|
|
84
|
-
errorStack?: string;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Logger configuration
|
|
88
|
-
*/
|
|
89
|
-
export interface LoggerConfig {
|
|
90
|
-
/** Minimum log level to display */
|
|
91
|
-
level: LogLevel;
|
|
92
|
-
/** Whether to include timestamps in log output */
|
|
93
|
-
includeTimestamps: boolean;
|
|
94
|
-
/** Whether to include level in log output */
|
|
95
|
-
includeLevel: boolean;
|
|
96
|
-
/** Whether to mask sensitive data in logs */
|
|
97
|
-
maskSensitiveData: boolean;
|
|
98
|
-
/** List of field names to consider sensitive */
|
|
99
|
-
sensitiveFields: string[];
|
|
100
|
-
/** Directory for log files */
|
|
101
|
-
logDir?: string;
|
|
102
|
-
/** Whether to log to files */
|
|
103
|
-
files?: boolean;
|
|
104
|
-
/** Custom file names for log files */
|
|
105
|
-
fileNames?: {
|
|
106
|
-
combined?: string;
|
|
107
|
-
error?: string;
|
|
108
|
-
warn?: string;
|
|
109
|
-
info?: string;
|
|
110
|
-
debug?: string;
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Enhanced logger for MCP server operations with structured logging support
|
|
115
|
-
* Implements file-based logging with zero console output
|
|
116
|
-
*/
|
|
117
|
-
export declare class Logger {
|
|
118
|
-
private name;
|
|
119
|
-
private config;
|
|
120
|
-
private timers;
|
|
121
|
-
private logger;
|
|
122
|
-
/**
|
|
123
|
-
* Creates a new logger instance
|
|
124
|
-
*
|
|
125
|
-
* @param name - Component name for this logger
|
|
126
|
-
* @param config - Optional configuration overrides
|
|
127
|
-
*/
|
|
128
|
-
constructor(name: string, config?: Partial<LoggerConfig>);
|
|
129
|
-
/**
|
|
130
|
-
* Initialize or reinitialize the Winston logger
|
|
131
|
-
*/
|
|
132
|
-
private initializeLogger;
|
|
133
|
-
/**
|
|
134
|
-
* Maps internal LogLevel to Winston log level
|
|
135
|
-
*/
|
|
136
|
-
private levelToWinstonLevel;
|
|
137
|
-
/**
|
|
138
|
-
* Creates a standardized error object for MCP compatibility
|
|
139
|
-
*
|
|
140
|
-
* @param message - Human-readable error description
|
|
141
|
-
* @param code - Machine-readable error identifier
|
|
142
|
-
* @param category - Type of error
|
|
143
|
-
* @param context - Additional error context
|
|
144
|
-
* @returns Standardized error object
|
|
145
|
-
*/
|
|
146
|
-
createStandardizedError(message: string, code: string, category?: ErrorCategoryType, context?: Record<string, unknown>): StandardizedErrorObject;
|
|
147
|
-
/**
|
|
148
|
-
* Wraps an exception as a standardized error
|
|
149
|
-
*
|
|
150
|
-
* @param error - Original error object
|
|
151
|
-
* @param message - Optional override message
|
|
152
|
-
* @param category - Error category
|
|
153
|
-
* @returns Standardized error object
|
|
154
|
-
*/
|
|
155
|
-
wrapExceptionAsStandardizedError(error: unknown, message?: string, category?: ErrorCategoryType): StandardizedErrorObject;
|
|
156
|
-
/**
|
|
157
|
-
* Masks sensitive data in objects before logging
|
|
158
|
-
*
|
|
159
|
-
* @param data - Data object to process
|
|
160
|
-
* @returns Processed data with sensitive fields masked
|
|
161
|
-
*/
|
|
162
|
-
private processSensitiveData;
|
|
163
|
-
/**
|
|
164
|
-
* Internal method to log a message using Winston
|
|
165
|
-
*
|
|
166
|
-
* @param level - Log level
|
|
167
|
-
* @param message - Log message
|
|
168
|
-
* @param context - Optional context data
|
|
169
|
-
*/
|
|
170
|
-
private log;
|
|
171
|
-
/**
|
|
172
|
-
* Log an error message with optional error object and context
|
|
173
|
-
*
|
|
174
|
-
* @param message - Error message
|
|
175
|
-
* @param errorOrContext - Error object or context
|
|
176
|
-
* @param context - Additional context
|
|
177
|
-
*/
|
|
178
|
-
error(message: string, errorOrContext?: Error | Record<string, unknown>, context?: Record<string, unknown>): void;
|
|
179
|
-
/**
|
|
180
|
-
* Log a warning message
|
|
181
|
-
*
|
|
182
|
-
* @param message - Warning message
|
|
183
|
-
* @param context - Optional context data
|
|
184
|
-
*/
|
|
185
|
-
warn(message: string, context?: Record<string, unknown>): void;
|
|
186
|
-
/**
|
|
187
|
-
* Log an info message
|
|
188
|
-
*
|
|
189
|
-
* @param message - Info message
|
|
190
|
-
* @param context - Optional context data
|
|
191
|
-
*/
|
|
192
|
-
info(message: string, context?: Record<string, unknown>): void;
|
|
193
|
-
/**
|
|
194
|
-
* Log a debug message
|
|
195
|
-
*
|
|
196
|
-
* @param message - Debug message
|
|
197
|
-
* @param context - Optional context data
|
|
198
|
-
*/
|
|
199
|
-
debug(message: string, context?: Record<string, unknown>): void;
|
|
200
|
-
/**
|
|
201
|
-
* Log a trace message
|
|
202
|
-
*
|
|
203
|
-
* @param message - Trace message
|
|
204
|
-
* @param context - Optional context data
|
|
205
|
-
*/
|
|
206
|
-
trace(message: string, context?: Record<string, unknown>): void;
|
|
207
|
-
/**
|
|
208
|
-
* Set the log level
|
|
209
|
-
*
|
|
210
|
-
* @param level - New log level
|
|
211
|
-
*/
|
|
212
|
-
setLevel(level: LogLevel): void;
|
|
213
|
-
/**
|
|
214
|
-
* Start a timer for performance tracking
|
|
215
|
-
*
|
|
216
|
-
* @param id - Timer identifier
|
|
217
|
-
*/
|
|
218
|
-
startTimer(id: string): void;
|
|
219
|
-
/**
|
|
220
|
-
* End a timer and log the elapsed time
|
|
221
|
-
*
|
|
222
|
-
* @param id - Timer identifier
|
|
223
|
-
* @param message - Log message prefix
|
|
224
|
-
* @param level - Log level for the timing message
|
|
225
|
-
*/
|
|
226
|
-
endTimer(id: string, message?: string, level?: LogLevel): number;
|
|
227
|
-
/**
|
|
228
|
-
* Log the result of an operation with timing information
|
|
229
|
-
*
|
|
230
|
-
* @param success - Whether the operation was successful
|
|
231
|
-
* @param operation - Operation name
|
|
232
|
-
* @param elapsedMs - Processing time in milliseconds
|
|
233
|
-
* @param context - Optional operation context
|
|
234
|
-
*/
|
|
235
|
-
logOperationResult(success: boolean, operation: string, elapsedMs: number, context?: Record<string, unknown>): void;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Create and return a namespaced logger
|
|
239
|
-
*
|
|
240
|
-
* @param name - Component name for the logger
|
|
241
|
-
* @param config - Optional configuration overrides
|
|
242
|
-
* @returns Configured logger instance
|
|
243
|
-
*/
|
|
244
|
-
export declare function createLogger(name: string, config?: Partial<LoggerConfig>): Logger;
|
|
245
|
-
export declare const rootLogger: Logger;
|