The Obsidian MCP Server provides a bridge between AI assistants or development tools and your Obsidian vault through the Model Context Protocol (MCP). It enables programmatic access to read, write, search, and manage your Obsidian notes via a standardized interface, leveraging the Obsidian Local REST API plugin.
Add the following configuration to your MCP client's settings file (e.g., cline_mcp_settings.json
):
{
"mcpServers": {
"obsidian-mcp-server": {
"command": "npx",
"args": ["obsidian-mcp-server"],
"env": {
"OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
"OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
"OBSIDIAN_VERIFY_SSL": "false",
"OBSIDIAN_ENABLE_CACHE": "true"
},
"disabled": false,
"autoApprove": []
}
}
}
There are two ways to connect:
"env": {
"OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
"OBSIDIAN_BASE_URL": "http://127.0.0.1:27123"
}
OBSIDIAN_VERIFY_SSL
to "false"
to trust the self-signed certificate:"env": {
"OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
"OBSIDIAN_BASE_URL": "https://127.0.0.1:27124",
"OBSIDIAN_VERIFY_SSL": "false"
}
Variable | Description | Required | Default |
---|---|---|---|
OBSIDIAN_API_KEY |
API Key from the Obsidian Local REST API plugin | Yes | undefined |
OBSIDIAN_BASE_URL |
Base URL of your Obsidian Local REST API | Yes | http://127.0.0.1:27123 |
OBSIDIAN_VERIFY_SSL |
Set to false to disable SSL verification |
No | true |
OBSIDIAN_ENABLE_CACHE |
Enable the in-memory vault cache | No | true |
OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN |
Cache refresh interval in minutes | No | 10 |
MCP_TRANSPORT_TYPE |
Server transport: stdio or http |
No | stdio |
The server provides several tools to interact with your Obsidian vault:
{
"tool": "obsidian_read_note",
"args": {
"filePath": "Path/To/Your/Note.md",
"format": "markdown",
"includeStat": true
}
}
{
"tool": "obsidian_update_note",
"args": {
"targetType": "filePath",
"targetIdentifier": "Path/To/Your/Note.md",
"wholeFileMode": "append",
"content": "Content to append to the note"
}
}
{
"tool": "obsidian_search_replace",
"args": {
"targetType": "filePath",
"targetIdentifier": "Path/To/Your/Note.md",
"replacements": [
{
"search": "old text",
"replace": "new text"
}
],
"useRegex": false,
"replaceAll": true
}
}
{
"tool": "obsidian_global_search",
"args": {
"query": "search term",
"searchInPath": "optional/folder/path",
"useRegex": false,
"page": 1,
"pageSize": 10
}
}
{
"tool": "obsidian_list_notes",
"args": {
"dirPath": "Folder/Path",
"fileExtensionFilter": ".md",
"nameRegexFilter": ".*meeting.*"
}
}
{
"tool": "obsidian_manage_frontmatter",
"args": {
"filePath": "Path/To/Your/Note.md",
"operation": "set",
"key": "tags",
"value": ["tag1", "tag2"]
}
}
{
"tool": "obsidian_manage_tags",
"args": {
"filePath": "Path/To/Your/Note.md",
"operation": "add",
"tags": ["newtag1", "newtag2"]
}
}
{
"tool": "obsidian_delete_note",
"args": {
"filePath": "Path/To/Your/Note.md"
}
}
The server includes an intelligent in-memory cache to enhance performance and resilience:
The cache is enabled by default but can be configured via environment variables:
OBSIDIAN_ENABLE_CACHE
: Set to true
(default) or false
to enable/disableOBSIDIAN_CACHE_REFRESH_INTERVAL_MIN
: Sets refresh interval in minutes (default: 10)To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "obsidian-mcp-server" '{"command":"npx","args":["obsidian-mcp-server"],"env":{"OBSIDIAN_API_KEY":"YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN","OBSIDIAN_BASE_URL":"http://127.0.0.1:27123","OBSIDIAN_VERIFY_SSL":"false","OBSIDIAN_ENABLE_CACHE":"true"},"disabled":false,"autoApprove":[]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"obsidian-mcp-server": {
"command": "npx",
"args": [
"obsidian-mcp-server"
],
"env": {
"OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
"OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
"OBSIDIAN_VERIFY_SSL": "false",
"OBSIDIAN_ENABLE_CACHE": "true"
},
"disabled": false,
"autoApprove": []
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"obsidian-mcp-server": {
"command": "npx",
"args": [
"obsidian-mcp-server"
],
"env": {
"OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
"OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
"OBSIDIAN_VERIFY_SSL": "false",
"OBSIDIAN_ENABLE_CACHE": "true"
},
"disabled": false,
"autoApprove": []
}
}
}
3. Restart Claude Desktop for the changes to take effect