78 lines
3.3 KiB
Plaintext
78 lines
3.3 KiB
Plaintext
|
|
#### 2. Create Obsidian Client Module
|
|
Create `src/clients/obsidian.ts`:
|
|
- HTTP client for obsidian-sync.fetcherpay.com
|
|
- Methods: searchNotes, getNote, updateNote, appendToNote, getSyncStatus
|
|
- Error handling with proper MCP error codes
|
|
- Retry logic for network failures
|
|
|
|
#### 3. Add MCP Tools (4 tools total)
|
|
|
|
**Tool 1: obsidian_search_notes**
|
|
- Description: "Search across Obsidian vault by content, tags, or title. Use when user references 'my notes', 'in obsidian', or needs personal knowledge retrieval."
|
|
- Parameters: query (string), tags (string[] optional), limit (number, default 10), path_filter (string optional)
|
|
- Returns: Array of {path, title, excerpt, tags, modified_date}
|
|
|
|
**Tool 2: obsidian_read_note**
|
|
- Description: "Retrieve full content of a specific note by path or title."
|
|
- Parameters: path (string), format (enum: "markdown", "json", default "markdown")
|
|
- Returns: {path, title, content, tags, links, backlinks, modified_date}
|
|
|
|
**Tool 3: obsidian_append_to_note**
|
|
- Description: "Append content to a daily note or specific note. Use for logging, journaling, or capturing insights from email or other sources."
|
|
- Parameters: path (string), content (string), create_if_missing (boolean, default true), header (string optional)
|
|
- Returns: {success, path, bytes_written}
|
|
|
|
**Tool 4: obsidian_sync_status**
|
|
- Description: "Check last sync time and status of obsidian-sync.fetcherpay.com service."
|
|
- Parameters: none
|
|
- Returns: {status, last_sync, vault_size, pending_changes}
|
|
|
|
#### 4. Update Server Registration
|
|
Modify `src/index.ts` or main server file:
|
|
- Import Obsidian client
|
|
- Register all 4 new tools
|
|
- Ensure tool names follow pattern: `obsidian_*` for namespacing
|
|
- Add to server capabilities
|
|
|
|
#### 5. Add Resources (Optional but Recommended)
|
|
Add `obsidian://` URI scheme resources:
|
|
- `obsidian://note/{path}` - Access specific notes
|
|
- `obsidian://search/{query}` - Search results as resource
|
|
|
|
#### 6. Error Handling Standards
|
|
Follow existing hermes-mcp error patterns:
|
|
- Use MCP error codes: -32602 (invalid params), -32603 (internal error), -32000 (server error)
|
|
- Log errors with context but don't expose internals to client
|
|
- Graceful degradation if obsidian-sync service is unavailable
|
|
|
|
#### 7. Testing Checklist
|
|
Create or update tests:
|
|
- [ ] Obsidian client unit tests (mock HTTP responses)
|
|
- [ ] Tool integration tests
|
|
- [ ] Error handling tests (timeout, 404, 500 responses)
|
|
- [ ] End-to-end test with actual obsidian-sync service
|
|
|
|
### Architecture Guidelines
|
|
- Keep consistent with existing email tool patterns in hermes-mcp
|
|
- Use same HTTP client library as existing code (axios/fetch/node-libcurl)
|
|
- Maintain same logging and monitoring approach
|
|
- Follow existing TypeScript interfaces and types
|
|
- Tool descriptions must be explicit about WHEN to use (for LLM routing)
|
|
|
|
### Deliverables
|
|
1. Updated source files with new Obsidian functionality
|
|
2. Updated `.env.example` with new variables
|
|
3. Updated README.md with Obsidian tool documentation
|
|
4. Test file covering new tools
|
|
5. Verification that existing email tools still work
|
|
|
|
### Verification Command
|
|
After implementation, I should be able to run:
|
|
```bash
|
|
npm run build
|
|
npm run test
|
|
# Then test with MCP inspector or Claude Code:
|
|
# "Search my notes for 'funding strategy'"
|
|
# "Read my daily note from today"
|
|
# "Append 'Meeting with investor scheduled' to my daily note" |