A modern, fast, and cross-platform OpenAPI Tool Server for Obsidian integration. Optimized for Open WebUI with secure API key authentication, write operation history, and a beautiful interactive setup experience.
- OpenAPI Standard: Native OpenAPI 3.0 spec for seamless Open WebUI integration
- Secure Authentication: Auto-generated cryptographically secure API keys
- Cross-Platform: Works on Windows, macOS, and Linux
- Interactive Setup: Beautiful Inquirer-based configuration wizard
- CLI Mode: Non-interactive mode for Docker/CI deployments
- Fast & Modern: Built with FastAPI and Pydantic v2 for maximum performance
- Write History: Optional rollback capability for write operations
- Docker Ready: Production-ready Docker and docker-compose configurations
- Health Checks: Built-in health monitoring with Obsidian connectivity verification
- Python 3.10+
- Obsidian with the Local REST API plugin installed and enabled
- Obsidian API Key from the plugin settings
-
Clone or download the repository:
git clone https://github.com/derrikjb/Obsidian_MCP.git cd Obsidian_OpenAPI -
Install dependencies:
pip install -r requirements.txt
-
Run the interactive setup wizard:
python scripts/setup.py
-
Start the server:
python -m app.main
The server will start on port 27150 (configurable) and automatically generate a secure API key on first run.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /health |
No | Health check & Obsidian connectivity |
| GET | /docs |
No | Swagger UI documentation |
| GET | /openapi.json |
No | OpenAPI specification |
| POST | /auth/regenerate-key |
Yes | Regenerate API key |
| GET | /history |
Yes | Get operation history |
| DELETE | /history |
Yes | Clear operation history |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /vault/{path} |
Yes | Get file content (markdown/json/document-map) |
| POST | /vault/{path} |
Yes | Create or replace file |
| PATCH | /vault/{path} |
Yes | Partial update (heading/block/frontmatter) |
| PATCH | /vault/{path}/append |
Yes | Append to file |
| DELETE | /vault/{path} |
Yes | Delete file |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /vault |
Yes | List vault contents |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /search |
Yes | Simple text search |
| POST | /search/advanced |
Yes | Dataview DQL / JsonLogic search |
curl -H "X-API-Key: your-api-key" \
http://localhost:27150/vault/my-note.mdcurl -X POST \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"content": "# My New Note\n\nHello World!"}' \
http://localhost:27150/vault/my-new-note.mdcurl -H "X-API-Key: your-api-key" \
"http://localhost:27150/search?query=hello&limit=10"curl -X POST \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"query_type": "dataview",
"query": "TABLE file.mtime FROM #project WHERE status = 'active'",
"limit": 50
}' \
http://localhost:27150/search/advanced| Variable | Description | Default |
|---|---|---|
OBSIDIAN_OPENAPI_PORT |
Server port | 27150 |
OBSIDIAN_OPENAPI_HOST |
Server host binding | 0.0.0.0 |
OBSIDIAN_API_URL |
Obsidian REST API URL | http://127.0.0.1:27123 |
OBSIDIAN_API_KEY |
Obsidian API Key | (required) |
SERVER_API_KEY |
Server API Key | (auto-generated) |
CORS_ORIGINS |
Allowed CORS origins | * |
DEBUG |
Enable debug mode | false |
LOG_LEVEL |
Logging level | INFO |
MAX_HISTORY_ENTRIES |
Write history size | 10 |
REQUEST_TIMEOUT |
Request timeout (seconds) | 30 |
ENABLE_KEY_REGENERATION |
Allow key regeneration | false |
Run the beautiful interactive wizard:
python scripts/setup.pyFor Docker, CI/CD, or automated deployments:
python scripts/cli.py \
--obsidian-key your-obsidian-key \
--port 27150 \
--host 0.0.0.0-
Start the server:
python -m app.main
-
In Open WebUI, go to:
- Admin Settings → Tools → OpenAPI Tool Servers
-
Add a new tool server:
- Name: Obsidian
- URL:
http://localhost:27150 - API Key: Your generated key (shown in logs or
.envfile)
-
Open WebUI will automatically fetch the OpenAPI spec and make all tools available!
-
Create your
.envfile:python scripts/setup.py
-
Start with Docker Compose:
docker-compose up -d
-
Check logs:
docker-compose logs -f
docker run -d \
--name obsidian-openapi-server \
-p 27150:27150 \
-e OBSIDIAN_API_URL=http://host.docker.internal:27123 \
-e OBSIDIAN_API_KEY=your-obsidian-key \
-e SERVER_API_KEY=your-server-key \
obsidian-openapi-server:latestdocker build -t obsidian-openapi-server:latest .Enable automatic tracking of write operations for potential rollback:
- Set
MAX_HISTORY_ENTRIESin your.envfile (default: 10) - View history:
GET /history - Clear history:
DELETE /history
Each write operation (create, append, patch, delete) stores the previous content, enabling future rollback functionality.
# Install dev dependencies
pip install -r requirements.txt
# Run with auto-reload
python -m app.main
# Or use the CLI with reload
python scripts/cli.py --reload --debugobsidian-openapi-server/
├── app/
│ ├── __init__.py
│ ├── main.py # FastAPI application entry
│ ├── config.py # Configuration management
│ ├── auth.py # API key authentication
│ ├── models.py # Pydantic models
│ ├── routers/
│ │ ├── vault.py # Vault file operations
│ │ ├── directory.py # Directory operations
│ │ └── search.py # Search operations
│ └── services/
│ ├── obsidian.py # Obsidian API client
│ └── history.py # Operation history manager
├── scripts/
│ ├── setup.py # Interactive setup wizard
│ └── cli.py # Non-interactive CLI
├── requirements.txt
├── Dockerfile
├── docker-compose.yml
└── README.md
- Check Obsidian is running with Local REST API plugin enabled
- Verify API key is correct in
.envfile - Check port availability:
lsof -i :27150(macOS/Linux) ornetstat -ano | findstr 27150(Windows)
- Windows/macOS: If running Obsidian on the host and server in Docker, use
host.docker.internalinstead of127.0.0.1 - Linux: Use the host's IP address or
--network hostin Docker
- Check the
.envfile forSERVER_API_KEY - If lost, delete the
.envfile and runpython scripts/setup.pyagain - Or regenerate via API if
ENABLE_KEY_REGENERATION=true
Update CORS_ORIGINS in .env to include your origin:
CORS_ORIGINS=http://localhost:3000,http://localhost:8080- API Key: Keep your
SERVER_API_KEYsecure. It provides full access to your vault. - Network: Use HTTPS in production (via reverse proxy like nginx)
- Obsidian API: The server passes through your Obsidian API key - keep it secure
- Key Regeneration: Disable
ENABLE_KEY_REGENERATIONin production unless needed - CORS: Restrict
CORS_ORIGINSto known domains in production
MIT License - see LICENSE file for details.
Contributions welcome! This is an open project following the OpenAPI Tool Server standard.
Built with:
- FastAPI - Modern web framework
- Pydantic - Data validation
- HTTPX - Async HTTP client
- Inquirer - Interactive CLI
- Open WebUI - OpenAPI Server standard