A Go-based MCP (Multi-Channel Platform) server for managing and optimizing files in an Obsidian vault, with RESTful APIs, structured logging (Logrus + Gin), and support for custom tools and prompt resources.
- File Management: Create, read, update, delete, and list files in your Obsidian vault via API endpoints and MCP tools.
- Markdown Optimization: Resource endpoint for optimizing markdown content (customizable logic).
- Structured Logging: Logrus integration for all HTTP and Gin logs, including file/line info.
- Sampling/Confirmation: Interactive sampling for dangerous operations (e.g., delete confirmation).
- Extensible Tools/Prompts: Easily add new tools and prompt resources for custom workflows.
- Go 1.18+
- Obsidian running with API plugin enabled (or compatible backend)
make build # Build the binary
make run # Build and run the server
make test # Run all testsSet environment variables or use command-line flags:
OBSIDIAN_URL(default:http://127.0.0.1:27123)OBSIDIAN_TOKEN(your Obsidian API token)
Example:
export OBSIDIAN_URL="http://localhost:27123"
export OBSIDIAN_TOKEN="your-token-here"
make run- Create File:
obsidian_create_file - Read File:
obsidian_read_file - Delete File:
obsidian_delete_file(with confirmation) - List Files:
obsidian_list_files - Markdown Optimize Prompt:
obsidian_md_optimize
main.go— Entry point, Gin server setuppkg/ob-tools.go— Tools for file operationspkg/prompts.go— Prompt resources (e.g., markdown optimizer)types/— Shared types and schemasutils.go— Logging and utility functionsMakefile— Build/test/run automation.gitignore— Standard ignores for Go, build, and editor files
- Add a Tool: Implement the
Toolinterface and register inpkg/reg.go - Add a Prompt Resource: Implement the
Promptinterface and register inpkg/reg.go
MIT
For more details, see the code comments and each package's documentation.