Quick setup guide for running the MCP Obsidian server
Loading screenshots...
Install and run Obsidian Desktop Application and enable the Local REST API plugin in Settings.
Make sure to configure the API to listen on all interfaces (not just localhost), which is critical for WSL2 setup.
Important: Copy the API Key from Obsidian Settings, you'll need it for MCP configuration.
Create or update your MCP configuration file with one of the following options:
{
"mcpServers": {
"obsidian": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "API_KEY",
"-e", "API_URLS",
"-e", "DEBUG",
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"
],
"env": {
"API_KEY": "<your-obsidian-api-key>",
"API_URLS": "[\"https://host.docker.internal:27124\"]",
"DEBUG": "mcp:*"
}
}
}
}
{
"mcpServers": {
"obsidian": {
"command": "npx",
"args": ["-y", "@oleksandrkucherenko/mcp-obsidian"],
"env": {
"API_KEY": "<your-obsidian-api-key>",
"API_URLS": "[\"https://127.0.0.1:27124\"]",
"DEBUG": "mcp:*"
}
}
}
}
Configuration Notes:
<your-obsidian-api-key> with the API Key you copied from Obsidian.API_URLS is a JSON array of URLs. You can specify multiple URLs for automatic failover.host.docker.internal to reach the host machine.127.0.0.1 or localhost.["https://127.0.0.1:27124", "https://172.26.32.1:27124"] (replace with your Windows host IP).DEBUG is optional - remove it to disable verbose logging.# Verify that the port is listening
netstat -an | findstr 27124 # Windows CMD
# Test the API connection
curl --insecure https://localhost:27124
# Get Windows host IP
export WSL_GATEWAY_IP=$(ip route show | grep -i default | awk '{ print $3}')
echo $WSL_GATEWAY_IP
# Test the API connection
curl --insecure https://$WSL_GATEWAY_IP:27124
# check is port is listening
ss -tuln | grep ':27124'
# Test the API connection
wget --no-check-certificate -S https://localhost:27124
# check is port is listening
sudo lsof -iTCP:27124 -sTCP:LISTEN
# Test the API connection (Httpie)
http --verify=no https://localhost:27124
Expected successful response:
{
"status": "OK",
"manifest": {
"id": "obsidian-local-rest-api",
"name": "Local REST API",
/* other manifest details... */
},
"service": "Obsidian Local REST API",
"authenticated": false
}
Ensure your firewall allows connections on port 27124:
# Add firewall rule (Run in Admin PowerShell)
New-NetFirewallRule -DisplayName "WSL2 Obsidian REST API" -Direction Inbound -LocalPort 27124 -Protocol TCP -Action Allow
You can now run the MCP server using Docker:
docker run --name mcp-obsidian-windsurf \
--interactive \
--rm \
-e API_KEY="your-api-key" \
-e API_HOST="https://your-host-ip" \
-e API_PORT="27124" \
-e DEBUG="mcp:*" \
ghcr.io/oleksandrkucherenko/obsidian-mcp:latest
Docker arguments explained:
--rm - Automatically remove the container when it exits--interactive - Keep STDIN open-e, --env - Set environment variablesConfigure your preferred AI CLI tool to use the MCP Obsidian server. Choose between Docker-hosted or NPX/Bunx-hosted versions.
Docker:
{
"mcpServers": {
"obsidian": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "API_KEY", "-e", "API_URLS",
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"],
"env": {
"API_KEY": "<your-obsidian-api-key>",
"API_URLS": "[\"https://host.docker.internal:27124\"]"
}
}
}
}
NPX/Bunx:
{
"mcpServers": {
"obsidian": {
"command": "npx",
"args": ["-y", "@oleksandrkucherenko/mcp-obsidian"],
"env": {
"API_KEY": "<your-obsidian-api-key>",
"API_URLS": "[\"https://127.0.0.1:27124\"]"
}
}
}
}
Save as mcp.json and run: claude --mcp-config ./mcp.json
Docker:
gemini mcp add \
-e API_KEY=<your-obsidian-api-key> \
-e API_URLS='["https://host.docker.internal:27124"]' \
obsidian \
docker run --rm -i ghcr.io/oleksandrkucherenko/obsidian-mcp:latest
NPX/Bunx:
gemini mcp add \
-e API_KEY=<your-obsidian-api-key> \
-e API_URLS='["https://127.0.0.1:27124"]' \
obsidian \
npx -y @oleksandrkucherenko/mcp-obsidian
HTTP Transport: gemini mcp add --transport http obsidian-http http://localhost:3000/mcp
Create opencode.json in your project root:
Docker:
{
"mcp": {
"obsidian": {
"type": "local",
"command": ["docker", "run", "--rm", "-i", "-e", "API_KEY", "-e", "API_URLS",
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"],
"environment": {
"API_KEY": "{env:API_KEY}",
"API_URLS": "[\"https://host.docker.internal:27124\"]"
},
"enabled": true
}
}
}
NPX/Bunx:
{
"mcp": {
"obsidian": {
"type": "local",
"command": ["npx", "-y", "@oleksandrkucherenko/mcp-obsidian"],
"environment": {
"API_KEY": "{env:API_KEY}",
"API_URLS": "[\"https://127.0.0.1:27124\"]"
},
"enabled": true
}
}
}
Create .kilocode/mcp.json in your project:
Docker:
{
"mcpServers": {
"obsidian": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "API_KEY", "-e", "API_URLS",
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"],
"env": {
"API_KEY": "<your-obsidian-api-key>",
"API_URLS": "[\"https://host.docker.internal:27124\"]"
}
}
}
}
NPX/Bunx:
{
"mcpServers": {
"obsidian": {
"command": "npx",
"args": ["-y", "@oleksandrkucherenko/mcp-obsidian"],
"env": {
"API_KEY": "<your-obsidian-api-key>",
"API_URLS": "[\"https://127.0.0.1:27124\"]"
}
}
}
}
Docker:
codex mcp add obsidian \
--command "docker run --rm -i -e API_KEY -e API_URLS ghcr.io/oleksandrkucherenko/obsidian-mcp:latest" \
--env API_KEY=<your-obsidian-api-key> \
--env 'API_URLS=["https://host.docker.internal:27124"]'
NPX/Bunx:
codex mcp add obsidian \
--command "npx -y @oleksandrkucherenko/mcp-obsidian" \
--env API_KEY=<your-obsidian-api-key> \
--env 'API_URLS=["https://127.0.0.1:27124"]'
Create ~/.copilot/mcp-config.json (or .copilot/mcp-config.json in repo root):
Docker:
{
"mcpServers": {
"obsidian": {
"type": "local",
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "API_KEY", "-e", "API_URLS",
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"],
"env": {
"API_KEY": "${OBSIDIAN_API_KEY}",
"API_URLS": "[\"https://host.docker.internal:27124\"]"
},
"tools": ["*"]
}
}
}
NPX/Bunx:
{
"mcpServers": {
"obsidian": {
"type": "local",
"command": "npx",
"args": ["-y", "@oleksandrkucherenko/mcp-obsidian"],
"env": {
"API_KEY": "${OBSIDIAN_API_KEY}",
"API_URLS": "[\"https://127.0.0.1:27124\"]"
},
"tools": ["*"]
}
}
}
Copilot CLI v0.0.340+ requires ${VAR} syntax for env expansion. Set OBSIDIAN_API_KEY in your shell.
| CLI Tool | Config File | Docker | HTTP |
|---|---|---|---|
| Claude Code | mcp.json | ✅ | ✅ |
| Gemini | settings.json | ✅ | ✅ |
| OpenCode | opencode.json | ✅ | ✅ |
| Kilo Code | .kilocode/mcp.json | ✅ | ✅ |
| Codex | CLI commands | ✅ | ✅ |
| Copilot | ~/.copilot/mcp-config.json | ✅ | ✅ |
For detailed testing, see Manual Testing Guide.
To test connectivity from a Docker container:
# Get Windows host IP
export WSL_GATEWAY_IP=$(ip route show | grep -i default | awk '{ print $3}')
echo $WSL_GATEWAY_IP # expected something like: 172.26.32.1
# Run a test container shell
docker run --rm -it --network=host busybox sh
Inside the container shell:
# Inside the container shell
export WINDOWS_HOST_IP="172.26.32.1" # Replace with your host IP
wget -qO- --no-check-certificate "https://$WINDOWS_HOST_IP:27124"
To temporarily disable Windows Firewall for testing (not recommended for regular use):
# Run in Admin PowerShell
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
# Remember to re-enable after testing
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True