@aniketbiswas/obsidian-mcp-server 1.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.
- package/LICENSE +21 -0
- package/README.md +232 -0
- package/build/index.d.ts +26 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +148 -0
- package/build/index.js.map +1 -0
- package/build/prompts/index.d.ts +33 -0
- package/build/prompts/index.d.ts.map +1 -0
- package/build/prompts/index.js +152 -0
- package/build/prompts/index.js.map +1 -0
- package/build/prompts/obsidian.d.ts +17 -0
- package/build/prompts/obsidian.d.ts.map +1 -0
- package/build/prompts/obsidian.js +305 -0
- package/build/prompts/obsidian.js.map +1 -0
- package/build/resources/index.d.ts +31 -0
- package/build/resources/index.d.ts.map +1 -0
- package/build/resources/index.js +111 -0
- package/build/resources/index.js.map +1 -0
- package/build/resources/obsidian.d.ts +19 -0
- package/build/resources/obsidian.d.ts.map +1 -0
- package/build/resources/obsidian.js +246 -0
- package/build/resources/obsidian.js.map +1 -0
- package/build/tools/_template.d.ts +23 -0
- package/build/tools/_template.d.ts.map +1 -0
- package/build/tools/_template.js +124 -0
- package/build/tools/_template.js.map +1 -0
- package/build/tools/calculator.d.ts +32 -0
- package/build/tools/calculator.d.ts.map +1 -0
- package/build/tools/calculator.js +130 -0
- package/build/tools/calculator.js.map +1 -0
- package/build/tools/daily-notes.d.ts +19 -0
- package/build/tools/daily-notes.d.ts.map +1 -0
- package/build/tools/daily-notes.js +469 -0
- package/build/tools/daily-notes.js.map +1 -0
- package/build/tools/greeting.d.ts +23 -0
- package/build/tools/greeting.d.ts.map +1 -0
- package/build/tools/greeting.js +111 -0
- package/build/tools/greeting.js.map +1 -0
- package/build/tools/index.d.ts +28 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +46 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/links.d.ts +19 -0
- package/build/tools/links.d.ts.map +1 -0
- package/build/tools/links.js +467 -0
- package/build/tools/links.js.map +1 -0
- package/build/tools/metadata.d.ts +18 -0
- package/build/tools/metadata.d.ts.map +1 -0
- package/build/tools/metadata.js +447 -0
- package/build/tools/metadata.js.map +1 -0
- package/build/tools/navigation.d.ts +19 -0
- package/build/tools/navigation.d.ts.map +1 -0
- package/build/tools/navigation.js +378 -0
- package/build/tools/navigation.js.map +1 -0
- package/build/tools/notes.d.ts +19 -0
- package/build/tools/notes.d.ts.map +1 -0
- package/build/tools/notes.js +622 -0
- package/build/tools/notes.js.map +1 -0
- package/build/tools/search.d.ts +19 -0
- package/build/tools/search.d.ts.map +1 -0
- package/build/tools/search.js +418 -0
- package/build/tools/search.js.map +1 -0
- package/build/tools/templates.d.ts +18 -0
- package/build/tools/templates.d.ts.map +1 -0
- package/build/tools/templates.js +581 -0
- package/build/tools/templates.js.map +1 -0
- package/build/tools/vault.d.ts +19 -0
- package/build/tools/vault.d.ts.map +1 -0
- package/build/tools/vault.js +403 -0
- package/build/tools/vault.js.map +1 -0
- package/build/types/index.d.ts +11 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +11 -0
- package/build/types/index.js.map +1 -0
- package/build/types/obsidian.d.ts +329 -0
- package/build/types/obsidian.d.ts.map +1 -0
- package/build/types/obsidian.js +38 -0
- package/build/types/obsidian.js.map +1 -0
- package/build/utils/client.d.ts +201 -0
- package/build/utils/client.d.ts.map +1 -0
- package/build/utils/client.js +656 -0
- package/build/utils/client.js.map +1 -0
- package/build/utils/config.d.ts +43 -0
- package/build/utils/config.d.ts.map +1 -0
- package/build/utils/config.js +117 -0
- package/build/utils/config.js.map +1 -0
- package/build/utils/frontmatter.d.ts +90 -0
- package/build/utils/frontmatter.d.ts.map +1 -0
- package/build/utils/frontmatter.js +306 -0
- package/build/utils/frontmatter.js.map +1 -0
- package/build/utils/index.d.ts +13 -0
- package/build/utils/index.d.ts.map +1 -0
- package/build/utils/index.js +13 -0
- package/build/utils/index.js.map +1 -0
- package/build/utils/markdown.d.ts +134 -0
- package/build/utils/markdown.d.ts.map +1 -0
- package/build/utils/markdown.js +330 -0
- package/build/utils/markdown.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Configuration Utilities
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Configuration management for the Obsidian MCP server.
|
|
7
|
+
* Handles environment variables and default configuration values.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { ObsidianConfig } from "../types/obsidian.js";
|
|
11
|
+
/**
|
|
12
|
+
* Get the Obsidian configuration from environment variables.
|
|
13
|
+
* Throws an error if the required API key is not set.
|
|
14
|
+
*
|
|
15
|
+
* @returns The complete Obsidian configuration
|
|
16
|
+
* @throws Error if OBSIDIAN_API_KEY environment variable is not set
|
|
17
|
+
*/
|
|
18
|
+
export declare function getConfig(): ObsidianConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Try to get the config without throwing.
|
|
21
|
+
* Returns null if configuration is incomplete.
|
|
22
|
+
*
|
|
23
|
+
* @returns The configuration or null if not available
|
|
24
|
+
*/
|
|
25
|
+
export declare function tryGetConfig(): ObsidianConfig | null;
|
|
26
|
+
/**
|
|
27
|
+
* Check if the required configuration is available.
|
|
28
|
+
*
|
|
29
|
+
* @returns True if configuration is complete
|
|
30
|
+
*/
|
|
31
|
+
export declare function isConfigured(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Get the base URL for the Obsidian API.
|
|
34
|
+
*
|
|
35
|
+
* @param config - The configuration object
|
|
36
|
+
* @returns The base URL string
|
|
37
|
+
*/
|
|
38
|
+
export declare function getBaseUrl(config: ObsidianConfig): string;
|
|
39
|
+
/**
|
|
40
|
+
* Configuration documentation for users
|
|
41
|
+
*/
|
|
42
|
+
export declare const CONFIG_DOCS: string;
|
|
43
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAc9B;;;;;;GAMG;AACH,wBAAgB,SAAS,IAAI,cAAc,CAsB1C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,cAAc,GAAG,IAAI,CAMpD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAGzD;AAiBD;;GAEG;AACH,eAAO,MAAM,WAAW,QAsBvB,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Configuration Utilities
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Configuration management for the Obsidian MCP server.
|
|
7
|
+
* Handles environment variables and default configuration values.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { DEFAULT_CONFIG, } from "../types/obsidian.js";
|
|
11
|
+
/**
|
|
12
|
+
* Environment variable names for configuration
|
|
13
|
+
*/
|
|
14
|
+
const ENV_VARS = {
|
|
15
|
+
API_KEY: "OBSIDIAN_API_KEY",
|
|
16
|
+
HOST: "OBSIDIAN_HOST",
|
|
17
|
+
PORT: "OBSIDIAN_PORT",
|
|
18
|
+
SECURE: "OBSIDIAN_SECURE",
|
|
19
|
+
TIMEOUT: "OBSIDIAN_TIMEOUT",
|
|
20
|
+
VERIFY_SSL: "OBSIDIAN_VERIFY_SSL",
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Get the Obsidian configuration from environment variables.
|
|
24
|
+
* Throws an error if the required API key is not set.
|
|
25
|
+
*
|
|
26
|
+
* @returns The complete Obsidian configuration
|
|
27
|
+
* @throws Error if OBSIDIAN_API_KEY environment variable is not set
|
|
28
|
+
*/
|
|
29
|
+
export function getConfig() {
|
|
30
|
+
const apiKey = process.env[ENV_VARS.API_KEY];
|
|
31
|
+
if (!apiKey) {
|
|
32
|
+
throw new Error(`Missing required environment variable: ${ENV_VARS.API_KEY}\n` +
|
|
33
|
+
"Please set your Obsidian Local REST API key.\n" +
|
|
34
|
+
"You can find this in Obsidian Settings > Local REST API > API Key");
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
apiKey,
|
|
38
|
+
host: process.env[ENV_VARS.HOST] || DEFAULT_CONFIG.host,
|
|
39
|
+
port: parseInt(process.env[ENV_VARS.PORT] || String(DEFAULT_CONFIG.port), 10),
|
|
40
|
+
secure: parseBooleanEnv(ENV_VARS.SECURE, DEFAULT_CONFIG.secure),
|
|
41
|
+
timeout: parseInt(process.env[ENV_VARS.TIMEOUT] || String(DEFAULT_CONFIG.timeout), 10),
|
|
42
|
+
verifySsl: parseBooleanEnv(ENV_VARS.VERIFY_SSL, DEFAULT_CONFIG.verifySsl),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Try to get the config without throwing.
|
|
47
|
+
* Returns null if configuration is incomplete.
|
|
48
|
+
*
|
|
49
|
+
* @returns The configuration or null if not available
|
|
50
|
+
*/
|
|
51
|
+
export function tryGetConfig() {
|
|
52
|
+
try {
|
|
53
|
+
return getConfig();
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if the required configuration is available.
|
|
61
|
+
*
|
|
62
|
+
* @returns True if configuration is complete
|
|
63
|
+
*/
|
|
64
|
+
export function isConfigured() {
|
|
65
|
+
return !!process.env[ENV_VARS.API_KEY];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get the base URL for the Obsidian API.
|
|
69
|
+
*
|
|
70
|
+
* @param config - The configuration object
|
|
71
|
+
* @returns The base URL string
|
|
72
|
+
*/
|
|
73
|
+
export function getBaseUrl(config) {
|
|
74
|
+
const protocol = config.secure ? "https" : "http";
|
|
75
|
+
return `${protocol}://${config.host}:${config.port}`;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Parse a boolean from an environment variable.
|
|
79
|
+
*
|
|
80
|
+
* @param envVar - The environment variable name
|
|
81
|
+
* @param defaultValue - Default value if not set
|
|
82
|
+
* @returns The parsed boolean value
|
|
83
|
+
*/
|
|
84
|
+
function parseBooleanEnv(envVar, defaultValue) {
|
|
85
|
+
const value = process.env[envVar];
|
|
86
|
+
if (value === undefined) {
|
|
87
|
+
return defaultValue;
|
|
88
|
+
}
|
|
89
|
+
return value.toLowerCase() === "true" || value === "1";
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Configuration documentation for users
|
|
93
|
+
*/
|
|
94
|
+
export const CONFIG_DOCS = `
|
|
95
|
+
Obsidian MCP Server Configuration
|
|
96
|
+
=================================
|
|
97
|
+
|
|
98
|
+
Required Environment Variables:
|
|
99
|
+
-------------------------------
|
|
100
|
+
${ENV_VARS.API_KEY} : Your Obsidian Local REST API key (REQUIRED)
|
|
101
|
+
Find it in: Obsidian Settings > Local REST API > API Key
|
|
102
|
+
|
|
103
|
+
Optional Environment Variables:
|
|
104
|
+
-------------------------------
|
|
105
|
+
${ENV_VARS.HOST} : Host where Obsidian runs (default: ${DEFAULT_CONFIG.host})
|
|
106
|
+
${ENV_VARS.PORT} : REST API port (default: ${DEFAULT_CONFIG.port})
|
|
107
|
+
${ENV_VARS.SECURE} : Use HTTPS (default: ${DEFAULT_CONFIG.secure})
|
|
108
|
+
${ENV_VARS.TIMEOUT} : Request timeout in ms (default: ${DEFAULT_CONFIG.timeout})
|
|
109
|
+
${ENV_VARS.VERIFY_SSL} : Verify SSL certificates (default: ${DEFAULT_CONFIG.verifySsl})
|
|
110
|
+
|
|
111
|
+
Example .env file:
|
|
112
|
+
------------------
|
|
113
|
+
${ENV_VARS.API_KEY}=your-api-key-here
|
|
114
|
+
${ENV_VARS.HOST}=127.0.0.1
|
|
115
|
+
${ENV_VARS.PORT}=27124
|
|
116
|
+
`;
|
|
117
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,kBAAkB;IAC3B,UAAU,EAAE,qBAAqB;CACzB,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAE7C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,0CAA0C,QAAQ,CAAC,OAAO,IAAI;YAC5D,gDAAgD;YAChD,mEAAmE,CACtE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM;QACN,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI;QACvD,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QAC7E,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC;QAC/D,OAAO,EAAE,QAAQ,CACf,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,O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CAA0C,cAAc,CAAC,OAAO;EAChF,QAAQ,CAAC,UAAU,yCAAyC,cAAc,CAAC,SAAS;;;;EAIpF,QAAQ,CAAC,OAAO;EAChB,QAAQ,CAAC,IAAI;EACb,QAAQ,CAAC,IAAI;CACd,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Frontmatter Utilities
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Utilities for parsing and manipulating YAML frontmatter in markdown files.
|
|
7
|
+
* Obsidian uses YAML frontmatter for note metadata.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { StandardFrontmatter } from "../types/obsidian.js";
|
|
11
|
+
/**
|
|
12
|
+
* Result of parsing frontmatter from a markdown file.
|
|
13
|
+
*/
|
|
14
|
+
export interface ParsedFrontmatter {
|
|
15
|
+
/** Parsed frontmatter object */
|
|
16
|
+
frontmatter: Record<string, unknown>;
|
|
17
|
+
/** Content without frontmatter */
|
|
18
|
+
body: string;
|
|
19
|
+
/** Raw frontmatter string (including ---) */
|
|
20
|
+
raw: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse YAML frontmatter from markdown content.
|
|
24
|
+
*
|
|
25
|
+
* @param content - The full markdown content
|
|
26
|
+
* @returns Parsed frontmatter and body content
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseFrontmatter(content: string): ParsedFrontmatter;
|
|
29
|
+
/**
|
|
30
|
+
* Convert a frontmatter object to YAML string with delimiters.
|
|
31
|
+
*
|
|
32
|
+
* @param frontmatter - The frontmatter object
|
|
33
|
+
* @returns YAML string with --- delimiters
|
|
34
|
+
*/
|
|
35
|
+
export declare function stringifyFrontmatter(frontmatter: StandardFrontmatter): string;
|
|
36
|
+
/**
|
|
37
|
+
* Update frontmatter in a markdown file.
|
|
38
|
+
*
|
|
39
|
+
* @param content - Original markdown content
|
|
40
|
+
* @param updates - Frontmatter fields to update
|
|
41
|
+
* @returns Updated markdown content
|
|
42
|
+
*/
|
|
43
|
+
export declare function updateFrontmatter(content: string, updates: Partial<StandardFrontmatter>): string;
|
|
44
|
+
/**
|
|
45
|
+
* Remove frontmatter from markdown content.
|
|
46
|
+
*
|
|
47
|
+
* @param content - Markdown content with frontmatter
|
|
48
|
+
* @returns Content without frontmatter
|
|
49
|
+
*/
|
|
50
|
+
export declare function removeFrontmatter(content: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Extract a specific frontmatter field.
|
|
53
|
+
*
|
|
54
|
+
* @param content - Markdown content
|
|
55
|
+
* @param field - Field name to extract
|
|
56
|
+
* @returns The field value or undefined
|
|
57
|
+
*/
|
|
58
|
+
export declare function getFrontmatterField<T = unknown>(content: string, field: string): T | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Add tags to a note's frontmatter.
|
|
61
|
+
*
|
|
62
|
+
* @param content - Markdown content
|
|
63
|
+
* @param tags - Tags to add
|
|
64
|
+
* @returns Updated content
|
|
65
|
+
*/
|
|
66
|
+
export declare function addTags(content: string, tags: string[]): string;
|
|
67
|
+
/**
|
|
68
|
+
* Remove tags from a note's frontmatter.
|
|
69
|
+
*
|
|
70
|
+
* @param content - Markdown content
|
|
71
|
+
* @param tags - Tags to remove
|
|
72
|
+
* @returns Updated content
|
|
73
|
+
*/
|
|
74
|
+
export declare function removeTags(content: string, tags: string[]): string;
|
|
75
|
+
/**
|
|
76
|
+
* Get all tags from a note (frontmatter + inline).
|
|
77
|
+
*
|
|
78
|
+
* @param content - Markdown content
|
|
79
|
+
* @returns Array of unique tags
|
|
80
|
+
*/
|
|
81
|
+
export declare function getAllTags(content: string): string[];
|
|
82
|
+
/**
|
|
83
|
+
* Add aliases to a note's frontmatter.
|
|
84
|
+
*
|
|
85
|
+
* @param content - Markdown content
|
|
86
|
+
* @param aliases - Aliases to add
|
|
87
|
+
* @returns Updated content
|
|
88
|
+
*/
|
|
89
|
+
export declare function addAliases(content: string, aliases: string[]): string;
|
|
90
|
+
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/utils/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;CACb;AAQD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CA8BnE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,mBAAmB,GAAG,MAAM,CAO7E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACpC,MAAM,CAMR;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAC7C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG,SAAS,CAGf;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAY/D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAkBlE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBpD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CASrE"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Frontmatter Utilities
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Utilities for parsing and manipulating YAML frontmatter in markdown files.
|
|
7
|
+
* Obsidian uses YAML frontmatter for note metadata.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Regular expression to match YAML frontmatter.
|
|
12
|
+
* Matches content between --- delimiters at the start of a file.
|
|
13
|
+
*/
|
|
14
|
+
const FRONTMATTER_REGEX = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
|
|
15
|
+
/**
|
|
16
|
+
* Parse YAML frontmatter from markdown content.
|
|
17
|
+
*
|
|
18
|
+
* @param content - The full markdown content
|
|
19
|
+
* @returns Parsed frontmatter and body content
|
|
20
|
+
*/
|
|
21
|
+
export function parseFrontmatter(content) {
|
|
22
|
+
const match = content.match(FRONTMATTER_REGEX);
|
|
23
|
+
if (!match) {
|
|
24
|
+
return {
|
|
25
|
+
frontmatter: {},
|
|
26
|
+
body: content,
|
|
27
|
+
raw: "",
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const raw = match[0];
|
|
31
|
+
const yamlContent = match[1];
|
|
32
|
+
const body = content.slice(raw.length);
|
|
33
|
+
try {
|
|
34
|
+
const frontmatter = parseYaml(yamlContent);
|
|
35
|
+
return {
|
|
36
|
+
frontmatter,
|
|
37
|
+
body,
|
|
38
|
+
raw,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Return empty frontmatter if parsing fails
|
|
43
|
+
return {
|
|
44
|
+
frontmatter: {},
|
|
45
|
+
body: content,
|
|
46
|
+
raw: "",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Convert a frontmatter object to YAML string with delimiters.
|
|
52
|
+
*
|
|
53
|
+
* @param frontmatter - The frontmatter object
|
|
54
|
+
* @returns YAML string with --- delimiters
|
|
55
|
+
*/
|
|
56
|
+
export function stringifyFrontmatter(frontmatter) {
|
|
57
|
+
if (!frontmatter || Object.keys(frontmatter).length === 0) {
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
const yamlContent = stringifyYaml(frontmatter);
|
|
61
|
+
return `---\n${yamlContent}---\n`;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Update frontmatter in a markdown file.
|
|
65
|
+
*
|
|
66
|
+
* @param content - Original markdown content
|
|
67
|
+
* @param updates - Frontmatter fields to update
|
|
68
|
+
* @returns Updated markdown content
|
|
69
|
+
*/
|
|
70
|
+
export function updateFrontmatter(content, updates) {
|
|
71
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
72
|
+
const updatedFrontmatter = { ...frontmatter, ...updates };
|
|
73
|
+
const newFrontmatter = stringifyFrontmatter(updatedFrontmatter);
|
|
74
|
+
return newFrontmatter + body;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Remove frontmatter from markdown content.
|
|
78
|
+
*
|
|
79
|
+
* @param content - Markdown content with frontmatter
|
|
80
|
+
* @returns Content without frontmatter
|
|
81
|
+
*/
|
|
82
|
+
export function removeFrontmatter(content) {
|
|
83
|
+
return parseFrontmatter(content).body;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Extract a specific frontmatter field.
|
|
87
|
+
*
|
|
88
|
+
* @param content - Markdown content
|
|
89
|
+
* @param field - Field name to extract
|
|
90
|
+
* @returns The field value or undefined
|
|
91
|
+
*/
|
|
92
|
+
export function getFrontmatterField(content, field) {
|
|
93
|
+
const { frontmatter } = parseFrontmatter(content);
|
|
94
|
+
return frontmatter[field];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Add tags to a note's frontmatter.
|
|
98
|
+
*
|
|
99
|
+
* @param content - Markdown content
|
|
100
|
+
* @param tags - Tags to add
|
|
101
|
+
* @returns Updated content
|
|
102
|
+
*/
|
|
103
|
+
export function addTags(content, tags) {
|
|
104
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
105
|
+
const existingTags = Array.isArray(frontmatter.tags) ? frontmatter.tags : [];
|
|
106
|
+
// Normalize tags (remove # prefix if present)
|
|
107
|
+
const normalizedTags = tags.map((tag) => (tag.startsWith("#") ? tag.slice(1) : tag));
|
|
108
|
+
// Merge and deduplicate tags
|
|
109
|
+
const allTags = [...new Set([...existingTags, ...normalizedTags])];
|
|
110
|
+
const updatedFrontmatter = { ...frontmatter, tags: allTags };
|
|
111
|
+
return stringifyFrontmatter(updatedFrontmatter) + body;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Remove tags from a note's frontmatter.
|
|
115
|
+
*
|
|
116
|
+
* @param content - Markdown content
|
|
117
|
+
* @param tags - Tags to remove
|
|
118
|
+
* @returns Updated content
|
|
119
|
+
*/
|
|
120
|
+
export function removeTags(content, tags) {
|
|
121
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
122
|
+
if (!Array.isArray(frontmatter.tags)) {
|
|
123
|
+
return content;
|
|
124
|
+
}
|
|
125
|
+
// Normalize tags for comparison
|
|
126
|
+
const tagsToRemove = new Set(tags.map((tag) => (tag.startsWith("#") ? tag.slice(1) : tag).toLowerCase()));
|
|
127
|
+
const filteredTags = frontmatter.tags.filter((tag) => !tagsToRemove.has(tag.toLowerCase()));
|
|
128
|
+
const updatedFrontmatter = { ...frontmatter, tags: filteredTags };
|
|
129
|
+
return stringifyFrontmatter(updatedFrontmatter) + body;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get all tags from a note (frontmatter + inline).
|
|
133
|
+
*
|
|
134
|
+
* @param content - Markdown content
|
|
135
|
+
* @returns Array of unique tags
|
|
136
|
+
*/
|
|
137
|
+
export function getAllTags(content) {
|
|
138
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
139
|
+
const tags = new Set();
|
|
140
|
+
// Get tags from frontmatter
|
|
141
|
+
if (Array.isArray(frontmatter.tags)) {
|
|
142
|
+
frontmatter.tags.forEach((tag) => tags.add(tag));
|
|
143
|
+
}
|
|
144
|
+
// Find inline tags (#tag format)
|
|
145
|
+
const inlineTagRegex = /#([a-zA-Z][a-zA-Z0-9_/-]*)/g;
|
|
146
|
+
let match;
|
|
147
|
+
while ((match = inlineTagRegex.exec(body)) !== null) {
|
|
148
|
+
tags.add(match[1]);
|
|
149
|
+
}
|
|
150
|
+
return Array.from(tags);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Add aliases to a note's frontmatter.
|
|
154
|
+
*
|
|
155
|
+
* @param content - Markdown content
|
|
156
|
+
* @param aliases - Aliases to add
|
|
157
|
+
* @returns Updated content
|
|
158
|
+
*/
|
|
159
|
+
export function addAliases(content, aliases) {
|
|
160
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
161
|
+
const existingAliases = Array.isArray(frontmatter.aliases) ? frontmatter.aliases : [];
|
|
162
|
+
// Merge and deduplicate aliases
|
|
163
|
+
const allAliases = [...new Set([...existingAliases, ...aliases])];
|
|
164
|
+
const updatedFrontmatter = { ...frontmatter, aliases: allAliases };
|
|
165
|
+
return stringifyFrontmatter(updatedFrontmatter) + body;
|
|
166
|
+
}
|
|
167
|
+
// =============================================================================
|
|
168
|
+
// Simple YAML Parser/Stringifier
|
|
169
|
+
// =============================================================================
|
|
170
|
+
// We implement a simple YAML parser to avoid external dependencies.
|
|
171
|
+
// This handles the common frontmatter use cases in Obsidian.
|
|
172
|
+
// =============================================================================
|
|
173
|
+
/**
|
|
174
|
+
* Parse a simple YAML string into an object.
|
|
175
|
+
* Handles common frontmatter patterns: strings, numbers, booleans, arrays, simple objects.
|
|
176
|
+
*/
|
|
177
|
+
function parseYaml(yaml) {
|
|
178
|
+
const result = {};
|
|
179
|
+
const lines = yaml.split(/\r?\n/);
|
|
180
|
+
let currentKey = "";
|
|
181
|
+
let currentArray = null;
|
|
182
|
+
for (const line of lines) {
|
|
183
|
+
// Skip empty lines
|
|
184
|
+
if (!line.trim())
|
|
185
|
+
continue;
|
|
186
|
+
// Check for array item
|
|
187
|
+
if (line.match(/^\s*-\s+/)) {
|
|
188
|
+
if (currentArray !== null) {
|
|
189
|
+
const value = line.replace(/^\s*-\s+/, "").trim();
|
|
190
|
+
currentArray.push(parseYamlValue(value));
|
|
191
|
+
}
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
// Check for key-value pair
|
|
195
|
+
const keyMatch = line.match(/^([a-zA-Z_][a-zA-Z0-9_-]*)\s*:\s*(.*)?$/);
|
|
196
|
+
if (keyMatch) {
|
|
197
|
+
// Save previous array if any
|
|
198
|
+
if (currentArray !== null && currentKey) {
|
|
199
|
+
result[currentKey] = currentArray;
|
|
200
|
+
currentArray = null;
|
|
201
|
+
}
|
|
202
|
+
currentKey = keyMatch[1];
|
|
203
|
+
const valueStr = keyMatch[2]?.trim();
|
|
204
|
+
if (!valueStr) {
|
|
205
|
+
// Empty value might indicate start of array or nested object
|
|
206
|
+
currentArray = [];
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
result[currentKey] = parseYamlValue(valueStr);
|
|
210
|
+
currentArray = null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Save final array if any
|
|
215
|
+
if (currentArray !== null && currentKey) {
|
|
216
|
+
result[currentKey] = currentArray;
|
|
217
|
+
}
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Parse a single YAML value.
|
|
222
|
+
*/
|
|
223
|
+
function parseYamlValue(value) {
|
|
224
|
+
// Handle quoted strings
|
|
225
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
226
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
227
|
+
return value.slice(1, -1);
|
|
228
|
+
}
|
|
229
|
+
// Handle booleans
|
|
230
|
+
if (value.toLowerCase() === "true")
|
|
231
|
+
return true;
|
|
232
|
+
if (value.toLowerCase() === "false")
|
|
233
|
+
return false;
|
|
234
|
+
// Handle null
|
|
235
|
+
if (value.toLowerCase() === "null" || value === "~")
|
|
236
|
+
return null;
|
|
237
|
+
// Handle numbers
|
|
238
|
+
if (/^-?\d+$/.test(value))
|
|
239
|
+
return parseInt(value, 10);
|
|
240
|
+
if (/^-?\d+\.\d+$/.test(value))
|
|
241
|
+
return parseFloat(value);
|
|
242
|
+
// Handle inline arrays [item1, item2]
|
|
243
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
244
|
+
const inner = value.slice(1, -1);
|
|
245
|
+
if (!inner.trim())
|
|
246
|
+
return [];
|
|
247
|
+
return inner.split(",").map((item) => parseYamlValue(item.trim()));
|
|
248
|
+
}
|
|
249
|
+
// Return as string
|
|
250
|
+
return value;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Convert an object to YAML string.
|
|
254
|
+
*/
|
|
255
|
+
function stringifyYaml(obj, indent = 0) {
|
|
256
|
+
const lines = [];
|
|
257
|
+
const prefix = " ".repeat(indent);
|
|
258
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
259
|
+
if (value === undefined)
|
|
260
|
+
continue;
|
|
261
|
+
if (Array.isArray(value)) {
|
|
262
|
+
if (value.length === 0) {
|
|
263
|
+
lines.push(`${prefix}${key}: []`);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
lines.push(`${prefix}${key}:`);
|
|
267
|
+
for (const item of value) {
|
|
268
|
+
lines.push(`${prefix} - ${stringifyYamlValue(item)}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else if (typeof value === "object" && value !== null) {
|
|
273
|
+
lines.push(`${prefix}${key}:`);
|
|
274
|
+
lines.push(stringifyYaml(value, indent + 1));
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
lines.push(`${prefix}${key}: ${stringifyYamlValue(value)}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return lines.join("\n") + (indent === 0 ? "\n" : "");
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Convert a single value to YAML string.
|
|
284
|
+
*/
|
|
285
|
+
function stringifyYamlValue(value) {
|
|
286
|
+
if (value === null)
|
|
287
|
+
return "null";
|
|
288
|
+
if (typeof value === "boolean")
|
|
289
|
+
return value ? "true" : "false";
|
|
290
|
+
if (typeof value === "number")
|
|
291
|
+
return String(value);
|
|
292
|
+
if (typeof value === "string") {
|
|
293
|
+
// Quote strings that need it
|
|
294
|
+
if (value.includes(":") ||
|
|
295
|
+
value.includes("#") ||
|
|
296
|
+
value.includes("\n") ||
|
|
297
|
+
value.startsWith(" ") ||
|
|
298
|
+
value.endsWith(" ") ||
|
|
299
|
+
/^[\[\]{}>|*&!%@`]/.test(value)) {
|
|
300
|
+
return `"${value.replace(/"/g, '\\"')}"`;
|
|
301
|
+
}
|
|
302
|
+
return value;
|
|
303
|
+
}
|
|
304
|
+
return String(value);
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=frontmatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/utils/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH;;;GAGG;AACH,MAAM,iBAAiB,GAAG,mCAAmC,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,WAAW,EAAE,EAAE;YACf,IAAI,EA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KAAc;IACxC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,6BAA6B;QAC7B,IACE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YACnB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YACnB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;YACpB,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;YACrB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YACnB,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,EAC/B,CAAC;YACD,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;QAC3C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Utilities Index
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Central export point for all utility modules.
|
|
7
|
+
* ============================================================================
|
|
8
|
+
*/
|
|
9
|
+
export * from "./config.js";
|
|
10
|
+
export * from "./client.js";
|
|
11
|
+
export * from "./frontmatter.js";
|
|
12
|
+
export * from "./markdown.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Utilities Index
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Central export point for all utility modules.
|
|
7
|
+
* ============================================================================
|
|
8
|
+
*/
|
|
9
|
+
export * from "./config.js";
|
|
10
|
+
export * from "./client.js";
|
|
11
|
+
export * from "./frontmatter.js";
|
|
12
|
+
export * from "./markdown.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|