Protokoll #3724
| ID | 3724 |
|---|---|
| Zeitstempel | 2025-12-22 08:26:22.184685 |
| Client | root |
| IP | Warning: Undefined array key "request_ip" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 13 |
| Modell | claude-sonnet-4-20250514 |
| Status | completed |
| Tokens | 2,705 (Input: 0, Output: 0) |
| Dauer | 76 ms |
| Request-Zeit | Warning: Undefined array key "request_timestamp" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 18 |
| Response-Zeit | - |
Warning: Undefined array key "error_message" in /var/www/dev.campus.systemische-tools.de/src/View/protokoll/show.php on line 22
Request
{
"event": "PreToolUse",
"tool_name": "mcp__mcp-docs__docs_get",
"tool_input": {
"id": 41
}
}
Response
{
"tool_response": [
{
"type": "text",
"text": "{\n \"success\": true,\n \"doc\": {\n \"id\": 41,\n \"parent_id\": 36,\n \"slug\": \"mcp-db-config\",\n \"path\": \"\/mcp\/mcp-db\/mcp-db-config\",\n \"title\": \"Konfiguration\",\n \"description\": \"Zentrale Konfiguration über Environment Variables und Config-Klasse.\",\n \"content\": \"<nav class=\\\"breadcrumb\\\">\\n <a href=\\\"\/docs\\\">Dokumentation<\/a> » <a href=\\\"\/docs\/mcp\/mcp-db\\\">MCP-DB<\/a> » Konfiguration\\n<\/nav>\\n\\n<h1>MCP-DB Konfiguration<\/h1>\\n<p>Zentrale Konfiguration über Environment Variables, Config-Klasse und Claude Code Hooks.<\/p>\\n\\n<h2>Übersicht<\/h2>\\n<table>\\n <tr><th>Bereich<\/th><th>Datei<\/th><th>Beschreibung<\/th><\/tr>\\n <tr><td>MCP-DB Server<\/td><td><code>\/opt\/mcp-servers\/mcp-db\/.env<\/code><\/td><td>DB-Credentials<\/td><\/tr>\\n <tr><td>MCP-DB Config<\/td><td><code>\/opt\/mcp-servers\/mcp-db\/config.py<\/code><\/td><td>Allowlists, Limits<\/td><\/tr>\\n <tr><td>Claude Code Hooks<\/td><td><code>\/var\/www\/.claude\/settings.local.json<\/code><\/td><td>Blocking-Hook<\/td><\/tr>\\n <tr><td>Hook-Skript<\/td><td><code>\/var\/www\/tools\/ki-protokoll\/claude-hook\/block_direct_db.py<\/code><\/td><td>DB-Zugriff blockieren<\/td><\/tr>\\n<\/table>\\n\\n<h2>Claude Code Hook-Konfiguration<\/h2>\\n<p class=\\\"alert alert-warning\\\"><strong>Wichtig:<\/strong> Der Blocking-Hook verhindert direkte mysql\/mariadb-Befehle!<\/p>\\n\\n<h3>settings.local.json<\/h3>\\n<p>Pfad: <code>\/var\/www\/.claude\/settings.local.json<\/code><\/p>\\n\\n<pre><code>{\\n \\\"hooks\\\": {\\n \\\"PreToolUse\\\": [\\n {\\n \\\"matcher\\\": \\\"Bash\\\",\\n \\\"hooks\\\": [\\n {\\n \\\"type\\\": \\\"command\\\",\\n \\\"command\\\": \\\"\/var\/www\/tools\/ki-protokoll\/claude-hook\/block_direct_db.py\\\",\\n \\\"timeout\\\": 5\\n }\\n ]\\n }\\n ]\\n },\\n \\\"permissions\\\": {\\n \\\"allow\\\": [\\n \\\"mcp__mcp-db__db_select\\\",\\n \\\"mcp__mcp-db__db_schema\\\",\\n \\\"mcp__mcp-db__db_stats\\\",\\n \/\/ ... weitere Permissions\\n ]\\n }\\n}<\/code><\/pre>\\n\\n<h3>Hook-Konfiguration erklärt<\/h3>\\n<table>\\n <tr><th>Feld<\/th><th>Wert<\/th><th>Beschreibung<\/th><\/tr>\\n <tr><td>matcher<\/td><td>\\\"Bash\\\"<\/td><td>Hook wird nur bei Bash-Tool-Aufrufen getriggert<\/td><\/tr>\\n <tr><td>type<\/td><td>\\\"command\\\"<\/td><td>Externes Skript ausführen<\/td><\/tr>\\n <tr><td>command<\/td><td>Pfad zum Python-Skript<\/td><td>Blocking-Hook<\/td><\/tr>\\n <tr><td>timeout<\/td><td>5<\/td><td>Timeout in Sekunden<\/td><\/tr>\\n<\/table>\\n\\n<h3>Exit-Codes<\/h3>\\n<table>\\n <tr><th>Exit Code<\/th><th>Bedeutung<\/th><th>Aktion<\/th><\/tr>\\n <tr><td>0<\/td><td>Erlauben<\/td><td>Befehl wird ausgeführt<\/td><\/tr>\\n <tr><td>2<\/td><td>Blockieren<\/td><td>Befehl wird abgelehnt, stderr wird angezeigt<\/td><\/tr>\\n<\/table>\\n\\n<h2>config.py<\/h2>\\n<pre><code>\\\"\\\"\\\"Zentrale Konfiguration\\\"\\\"\\\"\\nimport os\\nfrom typing import List\\n\\nclass Config:\\n \\\"\\\"\\\"Konfiguration aus Environment Variables\\\"\\\"\\\"\\n\\n # Datenbank für Queries (mcp_readonly)\\n DB_HOST: str = os.getenv(\\\"DB_HOST\\\", \\\"localhost\\\")\\n DB_USER: str = os.getenv(\\\"DB_USER\\\", \\\"mcp_readonly\\\")\\n DB_PASSWORD: str = os.getenv(\\\"DB_PASSWORD\\\", \\\"\\\")\\n\\n # Datenbank für Logging (mcp_logger)\\n LOG_DB_HOST: str = os.getenv(\\\"LOG_DB_HOST\\\", \\\"localhost\\\")\\n LOG_DB_NAME: str = os.getenv(\\\"LOG_DB_NAME\\\", \\\"ki_protokoll\\\")\\n LOG_DB_USER: str = os.getenv(\\\"LOG_DB_USER\\\", \\\"mcp_logger\\\")\\n LOG_DB_PASSWORD: str = os.getenv(\\\"LOG_DB_PASSWORD\\\", \\\"\\\")\\n\\n # Database Allowlist\\n ALLOWED_DATABASES: List[str] = [\\\"ki_protokoll\\\", \\\"ki_system\\\"]\\n\\n # Dangerous Keyword Blocklist\\n BLOCKED_KEYWORDS: List[str] = [\\n \\\"DROP\\\", \\\"DELETE\\\", \\\"INSERT\\\", \\\"UPDATE\\\", \\\"TRUNCATE\\\",\\n \\\"ALTER\\\", \\\"CREATE\\\", \\\"RENAME\\\", \\\"GRANT\\\", \\\"REVOKE\\\",\\n \\\"LOAD_FILE\\\", \\\"INTO OUTFILE\\\", \\\"INTO DUMPFILE\\\",\\n \\\"BENCHMARK\\\", \\\"SLEEP\\\"\\n ]\\n\\n # Query Limits\\n MAX_QUERY_LENGTH: int = 2000\\n MAX_ROWS: int = 100\\n QUERY_TIMEOUT_SEC: int = 30\\n\\n # Table Allowlist (29 Tabellen)\\n ALLOWED_TABLES: List[str] = [\\n # ki_protokoll\\n \\\"mcp_log\\\", \\\"protokoll\\\", \\\"file_backup_history\\\",\\n # ki_system - Content Studio\\n \\\"content_orders\\\", \\\"content_versions\\\", \\\"content_contracts\\\",\\n \\\"content_critiques\\\", \\\"content_sources\\\", \\\"content_structures\\\",\\n \\\"author_profiles\\\", \\\"critics\\\",\\n # ki_system - RAG\/Documents\\n \\\"documents\\\", \\\"chunks\\\", \\\"document_entities\\\", \\\"document_taxonomy\\\",\\n # ki_system - Chat\\n \\\"chat_sessions\\\", \\\"chat_messages\\\",\\n # ki_system - Pipeline\\n \\\"pipeline_log\\\", \\\"pipeline_queue\\\", \\\"prompts\\\", \\\"prompt_tests\\\", \\\"llm_requests\\\",\\n # ki_system - Entities\/Taxonomy\\n \\\"entities\\\", \\\"entity_relations\\\", \\\"entity_synonyms\\\",\\n \\\"entity_classifications\\\", \\\"entity_corrections\\\",\\n \\\"taxonomy_terms\\\", \\\"ontology_classes\\\",\\n # ki_system - Search\\n \\\"search_history\\\",\\n ]<\/code><\/pre>\\n\\n<h2>Environment Variables<\/h2>\\n<table>\\n <tr><th>Variable<\/th><th>Beschreibung<\/th><th>Default<\/th><\/tr>\\n <tr><td>DB_HOST<\/td><td>Datenbank-Host für Queries<\/td><td>localhost<\/td><\/tr>\\n <tr><td>DB_USER<\/td><td>User für Queries (nur SELECT)<\/td><td>mcp_readonly<\/td><\/tr>\\n <tr><td>DB_PASSWORD<\/td><td>Passwort für Query-User<\/td><td>-<\/td><\/tr>\\n <tr><td>LOG_DB_HOST<\/td><td>Datenbank-Host für Logging<\/td><td>localhost<\/td><\/tr>\\n <tr><td>LOG_DB_NAME<\/td><td>Datenbank für Logging<\/td><td>ki_protokoll<\/td><\/tr>\\n <tr><td>LOG_DB_USER<\/td><td>User für Logging (nur INSERT)<\/td><td>mcp_logger<\/td><\/tr>\\n <tr><td>LOG_DB_PASSWORD<\/td><td>Passwort für Logger-User<\/td><td>-<\/td><\/tr>\\n<\/table>\\n\\n<h2>.env.example<\/h2>\\n<pre><code># Datenbank für Queries (mcp_readonly)\\nDB_HOST=localhost\\nDB_USER=mcp_readonly\\nDB_PASSWORD=\\n\\n# Datenbank für Logging (mcp_logger)\\nLOG_DB_HOST=localhost\\nLOG_DB_NAME=ki_protokoll\\nLOG_DB_USER=mcp_logger\\nLOG_DB_PASSWORD=<\/code><\/pre>\\n\\n<h2>Allowlists<\/h2>\\n\\n<h3>Database Allowlist<\/h3>\\n<p>Nur diese Datenbanken sind erlaubt:<\/p>\\n<ul>\\n <li><code>ki_protokoll<\/code> - Protokoll und Logging<\/li>\\n <li><code>ki_system<\/code> - KI-System Daten<\/li>\\n<\/ul>\\n\\n<h3>Table Allowlist (30 Tabellen)<\/h3>\\n<p>Nur diese Tabellen sind für SELECT erlaubt:<\/p>\\n\\n<h4>ki_protokoll (3 Tabellen)<\/h4>\\n<ul>\\n <li><code>mcp_log<\/code> - MCP Logging<\/li>\\n <li><code>protokoll<\/code> - Claude Protokoll<\/li>\\n <li><code>file_backup_history<\/code> - File Backup Verlauf<\/li>\\n<\/ul>\\n\\n<h4>ki_system - Content Studio (8 Tabellen)<\/h4>\\n<ul>\\n <li><code>content_orders<\/code> - Content-Aufträge<\/li>\\n <li><code>content_versions<\/code> - Content-Versionen<\/li>\\n <li><code>content_contracts<\/code> - Content-Contracts<\/li>\\n <li><code>content_critiques<\/code> - Kritiken<\/li>\\n <li><code>content_sources<\/code> - Quellen<\/li>\\n <li><code>content_structures<\/code> - Strukturen<\/li>\\n <li><code>author_profiles<\/code> - Autoren-Profile<\/li>\\n <li><code>critics<\/code> - Kritiker-Definitionen<\/li>\\n<\/ul>\\n\\n<h4>ki_system - RAG\/Documents (4 Tabellen)<\/h4>\\n<ul>\\n <li><code>documents<\/code> - Dokumente<\/li>\\n <li><code>chunks<\/code> - Dokument-Chunks für RAG<\/li>\\n <li><code>document_entities<\/code> - Dokument-Entitäten<\/li>\\n <li><code>document_taxonomy<\/code> - Dokument-Taxonomie<\/li>\\n<\/ul>\\n\\n<h4>ki_system - Chat (2 Tabellen)<\/h4>\\n<ul>\\n <li><code>chat_sessions<\/code> - Chat-Sessions<\/li>\\n <li><code>chat_messages<\/code> - Chat-Nachrichten<\/li>\\n<\/ul>\\n\\n<h4>ki_system - Pipeline (5 Tabellen)<\/h4>\\n<ul>\\n <li><code>pipeline_log<\/code> - Pipeline-Log<\/li>\\n <li><code>pipeline_queue<\/code> - Pipeline-Queue<\/li>\\n <li><code>prompts<\/code> - Prompts<\/li>\\n <li><code>prompt_tests<\/code> - Prompt-Tests<\/li>\\n <li><code>llm_requests<\/code> - LLM-Requests<\/li>\\n<\/ul>\\n\\n<h4>ki_system - Entities\/Taxonomy (7 Tabellen)<\/h4>\\n<ul>\\n <li><code>entities<\/code> - Entitäten<\/li>\\n <li><code>entity_relations<\/code> - Entitäts-Relationen<\/li>\\n <li><code>entity_synonyms<\/code> - Synonyme<\/li>\\n <li><code>entity_classifications<\/code> - Klassifikationen<\/li>\\n <li><code>entity_corrections<\/code> - Korrekturen<\/li>\\n <li><code>taxonomy_terms<\/code> - Taxonomie-Begriffe<\/li>\\n <li><code>ontology_classes<\/code> - Ontologie-Klassen<\/li>\\n<\/ul>\\n\\n<h4>ki_system - Search (1 Tabelle)<\/h4>\\n<ul>\\n <li><code>search_history<\/code> - Suchverlauf<\/li>\\n<\/ul>\\n\\n<p>Zusätzlich erlaubt: <code>information_schema.TABLES<\/code> für Schema-Abfragen.<\/p>\\n\\n<h2>Keyword Blocklist<\/h2>\\n<p>Diese Keywords werden in Queries blockiert (mit Word Boundaries):<\/p>\\n<table>\\n <tr><th>Kategorie<\/th><th>Keywords<\/th><\/tr>\\n <tr><td>DML<\/td><td>DELETE, INSERT, UPDATE<\/td><\/tr>\\n <tr><td>DDL<\/td><td>DROP, TRUNCATE, ALTER, CREATE, RENAME<\/td><\/tr>\\n <tr><td>DCL<\/td><td>GRANT, REVOKE<\/td><\/tr>\\n <tr><td>File-Operationen<\/td><td>LOAD_FILE, INTO OUTFILE, INTO DUMPFILE<\/td><\/tr>\\n <tr><td>DoS-Funktionen<\/td><td>BENCHMARK, SLEEP<\/td><\/tr>\\n<\/table>\\n\\n<h2>Limits<\/h2>\\n<table>\\n <tr><th>Limit<\/th><th>Wert<\/th><th>Beschreibung<\/th><\/tr>\\n <tr><td>MAX_QUERY_LENGTH<\/td><td>2000<\/td><td>Maximale Query-Länge in Zeichen<\/td><\/tr>\\n <tr><td>MAX_ROWS<\/td><td>100<\/td><td>Maximale Ergebniszeilen<\/td><\/tr>\\n <tr><td>QUERY_TIMEOUT_SEC<\/td><td>30<\/td><td>Query-Timeout in Sekunden<\/td><\/tr>\\n<\/table>\\n\\n<h2>Hook-Konfiguration ändern<\/h2>\\n\\n<h3>Hook aktivieren\/deaktivieren<\/h3>\\n<pre><code># Hook deaktivieren (NICHT EMPFOHLEN!)\\n# Entferne den PreToolUse Block aus settings.local.json\\n\\n# Hook aktivieren\\n# Füge den Block wieder hinzu (siehe oben)<\/code><\/pre>\\n\\n<h3>Nach Änderungen<\/h3>\\n<pre><code># Claude Code muss neu gestartet werden\\n# damit Änderungen an settings.local.json wirksam werden<\/code><\/pre>\\n\\n<h2>Erweiterung der Allowlists<\/h2>\\n<pre><code># In config.py erweitern:\\nALLOWED_TABLES: List[str] = [\\n \\\"mcp_log\\\",\\n \\\"ki_eintraege\\\",\\n # Neue Tabellen hinzufügen:\\n \\\"neue_tabelle\\... [TRUNCATED-e4e3d9720541f940]"
}
]
}