{
"tool_response": [
{
"type": "text",
"text": "{\n \"success\": true,\n \"doc\": {\n \"id\": 50,\n \"parent_id\": 47,\n \"slug\": \"mcp-tasks-installation\",\n \"path\": \"\/mcp\/mcp-tasks\/mcp-tasks-installation\",\n \"title\": \"Installation\",\n \"description\": \"Setup, Registrierung und Test des MCP-Tasks Servers.\",\n \"content\": \"<nav class=\\\"breadcrumb\\\">\\n <a href=\\\"\/docs\\\">Dokumentation<\/a> » <a href=\\\"\/docs\/mcp\\\">MCP<\/a> » <a href=\\\"\/docs\/mcp\/mcp-tasks\\\">MCP-Tasks<\/a> » Installation\\n<\/nav>\\n\\n<h1>MCP-Tasks Installation<\/h1>\\n<p>Setup, Registrierung und Test des MCP-Tasks Servers.<\/p>\\n\\n<h2>Voraussetzungen<\/h2>\\n<ul>\\n <li>Python 3.10+<\/li>\\n <li>MariaDB\/MySQL<\/li>\\n <li>Claude Code CLI<\/li>\\n <li>Ollama (optional, für tasks_execute)<\/li>\\n<\/ul>\\n\\n<h2>1. Verzeichnis erstellen<\/h2>\\n<pre><code>mkdir -p \/opt\/mcp-servers\/mcp-tasks\\ncd \/opt\/mcp-servers\/mcp-tasks<\/code><\/pre>\\n\\n<h2>2. Virtual Environment<\/h2>\\n<pre><code>python3 -m venv venv\\nsource venv\/bin\/activate\\npip install mcp pymysql python-dotenv requests pyyaml<\/code><\/pre>\\n\\n<h2>3. Dateien erstellen<\/h2>\\n<p>Siehe <a href=\\\"\/docs\/mcp\/mcp-tasks-architektur\\\">Architektur<\/a> für vollständige Verzeichnisstruktur.<\/p>\\n\\n<pre><code># Struktur\\n\/opt\/mcp-servers\/mcp-tasks\/\\n├── server.py # Hauptdatei\\n├── config.py # Konfiguration\\n├── .env # Credentials\\n├── requirements.txt\\n├── venv\/\\n├── domain\/\\n│ ├── __init__.py\\n│ └── contracts.py\\n├── infrastructure\/\\n│ ├── __init__.py\\n│ ├── db_connection.py\\n│ ├── protokoll_logger.py\\n│ └── task_repository.py\\n├── tools\/\\n│ ├── __init__.py\\n│ ├── task_tools.py\\n│ └── quality_tools.py\\n└── validators\/\\n └── __init__.py<\/code><\/pre>\\n\\n<h2>4. .env konfigurieren<\/h2>\\n<pre><code># .env erstellen\\nnano .env\\n\\n# Berechtigungen setzen\\nchmod 600 .env<\/code><\/pre>\\n\\n<h3>.env Inhalt<\/h3>\\n<pre><code># Datenbank für Task-Operationen (volle CRUD-Rechte)\\nDB_HOST=localhost\\nDB_PORT=3306\\nDB_NAME=ki_protokoll\\nDB_USER=claude_code\\nDB_PASSWORD=SECURE_PASSWORD_HERE\\n\\n# Datenbank für Logging (nur INSERT)\\nLOG_DB_HOST=localhost\\nLOG_DB_NAME=ki_protokoll\\nLOG_DB_USER=mcp_logger\\nLOG_DB_PASSWORD=DIFFERENT_SECURE_PASSWORD_HERE\\n\\n# Ollama (optional)\\nOLLAMA_HOST=http:\/\/localhost:11434\\nOLLAMA_MODEL=mistral<\/code><\/pre>\\n\\n<h2>5. Datenbank vorbereiten<\/h2>\\n\\n<h3>Task-Tabellen erstellen<\/h3>\\n<pre><code>-- Haupttabelle\\nCREATE TABLE IF NOT EXISTS tasks (\\n id INT AUTO_INCREMENT PRIMARY KEY,\\n title VARCHAR(255) NOT NULL,\\n description TEXT,\\n type ENUM('human_task', 'ai_task', 'mixed') DEFAULT 'ai_task',\\n status ENUM('pending', 'in_progress', 'completed', 'failed', 'cancelled') DEFAULT 'pending',\\n parent_task_id INT DEFAULT NULL,\\n due_date DATETIME DEFAULT NULL,\\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP,\\n updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\\n FOREIGN KEY (parent_task_id) REFERENCES tasks(id) ON DELETE SET NULL,\\n INDEX idx_status (status),\\n INDEX idx_type (type)\\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\\n\\n-- Zuweisungen\\nCREATE TABLE IF NOT EXISTS task_assignments (\\n id INT AUTO_INCREMENT PRIMARY KEY,\\n task_id INT NOT NULL,\\n assignee VARCHAR(100) NOT NULL,\\n assignee_type ENUM('human', 'ollama', 'claude', 'anthropic_api') NOT NULL,\\n model_name VARCHAR(100) DEFAULT NULL,\\n notes TEXT,\\n assigned_at DATETIME DEFAULT CURRENT_TIMESTAMP,\\n FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE,\\n INDEX idx_task_id (task_id)\\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\\n\\n-- Ergebnisse\\nCREATE TABLE IF NOT EXISTS task_results (\\n id INT AUTO_INCREMENT PRIMARY KEY,\\n task_id INT NOT NULL,\\n response TEXT NOT NULL,\\n executor VARCHAR(100) NOT NULL,\\n executor_type ENUM('human', 'ollama', 'claude', 'anthropic_api') NOT NULL,\\n model_name VARCHAR(100) DEFAULT NULL,\\n status ENUM('success', 'error', 'partial') DEFAULT 'success',\\n tokens_input INT DEFAULT 0,\\n tokens_output INT DEFAULT 0,\\n cost_usd DECIMAL(10,6) DEFAULT 0,\\n duration_ms INT DEFAULT 0,\\n error_message TEXT,\\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP,\\n FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE,\\n INDEX idx_task_id (task_id),\\n INDEX idx_executor_type (executor_type)\\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\\n\\n-- Kommentare (optional)\\nCREATE TABLE IF NOT EXISTS task_comments (\\n id INT AUTO_INCREMENT PRIMARY KEY,\\n task_id INT NOT NULL,\\n author VARCHAR(100) NOT NULL,\\n content TEXT NOT NULL,\\n created_at DATETIME DEFAULT CURRENT_TIMESTAMP,\\n FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE\\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;<\/code><\/pre>\\n\\n<h3>DB-User Berechtigungen<\/h3>\\n<pre><code>-- claude_code: Volle CRUD-Rechte auf Task-Tabellen\\nGRANT SELECT, INSERT, UPDATE, DELETE ON ki_protokoll.tasks TO 'claude_code'@'localhost';\\nGRANT SELECT, INSERT, UPDATE, DELETE ON ki_protokoll.task_assignments TO 'claude_code'@'localhost';\\nGRANT SELECT, INSERT, UPDATE, DELETE ON ki_protokoll.task_results TO 'claude_code'@'localhost';\\nGRANT SELECT, INSERT, UPDATE, DELETE ON ki_protokoll.task_comments TO 'claude_code'@'localhost';\\n\\n-- mcp_logger: Nur INSERT auf mcp_log\\nGRANT INSERT ON ki_protokoll.mcp_log TO 'mcp_logger'@'localhost';\\n\\nFLUSH PRIVILEGES;<\/code><\/pre>\\n\\n<h2>6. Server testen<\/h2>\\n<pre><code># Manuell starten\\ncd \/opt\/mcp-servers\/mcp-tasks\\nsource venv\/bin\/activate\\npython server.py\\n\\n# Bei Erfolg: Server wartet auf stdio Input\\n# Strg+C zum Beenden<\/code><\/pre>\\n\\n<h2>7. In Claude Code registrieren<\/h2>\\n\\n<h3>User-Scope (Global)<\/h3>\\n<p>Registrierung für alle Projekte:<\/p>\\n<pre><code>claude mcp add mcp-tasks \\\\\\n \/opt\/mcp-servers\/mcp-tasks\/venv\/bin\/python \\\\\\n \/opt\/mcp-servers\/mcp-tasks\/server.py<\/code><\/pre>\\n\\n<h3>Projekt-Scope (Lokal)<\/h3>\\n<p>Registrierung nur für ein bestimmtes Projekt:<\/p>\\n<pre><code>cd \/var\/www\\nclaude mcp add mcp-tasks \\\\\\n \/opt\/mcp-servers\/mcp-tasks\/venv\/bin\/python \\\\\\n \/opt\/mcp-servers\/mcp-tasks\/server.py<\/code><\/pre>\\n\\n<h2>8. Registrierung prüfen<\/h2>\\n<pre><code># Liste aller MCP Server\\nclaude mcp list\\n\\n# Erwartete Ausgabe:\\n# mcp-tasks: connected\\n\\n# In Claude Code Session\\n\/mcp<\/code><\/pre>\\n\\n<h2>9. Tools testen<\/h2>\\n<pre><code># Task-Management\\ntasks_list()\\ntasks_statistics()\\n\\n# Task erstellen und ausführen\\ntasks_create(title=\\\"Test-Task\\\", type=\\\"ai_task\\\")\\ntasks_execute(id=1, model=\\\"mistral\\\")\\n\\n# Quality-Checks\\ncontracts_list()\\nquality_check(path=\\\"\/var\/www\/dev.campus.systemische-tools.de\/src\\\")<\/code><\/pre>\\n\\n<h2>Ollama-Integration<\/h2>\\n<p>Für <code>tasks_execute<\/code> muss Ollama laufen:<\/p>\\n<pre><code># Ollama Status prüfen\\nollama list\\n\\n# Modell laden (falls nicht vorhanden)\\nollama pull mistral\\n\\n# Test\\ncurl http:\/\/localhost:11434\/api\/tags<\/code><\/pre>\\n\\n<h2>Troubleshooting<\/h2>\\n\\n<h3>Server startet nicht<\/h3>\\n<pre><code># Dependencies prüfen\\npip list | grep -E \\\"mcp|pymysql|dotenv\\\"\\n\\n# Python Version\\npython --version # Muss 3.10+ sein\\n\\n# Import-Fehler finden\\npython -c \\\"from tools.task_tools import register_task_tools\\\"<\/code><\/pre>\\n\\n<h3>Verbindungsfehler<\/h3>\\n<pre><code># .env prüfen (ohne Passwörter anzuzeigen)\\ncat .env | grep -v PASSWORD\\n\\n# DB-Verbindung testen (über MCP)\\ntasks_list(limit=1)<\/code><\/pre>\\n\\n<h3>Ollama-Fehler<\/h3>\\n<pre><code># Ollama Status\\nsystemctl status ollama\\n\\n# API erreichbar?\\ncurl http:\/\/localhost:11434\/api\/tags\\n\\n# Modell vorhanden?\\nollama list | grep mistral<\/code><\/pre>\\n\\n<h3>Permission Denied<\/h3>\\n<pre><code># .env Berechtigungen\\nls -la .env # Muss 600 sein\\n\\n# DB-Rechte prüfen (über MCP-DB)\\ndb_select(\\\"SHOW GRANTS FOR 'claude_code'@'localhost'\\\")<\/code><\/pre>\\n\\n<h2>Updates<\/h2>\\n<pre><code># Dependencies aktualisieren\\ncd \/opt\/mcp-servers\/mcp-tasks\\nsource venv\/bin\/activate\\npip install --upgrade mcp pymysql python-dotenv requests pyyaml\\n\\n# Server wird beim nächsten Claude Code Start neu geladen<\/code><\/pre>\\n\\n<h2>Deinstallation<\/h2>\\n<pre><code># Aus Claude Code entfernen\\nclaude mcp remove mcp-tasks\\n\\n# Verzeichnis löschen (optional)\\nrm -rf \/opt\/mcp-servers\/mcp-tasks\\n\\n# Tabellen behalten oder löschen (optional)\\nDROP TABLE task_comments;\\nDROP TABLE task_results;\\nDROP TABLE task_assignments;\\nDROP TABLE tasks;<\/code><\/pre>\\n\\n<h2>Verwandte Themen<\/h2>\\n<ul>\\n <li><a href=\\\"\/docs\/mcp\/mcp-tasks\\\">MCP-Tasks Übersicht<\/a><\/li>\\n <li><a href=\\\"\/docs\/mcp\/mcp-tasks-architektur\\\">Architektur<\/a><\/li>\\n <li><a href=\\\"\/docs\/mcp\/mcp-tasks-tools\\\">Tools im Detail<\/a><\/li>\\n <li><a href=\\\"\/docs\/module\/ollama\\\">Ollama<\/a> - Lokale KI-Modelle<\/li>\\n<\/ul>\",\n \"status\": \"published\",\n \"sort_order\": 3,\n \"depth\": 2,\n \"created_at\": \"2025-12-20T11:13:58\",\n \"updated_at\": \"2025-12-20T11:13:58\"\n }\n}"
}
]
}