🚀 Obsidian MCP Server Plugin
This Obsidian plugin runs a local MCP (Model Context Protocol) server, allowing external applications (such as AI assistants, scripts, or other tools) to interact with your Obsidian knowledge base through a standardized interface.
This is a plugin under development. Currently, the functions are available, but there may be some errors or incomplete features. If you encounter any problems, please feel free to report them. Due to my limited proficiency in TypeScript, there may be security and reliability issues. You can submit issues or pull requests on GitHub, and I will respond as soon as possible.
✨ Features
- Local MCP Server: Runs an MCP server based on the Server-Sent Events (SSE) protocol on the configured port.
- Knowledge Base Indexing for Semantic Search:
- Indexes Markdown note content into the Orama vector database.
- Generates embeddings using an OpenAI-compatible embedding model (e.g., OpenAI, a local Ollama model connected via a compatible endpoint).
- Supports configuration of text chunking parameters (size, overlap, delimiter).
- Allows exclusion of specific files or patterns using a
.gitignore
-like syntax.
- Obsidian Integration:
- Commands: Provides the following commands in the Obsidian command palette:
- Start/Stop the MCP server.
- Re-index the entire knowledge base (this may take time and incur costs depending on the embedding provider).
- Manually save the vector database index.
- Settings Panel: Offers a dedicated settings tab for configuring:
- Server port and auto-start behavior.
- Embedding model details (API endpoint, model name, API key).
- File exclusion rules for excluding files or patterns during indexing.
- Chunking parameters.
- Verification of the embedding provider's connection status.
- Function Icon: Adds a status icon to the Obsidian title bar, indicating whether the MCP server is running or stopped.
- Multilingual Support: Supports English and Chinese interfaces based on the Obsidian language settings.
- Commands: Provides the following commands in the Obsidian command palette:
🛠️ MCP Tools
- MCP Tools: The tools exposed by this plugin can be used in external applications through the configured port. By default, these tools are accessed via HTTP endpoints.
📦 Installation
- Edit the
config.json
file:- Specify the port used by the MCP server.
{ "port": 3000, ... }
- After enabling the plugin in Obsidian, visit [http://localhost:
/api](http://localhost: /api) to view the available tools.
⚠️ Known Issues and Limitations
- File Size Limit: If your knowledge base contains a large number of notes, indexing may fail when the
orama.json
file exceeds 512MB. Currently, there is no solution, and the issue can only be alleviated by reducing the number of notes/chunks. - Numeric Storage: OramaDB stores floating-point numbers as raw strings, which causes the database size to increase rapidly.
🔧 Development
This project uses TypeScript. Please ensure that Node.js and npm are installed.
- Clone the repository.
- Run
npm install
to install the dependencies. - Run
npm run dev
to compile the plugin and monitor file changes. - Copy the generated
main.js
,manifest.json
, andstyles.css
files to the.obsidian/plugins/mcp-server/
directory of your Obsidian knowledge base. - Reload Obsidian and enable the plugin.
💻 Usage Examples
Start the MCP Server
- After enabling the plugin in Obsidian, visit [http://localhost:
/api](http://localhost: /api) to view the available tools.
Use the MCP Tools
- Configure external applications to interact with the exposed HTTP endpoints.
Stop the MCP Server
- Use the "Stop MCP Server" command to shut down the service and avoid resource waste.
📌 Notes
- The performance and behavior of the embedded model may vary depending on the specific model used.
- The storage mechanism of OramaDB may cause the database file to grow rapidly. Please regularly monitor the file size and clean up unnecessary data.
With this plugin, you can easily integrate your Obsidian knowledge base with external tools and services, expanding its functionality and application scenarios.







