compose-obsidian.yml aktualisiert

This commit is contained in:
Marc Blatter 2026-08-02 11:27:15 +00:00
parent e2f6f7ddbb
commit fb810f229c
1 changed files with 90 additions and 151 deletions

View File

@ -1,47 +1,3 @@
version: '3.8'
services:
# CouchDB für Obsidian Livesync
couchdb:
image: couchdb:3.3
container_name: cortex-couchdb
ports:
- "5984:5984"
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=admin123
- PUID=1000
- PGID=1000
volumes:
- /opt/obsidian/couchdb:/opt/couchdb/data
restart: unless-stopped
networks:
- cortex-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5984/_up"]
interval: 30s
timeout: 10s
retries: 3
# MCP Server für Hermes Agent
obsidian-mcp:
image: node:20-alpine
container_name: cortex-obsidian-mcp
working_dir: /app
volumes:
- /opt/obsidian/vault:/vault
- /opt/obsidian/mcp-data:/data
ports:
- "3002:3002"
environment:
- NODE_ENV=production
- VAULT_PATH=/vault
- MCP_PORT=3002
command: >
sh -c "
npm init -y &&
npm install express cors body-parser &&
cat > server.js << 'EOFJS'
const express = require('express'); const express = require('express');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
@ -53,7 +9,7 @@ services:
const VAULT_PATH = process.env.VAULT_PATH || '/vault'; const VAULT_PATH = process.env.VAULT_PATH || '/vault';
// MCP Tool: Search notes // Search notes
app.post('/api/mcp/search', (req, res) => { app.post('/api/mcp/search', (req, res) => {
const { query } = req.body; const { query } = req.body;
try { try {
@ -83,19 +39,19 @@ services:
} }
}); });
// MCP Tool: Create note // Create note
app.post('/api/mcp/create', (req, res) => { app.post('/api/mcp/create', (req, res) => {
const { title, content, tags } = req.body; const { title, content, tags } = req.body;
try { try {
const filename = title.toLowerCase().replace(/\s+/g, '-') + '.md'; const filename = title.toLowerCase().replace(/\s+/g, '-') + '.md';
const filepath = path.join(VAULT_PATH, filename); const filepath = path.join(VAULT_PATH, filename);
const frontmatter = \`--- const frontmatter = `---
title: \${title} title: ${title}
tags: [\${tags?.join(', ') || ''}] tags: [${tags?.join(', ') || ''}]
created: \${new Date().toISOString()} created: ${new Date().toISOString()}
--- ---
\`; `;
fs.writeFileSync(filepath, frontmatter + (content || '')); fs.writeFileSync(filepath, frontmatter + (content || ''));
res.json({ success: true, file: filename }); res.json({ success: true, file: filename });
} catch (err) { } catch (err) {
@ -103,7 +59,7 @@ created: \${new Date().toISOString()}
} }
}); });
// MCP Tool: Get note // Get note
app.get('/api/mcp/note/:filename', (req, res) => { app.get('/api/mcp/note/:filename', (req, res) => {
try { try {
const filepath = path.join(VAULT_PATH, req.params.filename); const filepath = path.join(VAULT_PATH, req.params.filename);
@ -140,20 +96,3 @@ created: \${new Date().toISOString()}
app.listen(3002, () => { app.listen(3002, () => {
console.log('Obsidian MCP Server running on port 3002'); console.log('Obsidian MCP Server running on port 3002');
}); });
EOFJS
node server.js
"
restart: unless-stopped
networks:
- cortex-network
depends_on:
- couchdb
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3002/api/mcp/notes"]
interval: 30s
timeout: 10s
retries: 3
networks:
cortex-network:
driver: bridge