Obsidian via REST
Accede y gestiona tu bóveda de Obsidian a través de una API REST local.
Documentación
mcp-obsidian
Desplegado / Uso
Estado de CI/CD
Herramientas y Recursos MCP
Este servidor MCP expone las siguientes herramientas y recursos a los asistentes de IA:
Herramientas
| Herramienta | Descripción | Parámetros |
|---|---|---|
get_note_content | Recupera el contenido y los metadatos de una nota de Obsidian | filePath (string) - Ruta a la nota |
obsidian_search | Busca notas usando una cadena de consulta | query (string) - Consulta de búsqueda |
obsidian_semantic_search | Búsqueda semántica de notas | query (string) - Consulta de búsqueda |
Recursos
| Recurso | Patrón de URI | Descripción |
|---|---|---|
| Nota de Obsidian | obsidian://{path} | Accede a notas vía URI (p. ej., obsidian://Daily/2025-01-16.md) |
Prueba Rápida
# 1. Set your Obsidian API key
export OBSIDIAN_API_KEY="your-obsidian-rest-api-key"
# 2. Add MCP server and test (Claude Code)
claude mcp add obsidian -- bunx -y @oleksandrkucherenko/mcp-obsidian
claude "Search my Obsidian vault for monitoring tools, summarize findings"
# 2. Alternative: Codex CLI
codex mcp add obsidian --command "bunx -y @oleksandrkucherenko/mcp-obsidian"
codex "Find notes about logging frameworks and create a comparison table"
Caso de uso de ejemplo: "Encuentra todas las herramientas en mi bóveda de Obsidian para rastrear registros y métricas, haz un informe resumido" — la IA busca en tu bóveda, encuentra notas sobre OpenTelemetry, Datadog, Prometheus, etc., y genera un resumen estructurado.
Para otras herramientas CLI (Gemini, OpenCode, Kilo Code, Copilot), consulta la Guía de Pruebas Manuales.
Configurar MCP
Usa API_URLS para conmutación automática y autocuración. El servidor prueba todas las URLs en paralelo, selecciona la más rápida y se reconecta automáticamente ante fallos.
{
"mcpServers": {
"obsidian": {
"command": "docker",
"args": [
"run",
"--name", "mcp-obsidian",
"--rm",
"-i", // Keep STDIN open for stdio transport
"-p", "3000:3000",
"-e", "API_KEY",
"-e", "API_URLS",
"-e", "DEBUG", // for logs
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"
],
"env": {
"API_KEY": "<secret_key>",
// JSON array - automatically tests and selects fastest URL
"API_URLS": "[\"https://127.0.0.1:27124\",\"https://172.26.32.1:27124\",\"https://host.docker.internal:27124\"]",
"DEBUG": "mcp:*"
}
}
}
}
Características de Autocuración:
- ✅ Prueba paralela de URLs al inicio
- ✅ Selección automática de la URL más rápida
- ✅ Monitoreo de salud cada 30 segundos
- ✅ Conmutación automática ante pérdida de conexión
- ✅ Retroceso exponencial para evitar inestabilidad
Transportes disponibles:
stdio- Entrada/salida estándar (predeterminado, ideal para clientes MCP locales)http- HTTP JSON-RPC con streaming SSE (ideal para acceso remoto)
Ejemplo WSL2:
# Automatically determine WSL gateway IP
export WSL_GATEWAY_IP=$(ip route show | grep -i default | awk '{ print $3}')
# Configure with multiple fallback URLs
API_URLS='["https://127.0.0.1:27124", "https://'$WSL_GATEWAY_IP':27124", "https://host.docker.internal:27124"]'
Configuración de Transporte HTTP
El servidor MCP admite transporte HTTP para acceso remoto con conmutación automática de URL:
{
"mcpServers": {
"obsidian-http": {
"command": "docker",
"args": [
"run",
"--name", "mcp-obsidian-http",
"--rm",
"-p", "3000:3000",
"-e", "API_KEY",
"-e", "API_URLS",
"-e", "MCP_HTTP_PATH",
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"
],
"env": {
"API_KEY": "<secret_key>",
"API_URLS": "[\"https://127.0.0.1:27124\",\"https://172.26.32.1:27124\",\"https://host.docker.internal:27124\"]",
"MCP_HTTP_PATH": "/mcp" // endpoint path (default is: /mcp)
}
}
}
}
Configuración Desacoplada con Autenticación
# Automatically determine WSL gateway IP
export WSL_GATEWAY_IP=$(ip route show | grep -i default | awk '{ print $3}')
# Configure with multiple fallback URLs
API_URLS='["https://127.0.0.1:27124", "https://'$WSL_GATEWAY_IP':27124", "https://host.docker.internal:27124"]'
# run MCP server on docker separately from IDE
docker run --name mcp-obsidian-http --rm \
-p 3000:3000 \
-e API_KEY="<secret_key>" \
-e API_URLS="${API_URLS}" \
-e MCP_HTTP_TOKEN=<your-secret-token-here> \
ghcr.io/oleksandrkucherenko/obsidian-mcp:latest
{
"mcpServers": {
"obsidian": {
"type": "streamable-http",
"url": "http://localhost:3000/mcp",
"headers": {
"Authorization": "Bearer <your-secret-token-here>"
}
}
}
}
Los clientes deben incluir el encabezado Authorization:
Authorization: Bearer your-secret-token-here
Configuración de Transporte Stdio
Para desarrollo local con transporte stdio (predeterminado):
{
"mcpServers": {
"obsidian": {
"command": "docker",
"args": [
"run",
"--name", "mcp-obsidian-windsurf",
"--interactive",
"--rm",
"-e", "API_KEY",
"-e", "API_URLS",
"-e", "DEBUG",
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"
],
"env": {
"API_KEY": "<secret_key>",
"API_URLS": "[\"https://127.0.0.1:27124\",\"https://172.26.32.1:27124\"]",
"DEBUG": "mcp:*" // default: disabled logs
}
}
}
}
--rm- Elimina automáticamente el contenedor y sus volúmenes anónimos asociados al salir-i, --interactive- Mantener STDIN abierto-e, --env- Establecer variables de entorno--name string- Asignar un nombre al contenedor-p, --publish- Publicar el puerto del contenedor al host- NPM Package Releases
- Docker Image Releases
Configuración Heredada de URL Única
Para compatibilidad con versiones anteriores, aún puedes usar la configuración de URL única con API_HOST y API_PORT:
{
"mcpServers": {
"obsidian": {
"command": "docker",
"args": [
"run",
"--name", "mcp-obsidian",
"--rm",
"-i",
"-e", "API_KEY",
"-e", "API_HOST",
"-e", "API_PORT",
"ghcr.io/oleksandrkucherenko/obsidian-mcp:latest"
],
"env": {
"API_KEY": "<secret_key>",
"API_HOST": "https://172.26.32.1", // single URL without failover
"API_PORT": "27124"
}
}
}
}
Nota: La configuración de URL única no proporciona conmutación automática ni monitoreo de salud. Usa API_URLS para despliegues en producción.
Endpoint de Salud
Cuando el transporte HTTP está habilitado, el servidor expone un endpoint de verificación de salud en /health:
curl http://localhost:3000/health
Respuesta:
{
"status": "healthy",
"timestamp": "2025-01-12T12:00:00.000Z",
"transport": "http",
"authEnabled": false
}
Para un estado de salud completo que incluya la conexión a la API de Obsidian y todos los transportes, puedes usar la función getHealthStatus() que devuelve:
{
"healthy": true,
"obsidian": {
"connected": true,
"url": "https://obsidian:27124",
"lastCheck": 1705065600000
},
"transports": {
"stdio": { "running": true, "enabled": true },
"http": { "running": true, "enabled": true }
},
"uptime": 3600,
"timestamp": 1705065600000
}
Configuración de Herramientas CLI
Esta sección muestra cómo configurar herramientas CLI de IA populares para usar el servidor MCP Obsidian.
# MacOs or Linux
curl -fsSL https://bun.sh/install | bash
# Windows
powershell -c "irm bun.sh/install.ps1 | iex"
Claude Code CLI
Docker:
# Create mcp.json configuration
cat > mcp.json << 'EOF'
{
"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\"]"
}
}
}
}
EOF
# Run Claude with MCP config
claude --mcp-config ./mcp.json
NPX/Bunx:
cat > mcp.json << 'EOF'
{
"mcpServers": {
"obsidian": {
"command": "bunx",
"args": ["-y", "@oleksandrkucherenko/mcp-obsidian"],
"env": {
"API_KEY": "<your-obsidian-api-key>",
"API_URLS": "[\"https://127.0.0.1:27124\"]"
}
}
}
}
EOF
claude --mcp-config ./mcp.json
Gemini CLI
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 \
bunx -y @oleksandrkucherenko/mcp-obsidian
Transporte HTTP (servidor remoto):
gemini mcp add --transport http obsidian-http http://localhost:3000/mcp
Listar y gestionar servidores:
gemini mcp list
gemini mcp remove obsidian
OpenCode CLI
Crea opencode.json en la raíz de tu proyecto:
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": ["bunx", "-y", "@oleksandrkucherenko/mcp-obsidian"],
"environment": {
"API_KEY": "{env:API_KEY}",
"API_URLS": "[\"https://127.0.0.1:27124\"]"
},
"enabled": true
}
}
}
Transporte HTTP:
{
"mcp": {
"obsidian-http": {
"type": "remote",
"url": "http://localhost:3000/mcp",
"enabled": true
}
}
}
Kilo Code CLI
Crea .kilocode/mcp.json en tu proyecto o ~/.kilocode/cli/global/settings/mcp_settings.json globalmente:
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": "bunx",
"args": ["-y", "@oleksandrkucherenko/mcp-obsidian"],
"env": {
"API_KEY": "<your-obsidian-api-key>",
"API_URLS": "[\"https://127.0.0.1:27124\"]"
}
}
}
}
Transporte HTTP:
{
"mcpServers": {
"obsidian-http": {
"type": "streamable-http",
"url": "http://localhost:3000/mcp",
"headers": {
"Authorization": "Bearer <your-token>"
}
}
}
}
Codex CLI
Docker:
# Register MCP server
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 "bunx -y @oleksandrkucherenko/mcp-obsidian" \
--env API_KEY=<your-obsidian-api-key> \
--env 'API_URLS=["https://127.0.0.1:27124"]'
GitHub Copilot CLI
Crea ~/.copilot/mcp-config.json (o .copilot/mcp-config.json en la raíz del repositorio):
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": "bunx",
"args": ["-y", "@oleksandrkucherenko/mcp-obsidian"],
"env": {
"API_KEY": "${OBSIDIAN_API_KEY}",
"API_URLS": "[\"https://127.0.0.1:27124\"]"
},
"tools": ["*"]
}
}
}
Nota: Copilot CLI v0.0.340+ requiere la sintaxis ${VAR} para la expansión de variables de entorno. Establece OBSIDIAN_API_KEY en tu shell antes de ejecutar.
Referencia Rápida
| Herramienta CLI | Archivo de Configuración | Soporte Docker | Transporte HTTP |
|---|---|---|---|
| Claude Code | mcp.json | ✅ | ✅ |
| Gemini | settings.json | ✅ | ✅ |
| OpenCode | opencode.json | ✅ | ✅ |
| Kilo Code | .kilocode/mcp.json | ✅ | ✅ |
| Codex | Comandos CLI | ✅ | ✅ |
| Copilot | ~/.copilot/mcp-config.json | ✅ | ✅ |
Para pruebas y verificación detalladas, consulta la Guía de Pruebas Manuales.
Configuración y Solución de Problemas
Configuración
- Ejecuta la Aplicación de Escritorio de Obsidian y habilita la API REST Local en Configuración.
Esta configuración te permitirá conectarte a la API REST Local desde cualquier interfaz de red (no solo localhost, lo cual es crítico para la configuración de WSL2).
- Copia la Clave API de la Configuración de Obsidian; la necesitarás para la configuración de MCP.
- Verifica que la API REST Local de Obsidian esté ejecutándose y sea accesible desde tu máquina.
- El siguiente paso es siempre verificar la configuración de red en tu máquina (reglas de firewall, etc.).
Verificar que la API REST de Obsidian esté ejecutándose (Windows Host, MacOS, Linux)
Ejecuta en la terminal CMD de Windows:
# windows CMD, verify that port is listening (that rest api is running)
netstat -an | findstr 27124
# Expected output:
# TCP 0.0.0.0:27124 0.0.0.0:0 LISTENING
# Verify that Obsidian Local REST API is working
curl --insecure https://localhost:27124
wget --no-check-certificate -S https://localhost:27124
http --verify=no https://localhost:27124
Respuesta esperada de la API REST:
{
"status": "OK",
"manifest": {
"id": "obsidian-local-rest-api",
"name": "Local REST API",
"version": "3.2.0",
"minAppVersion": "0.12.0",
"description": "Get, change or otherwise interact with your notes in Obsidian via a REST API.",
"author": "Adam Coddington",
"authorUrl": "https://coddingtonbear.net/",
"isDesktopOnly": true,
"dir": ".obsidian/plugins/obsidian-local-rest-api"
},
"versions": {
"obsidian": "1.8.10",
"self": "3.2.0"
},
"service": "Obsidian Local REST API",
"authenticated": false
}
WSL2, Docker alojado en Ubuntu
graph LR
subgraph "Windows Machine"
obs("Obsidian Application")
subgraph "WSL2"
subgraph "Ubuntu"
subgraph "Docker"
mcp("mcp-obsidian:latest")
end
end
end
firewall(["Windows Firewall"]) -->|27124| obs
mcp -->|https://$WSL_GATEWAY_IP:27124| firewall
IDE -.->|MCP Server Tools| mcp
end
Ejecuta dentro de la Terminal Ubuntu de WSL2:
export WSL_GATEWAY_IP=$(ip route show | grep -i default | awk '{ print $3}')
echo $WSL_GATEWAY_IP # expected something like: 172.26.32.1
# Verify that Obsidian Local REST API is working
curl --insecure https://$WSL_GATEWAY_IP:27124
wget --no-check-certificate -S https://$WSL_GATEWAY_IP:27124
http --verify=no https://$WSL_GATEWAY_IP:27124
Verificar el Firewall de Windows
Ejecuta la GUI y configura manualmente las reglas:
# Windows Defender Firewall / Inbound Rules. Press Win+R and type WF.msc or firewall.cpl
WF.msc
firewall.cpl # and then press 'Advanced settings'
O ejecuta en Windows PowerShell como Administrador:
# Add firewall rule to allow port 27124 (Run in Admin PowerShell)
New-NetFirewallRule -DisplayName "WSL2 Obsidian REST API" -Direction Inbound -LocalPort 27123,27124 -Protocol TCP -Action Allow
O ejecuta en la terminal CMD de Windows:
# check firewall rules (CMD) that manage 27124 port
netsh advfirewall firewall show rule name=all | findstr /C:"Rule Name" /C:"LocalPort" /C:"RemotePort" | findstr /C:"27124"
# display rules that has WSL2 keyword in own name
netsh advfirewall firewall show rule name=all | grep -A 13 WSL2
# display rule definition by port number (4 line after, 9 lines before)
netsh advfirewall firewall show rule name=all | grep -A 4 -B 9 27124
Deshabilitar/Habilitar Firewall
Ejecuta en Windows PowerShell como Administrador:
# Temporarily turn off firewall (for testing ONLY, not recommended for regular use)
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
# Restore Firewall state
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
Verificar Conectividad en Contenedor BusyBox
Estos pasos nos permiten confirmar que la configuración de red es correcta y que el contenedor puede conectarse a la API REST Local.
Ejecuta dentro de la terminal Ubuntu de WSL2:
export WSL_GATEWAY_IP=$(ip route | grep default | awk '{print $3}')
echo "Windows host IP from WSL2: $WSL_GATEWAY_IP"
# Output:
# Windows host IP from WSL2: 172.26.32.1
# run docker container to verify the connectivity from Docker inside
docker run --rm -it --network=host busybox sh
# inside the container run:
which wget
# /bin/wget
export WINDOWS_HOST_IP="172.26.32.1"
echo $WINDOWS_HOST_IP
# 172.26.32.1
# try to connect to the Local REST API
wget -qO- --no-check-certificate "https://$WINDOWS_HOST_IP:27124"
wget -qO- --no-check-certificate https://172.26.32.1:27124

