obsidian-mcp-server 1.2.6 → 1.4.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/README.md +54 -10
- package/build/index.js +12 -3
- package/build/mcp/handlers.js +138 -0
- package/build/mcp/index.js +7 -0
- package/build/mcp/server.js +131 -0
- package/build/mcp/types.js +7 -0
- package/build/{obsidian.js → obsidian/client.js} +156 -104
- package/build/obsidian/errors.js +75 -0
- package/build/obsidian/index.js +7 -0
- package/build/obsidian/types.js +12 -0
- package/build/resources/index.js +15 -0
- package/build/{resources.js → resources/tags.js} +35 -14
- package/build/resources/types.js +5 -0
- package/build/tools/base.js +78 -0
- package/build/tools/files/content.js +171 -0
- package/build/tools/files/index.js +22 -0
- package/build/tools/files/list.js +133 -0
- package/build/tools/index.js +31 -0
- package/build/tools/properties/index.js +19 -0
- package/build/{properties.js → tools/properties/manager.js} +50 -13
- package/build/{propertyTools.js → tools/properties/tools.js} +22 -6
- package/build/{propertyTypes.js → tools/properties/types.js} +19 -7
- package/build/tools/search/complex.js +203 -0
- package/build/tools/search/index.js +20 -0
- package/build/tools/search/simple.js +127 -0
- package/build/utils/errors.js +59 -0
- package/build/utils/index.js +9 -0
- package/build/utils/logging.js +119 -0
- package/build/utils/rate-limiting.js +94 -0
- package/build/utils/tokenization.js +62 -0
- package/build/utils/validation.js +88 -0
- package/examples/README.md +48 -0
- package/examples/append-content.md +63 -0
- package/examples/complex-search.md +117 -0
- package/examples/find-in-file.md +94 -0
- package/examples/get-file-contents.md +72 -0
- package/examples/get-properties.md +89 -0
- package/examples/list-files-in-dir.md +55 -0
- package/examples/list-files-in-vault.md +53 -0
- package/examples/patch-content.md +60 -0
- package/examples/update-properties.md +126 -0
- package/mcp-client-config.example.json +23 -0
- package/package.json +4 -3
- package/src/index.ts +13 -3
- package/src/mcp/handlers.ts +183 -0
- package/src/mcp/index.ts +6 -0
- package/src/mcp/server.ts +162 -0
- package/src/mcp/types.ts +46 -0
- package/src/{obsidian.ts → obsidian/client.ts} +174 -134
- package/src/obsidian/errors.ts +105 -0
- package/src/obsidian/index.ts +6 -0
- package/src/obsidian/types.ts +124 -0
- package/src/resources/index.ts +17 -0
- package/src/{resources.ts → resources/tags.ts} +42 -16
- package/src/resources/types.ts +30 -0
- package/src/tools/base.ts +112 -0
- package/src/tools/files/content.ts +206 -0
- package/src/tools/files/index.ts +31 -0
- package/src/tools/files/list.ts +150 -0
- package/src/tools/index.ts +38 -0
- package/src/tools/properties/index.ts +21 -0
- package/src/{properties.ts → tools/properties/manager.ts} +54 -13
- package/src/{propertyTools.ts → tools/properties/tools.ts} +33 -7
- package/src/{propertyTypes.ts → tools/properties/types.ts} +31 -7
- package/src/tools/search/complex.ts +231 -0
- package/src/tools/search/index.ts +22 -0
- package/src/tools/search/simple.ts +147 -0
- package/src/utils/errors.ts +69 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/logging.ts +146 -0
- package/src/utils/rate-limiting.ts +114 -0
- package/src/utils/tokenization.ts +71 -0
- package/src/utils/validation.ts +95 -0
- package/build/server.js +0 -238
- package/build/tools.js +0 -863
- package/build/types.js +0 -37
- package/src/server.ts +0 -308
- package/src/tools.ts +0 -946
- package/src/types.ts +0 -184
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Find in File Tool Example
|
|
2
|
+
|
|
3
|
+
## Request 1 (Many Results)
|
|
4
|
+
```json
|
|
5
|
+
{
|
|
6
|
+
"query": "tags:",
|
|
7
|
+
"contextLength": 20
|
|
8
|
+
}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Response 1
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"message": "Found 34 files with matches. Showing file names only:",
|
|
15
|
+
"results": [
|
|
16
|
+
{
|
|
17
|
+
"filename": "Projects/Project Alpha/Documentation/Requirements.md",
|
|
18
|
+
"matchCount": 1
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"filename": "Projects/Project Beta/Specifications.md",
|
|
22
|
+
"matchCount": 2
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"filename": "Daily Notes/2024-01-25.md",
|
|
26
|
+
"matchCount": 1
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Request 2 (Few Results)
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"query": "priority: high",
|
|
36
|
+
"contextLength": 50
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Response 2
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"results": [
|
|
44
|
+
{
|
|
45
|
+
"filename": "Projects/Project Alpha/tasks.md",
|
|
46
|
+
"matches": [
|
|
47
|
+
{
|
|
48
|
+
"line": 15,
|
|
49
|
+
"content": "---\ntitle: Critical Tasks\ntags: [tasks, urgent]\npriority: high\n---\n\n# High Priority Tasks",
|
|
50
|
+
"matchStart": 45,
|
|
51
|
+
"matchEnd": 57
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"filename": "Areas/Work/Deadlines.md",
|
|
57
|
+
"matches": [
|
|
58
|
+
{
|
|
59
|
+
"line": 8,
|
|
60
|
+
"content": "## Q1 Deliverables\n- [ ] Feature launch (priority: high)\n- [ ] Security audit",
|
|
61
|
+
"matchStart": 35,
|
|
62
|
+
"matchEnd": 47
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Example Use Cases
|
|
71
|
+
|
|
72
|
+
1. **Content Search**
|
|
73
|
+
- Find notes with specific tags or properties
|
|
74
|
+
- Search for keywords across the vault
|
|
75
|
+
- Locate specific metadata patterns
|
|
76
|
+
|
|
77
|
+
2. **Task Management**
|
|
78
|
+
- Find high-priority tasks
|
|
79
|
+
- Search for incomplete items
|
|
80
|
+
- Locate notes with specific status
|
|
81
|
+
|
|
82
|
+
3. **Knowledge Discovery**
|
|
83
|
+
- Find related content across notes
|
|
84
|
+
- Search for specific topics or references
|
|
85
|
+
- Identify patterns in note metadata
|
|
86
|
+
|
|
87
|
+
## Notes
|
|
88
|
+
- Returns either file list or detailed matches based on result count
|
|
89
|
+
- Provides line numbers for precise location
|
|
90
|
+
- Shows surrounding context for each match
|
|
91
|
+
- Context length is customizable
|
|
92
|
+
- Supports searching in frontmatter and note content
|
|
93
|
+
- Results include match position information
|
|
94
|
+
- Can search across all vault files
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Get File Contents Tool Example
|
|
2
|
+
|
|
3
|
+
## Request
|
|
4
|
+
```json
|
|
5
|
+
{
|
|
6
|
+
"filepath": "Projects/Project Alpha/Documentation/Requirements.md"
|
|
7
|
+
}
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Response
|
|
11
|
+
```markdown
|
|
12
|
+
---
|
|
13
|
+
title: Project Requirements
|
|
14
|
+
tags: [project, requirements, documentation]
|
|
15
|
+
status: [in-progress]
|
|
16
|
+
created: 2024-01-20
|
|
17
|
+
modified: 2024-01-25
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Project Requirements Document
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
This document outlines the key requirements for Project Alpha.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
1. User Authentication
|
|
27
|
+
- [ ] Login system
|
|
28
|
+
- [ ] Password recovery
|
|
29
|
+
- [ ] Two-factor authentication
|
|
30
|
+
|
|
31
|
+
2. Data Management
|
|
32
|
+
- [ ] Database integration
|
|
33
|
+
- [ ] Backup system
|
|
34
|
+
- [x] Data validation
|
|
35
|
+
|
|
36
|
+
## Related Documents
|
|
37
|
+
- [[Architecture Overview]]
|
|
38
|
+
- [[Technical Specifications]]
|
|
39
|
+
- [[Meeting Notes/Kickoff Meeting]]
|
|
40
|
+
|
|
41
|
+
## References
|
|
42
|
+
![[project-diagram.png]]
|
|
43
|
+
|
|
44
|
+
#project-alpha #documentation #requirements
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Example Use Cases
|
|
48
|
+
|
|
49
|
+
1. **Content Retrieval**
|
|
50
|
+
- Access note contents for reading or processing
|
|
51
|
+
- Extract metadata from YAML frontmatter
|
|
52
|
+
- Parse markdown formatting
|
|
53
|
+
|
|
54
|
+
2. **Document Analysis**
|
|
55
|
+
- Review document structure
|
|
56
|
+
- Extract links and references
|
|
57
|
+
- Process task lists and status
|
|
58
|
+
|
|
59
|
+
3. **Integration**
|
|
60
|
+
- Import content into other systems
|
|
61
|
+
- Process notes programmatically
|
|
62
|
+
- Extract specific sections or metadata
|
|
63
|
+
|
|
64
|
+
## Notes
|
|
65
|
+
- Returns raw markdown content including YAML frontmatter
|
|
66
|
+
- Preserves all formatting, links, and special syntax
|
|
67
|
+
- Handles various Obsidian-specific markdown features:
|
|
68
|
+
* Wiki-style links: [[Page Name]]
|
|
69
|
+
* Tags: #tag-name
|
|
70
|
+
* Embedded content: ![[file.png]]
|
|
71
|
+
* Task lists: - [ ] todo item
|
|
72
|
+
- File path is relative to vault root
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Get Properties Tool Example
|
|
2
|
+
|
|
3
|
+
## Request
|
|
4
|
+
```json
|
|
5
|
+
{
|
|
6
|
+
"filepath": "Projects/Project Alpha/Documentation/Requirements.md"
|
|
7
|
+
}
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Response
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"properties": {
|
|
14
|
+
"title": "Project Requirements",
|
|
15
|
+
"tags": ["project", "requirements", "documentation"],
|
|
16
|
+
"status": ["in-progress"],
|
|
17
|
+
"created": "2024-01-20",
|
|
18
|
+
"modified": "2024-01-25",
|
|
19
|
+
"type": ["technical", "specification"],
|
|
20
|
+
"author": "Team Lead",
|
|
21
|
+
"version": "1.0",
|
|
22
|
+
"reviewers": ["Tech Lead", "Product Manager"],
|
|
23
|
+
"priority": "high"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Example Use Cases
|
|
29
|
+
|
|
30
|
+
1. **Metadata Management**
|
|
31
|
+
- Extract note properties
|
|
32
|
+
- Review document metadata
|
|
33
|
+
- Track document status
|
|
34
|
+
|
|
35
|
+
2. **Content Organization**
|
|
36
|
+
- Get tags for categorization
|
|
37
|
+
- Check document status
|
|
38
|
+
- Review creation/modification dates
|
|
39
|
+
|
|
40
|
+
3. **Project Tracking**
|
|
41
|
+
- Monitor document versions
|
|
42
|
+
- Track review status
|
|
43
|
+
- Identify document owners
|
|
44
|
+
|
|
45
|
+
## Notes
|
|
46
|
+
- Extracts YAML frontmatter from markdown files
|
|
47
|
+
- Returns structured JSON object
|
|
48
|
+
- Supports various property types:
|
|
49
|
+
* Strings
|
|
50
|
+
* Arrays
|
|
51
|
+
* Dates
|
|
52
|
+
* Numbers
|
|
53
|
+
* Boolean values
|
|
54
|
+
- Common properties:
|
|
55
|
+
* title: Document title
|
|
56
|
+
* tags: Categorization tags
|
|
57
|
+
* status: Document status
|
|
58
|
+
* created/modified: Timestamps
|
|
59
|
+
* type: Content type
|
|
60
|
+
* author: Content creator
|
|
61
|
+
* version: Document version
|
|
62
|
+
* custom fields: Any additional metadata
|
|
63
|
+
|
|
64
|
+
## Property Types
|
|
65
|
+
1. **Basic Properties**
|
|
66
|
+
```yaml
|
|
67
|
+
title: "Document Title"
|
|
68
|
+
author: "John Doe"
|
|
69
|
+
version: 1.0
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
2. **Array Properties**
|
|
73
|
+
```yaml
|
|
74
|
+
tags: [project, documentation]
|
|
75
|
+
status: [draft, review]
|
|
76
|
+
reviewers: [Alice, Bob]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. **Date Properties**
|
|
80
|
+
```yaml
|
|
81
|
+
created: 2024-01-20
|
|
82
|
+
due: 2024-02-01
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
4. **Custom Properties**
|
|
86
|
+
```yaml
|
|
87
|
+
priority: high
|
|
88
|
+
department: Engineering
|
|
89
|
+
confidential: true
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# List Files in Directory Tool Example
|
|
2
|
+
|
|
3
|
+
## Request
|
|
4
|
+
```json
|
|
5
|
+
{
|
|
6
|
+
"dirpath": "Projects/Project Alpha"
|
|
7
|
+
}
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Response
|
|
11
|
+
```
|
|
12
|
+
Documentation/
|
|
13
|
+
Documentation/Requirements.md
|
|
14
|
+
Documentation/Architecture.md
|
|
15
|
+
Notes/
|
|
16
|
+
Notes/Meeting Notes.md
|
|
17
|
+
Notes/Research.md
|
|
18
|
+
Resources/
|
|
19
|
+
Resources/Images/
|
|
20
|
+
Resources/References/
|
|
21
|
+
tasks.md
|
|
22
|
+
timeline.md
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Example Use Cases
|
|
26
|
+
|
|
27
|
+
1. **Project Organization**
|
|
28
|
+
- Browse project-specific files and folders
|
|
29
|
+
- Navigate through project documentation
|
|
30
|
+
- Find relevant project resources
|
|
31
|
+
|
|
32
|
+
2. **Content Discovery**
|
|
33
|
+
- Locate specific project documents
|
|
34
|
+
- Access meeting notes and research
|
|
35
|
+
- Review project structure
|
|
36
|
+
|
|
37
|
+
3. **Knowledge Management**
|
|
38
|
+
- Organize project materials
|
|
39
|
+
- Track project documentation
|
|
40
|
+
- Maintain clear folder hierarchies
|
|
41
|
+
|
|
42
|
+
## Notes
|
|
43
|
+
- Returns contents of a specific directory path
|
|
44
|
+
- Shows both subdirectories and files
|
|
45
|
+
- Directory paths end with a forward slash (/)
|
|
46
|
+
- Results are alphabetically sorted
|
|
47
|
+
- Empty directories are included in the results
|
|
48
|
+
- Path is relative to vault root
|
|
49
|
+
|
|
50
|
+
## Common Directory Structures
|
|
51
|
+
The example shows a typical project organization:
|
|
52
|
+
- Documentation/ - Project requirements and architecture
|
|
53
|
+
- Notes/ - Meeting notes and research findings
|
|
54
|
+
- Resources/ - Project assets and references
|
|
55
|
+
- Root level files for quick access to important information
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# List Files in Vault Tool Example
|
|
2
|
+
|
|
3
|
+
## Request
|
|
4
|
+
```json
|
|
5
|
+
{
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {}
|
|
8
|
+
}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Response
|
|
12
|
+
```
|
|
13
|
+
Areas/
|
|
14
|
+
Areas/Work/
|
|
15
|
+
Areas/Personal/
|
|
16
|
+
Areas/Projects/
|
|
17
|
+
Resources/
|
|
18
|
+
Resources/Templates/
|
|
19
|
+
Resources/Attachments/
|
|
20
|
+
Daily Notes/
|
|
21
|
+
Daily Notes/2024-01-25.md
|
|
22
|
+
Projects/
|
|
23
|
+
Projects/Project Alpha/
|
|
24
|
+
Projects/Project Beta/
|
|
25
|
+
Archive/
|
|
26
|
+
README.md
|
|
27
|
+
index.md
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example Use Cases
|
|
31
|
+
|
|
32
|
+
1. **Vault Organization**
|
|
33
|
+
- Get a complete overview of your vault structure
|
|
34
|
+
- Identify main areas and categories
|
|
35
|
+
- Plan content organization
|
|
36
|
+
|
|
37
|
+
2. **Content Management**
|
|
38
|
+
- Find important directories and files
|
|
39
|
+
- Review vault hierarchy
|
|
40
|
+
- Locate specific resources
|
|
41
|
+
|
|
42
|
+
3. **Navigation**
|
|
43
|
+
- Quick access to key areas
|
|
44
|
+
- Browse through project directories
|
|
45
|
+
- Find templates and resources
|
|
46
|
+
|
|
47
|
+
## Notes
|
|
48
|
+
- The tool returns both files and directories at the root level
|
|
49
|
+
- Directory paths end with a forward slash (/)
|
|
50
|
+
- File extensions are preserved in the output
|
|
51
|
+
- Results are alphabetically sorted
|
|
52
|
+
- Special characters in filenames are preserved
|
|
53
|
+
- Provides a hierarchical view of your vault structure
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Patch Content Tool Example
|
|
2
|
+
|
|
3
|
+
## Request 1 (Update Existing Note)
|
|
4
|
+
```json
|
|
5
|
+
{
|
|
6
|
+
"filepath": "Projects/Project Alpha/Documentation/Architecture.md",
|
|
7
|
+
"content": "---\ntitle: System Architecture\ntags: [architecture, documentation]\nstatus: [complete]\nmodified: 2024-01-25\n---\n\n# System Architecture\n\n## Overview\nThis document describes the high-level architecture of Project Alpha.\n\n## Components\n\n### Frontend\n- React-based web application\n- Material UI components\n- Redux state management\n\n### Backend\n- Node.js REST API\n- PostgreSQL database\n- Redis caching layer\n\n### Infrastructure\n- AWS cloud hosting\n- Docker containerization\n- CI/CD pipeline\n\n## System Diagram\n![[architecture-diagram.png]]\n\n## Integration Points\n- Authentication service\n- Payment processing\n- Email service\n- Analytics platform\n\n#project-alpha #architecture #technical"
|
|
8
|
+
}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Response 1
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"success": true,
|
|
15
|
+
"message": "File content updated successfully"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Request 2 (Create New Note)
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"filepath": "Templates/Meeting Note.md",
|
|
23
|
+
"content": "---\ntitle: {{title}}\ndate: {{date}}\nattendees: \ntags: [meeting]\nstatus: [draft]\n---\n\n# {{title}}\n\n## Agenda\n1. \n2. \n3. \n\n## Discussion Points\n- \n\n## Decisions\n- \n\n## Action Items\n- [ ] \n- [ ] \n- [ ] \n\n## Next Steps\n- \n\n## Notes\n- "
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Response 2
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"success": true,
|
|
31
|
+
"message": "File created successfully"
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Example Use Cases
|
|
36
|
+
|
|
37
|
+
1. **Document Updates**
|
|
38
|
+
- Complete revision of documentation
|
|
39
|
+
- Update outdated content
|
|
40
|
+
- Replace temporary content with final version
|
|
41
|
+
|
|
42
|
+
2. **Template Creation**
|
|
43
|
+
- Create note templates
|
|
44
|
+
- Define standardized formats
|
|
45
|
+
- Set up reusable structures
|
|
46
|
+
|
|
47
|
+
3. **Content Migration**
|
|
48
|
+
- Move and reformat content
|
|
49
|
+
- Update note structure
|
|
50
|
+
- Implement new organization systems
|
|
51
|
+
|
|
52
|
+
## Notes
|
|
53
|
+
- Replaces entire file content or creates new file
|
|
54
|
+
- Supports YAML frontmatter
|
|
55
|
+
- Handles template variables
|
|
56
|
+
- Preserves markdown formatting
|
|
57
|
+
- Creates parent directories if needed
|
|
58
|
+
- Validates content structure
|
|
59
|
+
- File path is relative to vault root
|
|
60
|
+
- Useful for major content revisions
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Update Properties Tool Example
|
|
2
|
+
|
|
3
|
+
## Request 1 (Update Multiple Properties)
|
|
4
|
+
```json
|
|
5
|
+
{
|
|
6
|
+
"filepath": "Projects/Project Alpha/Documentation/Requirements.md",
|
|
7
|
+
"properties": {
|
|
8
|
+
"status": ["in-review"],
|
|
9
|
+
"tags": ["project", "requirements", "documentation", "technical"],
|
|
10
|
+
"modified": "2024-01-25",
|
|
11
|
+
"reviewers": ["Tech Lead", "Product Manager", "Security Team"],
|
|
12
|
+
"version": "1.1"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Response 1
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"success": true,
|
|
21
|
+
"message": "Properties updated successfully"
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Request 2 (Merge Array Properties)
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"filepath": "Projects/Project Beta/Specifications.md",
|
|
29
|
+
"properties": {
|
|
30
|
+
"tags": ["api", "backend"],
|
|
31
|
+
"status": ["draft"]
|
|
32
|
+
},
|
|
33
|
+
"replace": false
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Response 2
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"success": true,
|
|
41
|
+
"message": "Properties merged successfully"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Example Use Cases
|
|
46
|
+
|
|
47
|
+
1. **Document Management**
|
|
48
|
+
- Update document status
|
|
49
|
+
- Add or remove tags
|
|
50
|
+
- Track document versions
|
|
51
|
+
- Manage review process
|
|
52
|
+
|
|
53
|
+
2. **Project Tracking**
|
|
54
|
+
- Update task status
|
|
55
|
+
- Assign reviewers
|
|
56
|
+
- Track modifications
|
|
57
|
+
- Version control
|
|
58
|
+
|
|
59
|
+
3. **Content Organization**
|
|
60
|
+
- Categorize content
|
|
61
|
+
- Update metadata
|
|
62
|
+
- Manage document lifecycle
|
|
63
|
+
- Track document history
|
|
64
|
+
|
|
65
|
+
## Notes
|
|
66
|
+
- Updates YAML frontmatter properties
|
|
67
|
+
- Supports property merging or replacement
|
|
68
|
+
- Handles various property types:
|
|
69
|
+
* Strings
|
|
70
|
+
* Arrays
|
|
71
|
+
* Dates
|
|
72
|
+
* Numbers
|
|
73
|
+
* Boolean values
|
|
74
|
+
- Preserves existing properties not specified in update
|
|
75
|
+
- Automatically updates modified timestamp
|
|
76
|
+
- Creates properties if they don't exist
|
|
77
|
+
|
|
78
|
+
## Property Handling
|
|
79
|
+
|
|
80
|
+
1. **Array Merging (replace: false)**
|
|
81
|
+
```yaml
|
|
82
|
+
# Original
|
|
83
|
+
tags: [project, draft]
|
|
84
|
+
status: [review]
|
|
85
|
+
|
|
86
|
+
# Update
|
|
87
|
+
tags: [technical, draft]
|
|
88
|
+
status: [complete]
|
|
89
|
+
|
|
90
|
+
# Result
|
|
91
|
+
tags: [project, draft, technical]
|
|
92
|
+
status: [review, complete]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
2. **Array Replacement (replace: true)**
|
|
96
|
+
```yaml
|
|
97
|
+
# Original
|
|
98
|
+
reviewers: [Alice, Bob]
|
|
99
|
+
tags: [draft]
|
|
100
|
+
|
|
101
|
+
# Update (replace: true)
|
|
102
|
+
reviewers: [Charlie]
|
|
103
|
+
tags: [final]
|
|
104
|
+
|
|
105
|
+
# Result
|
|
106
|
+
reviewers: [Charlie]
|
|
107
|
+
tags: [final]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
3. **Property Types**
|
|
111
|
+
```yaml
|
|
112
|
+
# String properties
|
|
113
|
+
title: "Updated Title"
|
|
114
|
+
author: "New Author"
|
|
115
|
+
|
|
116
|
+
# Date properties
|
|
117
|
+
modified: 2024-01-25
|
|
118
|
+
due: 2024-02-01
|
|
119
|
+
|
|
120
|
+
# Number properties
|
|
121
|
+
version: 2.0
|
|
122
|
+
priority: 1
|
|
123
|
+
|
|
124
|
+
# Boolean properties
|
|
125
|
+
published: true
|
|
126
|
+
confidential: false
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"obsidian-mcp-server": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": [
|
|
6
|
+
"/path/to/obsidian-mcp-server/build/index.js"
|
|
7
|
+
],
|
|
8
|
+
"env": {
|
|
9
|
+
"OBSIDIAN_API_KEY": "your_api_key_here",
|
|
10
|
+
"VERIFY_SSL": "false",
|
|
11
|
+
"OBSIDIAN_PROTOCOL": "https",
|
|
12
|
+
"OBSIDIAN_HOST": "127.0.0.1",
|
|
13
|
+
"OBSIDIAN_PORT": "27124",
|
|
14
|
+
"REQUEST_TIMEOUT": "5000",
|
|
15
|
+
"MAX_CONTENT_LENGTH": "52428800",
|
|
16
|
+
"MAX_BODY_LENGTH": "52428800",
|
|
17
|
+
"RATE_LIMIT_WINDOW_MS": "900000",
|
|
18
|
+
"RATE_LIMIT_MAX_REQUESTS": "200",
|
|
19
|
+
"TOOL_TIMEOUT_MS": "60000"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obsidian-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Model Context Protocol server for Obsidian integration with token-aware response handling",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
"node": ">=18.0.0"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "tsc
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"postbuild": "node -e \"if (process.platform !== 'win32') require('fs').chmodSync('build/index.js', '755')\"",
|
|
12
13
|
"start": "node build/index.js",
|
|
13
14
|
"dev": "tsc -w",
|
|
14
|
-
"clean": "
|
|
15
|
+
"clean": "node -e \"require('fs').rmSync('build', { recursive: true, force: true })\"",
|
|
15
16
|
"rebuild": "npm run clean && npm run build",
|
|
16
17
|
"test": "echo \"No tests specified yet\" && exit 0",
|
|
17
18
|
"lint": "eslint . --ext .ts",
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { run } from "./server.js";
|
|
2
|
+
import { run } from "./mcp/server.js";
|
|
3
|
+
import { createLogger } from "./utils/logging.js";
|
|
4
|
+
|
|
5
|
+
// Create a logger for the main entry point
|
|
6
|
+
const logger = createLogger('Main');
|
|
3
7
|
|
|
4
8
|
// Main entry point
|
|
5
9
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
10
|
+
logger.info("Starting Obsidian MCP Server");
|
|
6
11
|
run().catch((error) => {
|
|
7
|
-
|
|
12
|
+
logger.error("Failed to start server:", error);
|
|
8
13
|
process.exit(1);
|
|
9
14
|
});
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
// Export the run function and other important modules
|
|
18
|
+
export { run } from "./mcp/server.js";
|
|
19
|
+
export * from "./obsidian/index.js";
|
|
20
|
+
export * from "./tools/index.js";
|
|
21
|
+
export * from "./resources/index.js";
|
|
22
|
+
export * from "./utils/index.js";
|