========================================
MCP FILESYSTEM (SSE) – SEADISTUS ja KASUTUSJUHEND
========================================

Asukoht serveris: /opt/docker-compose/third/server/mcp-filesystem
Andmete kaust:     /data/mcp-filesystem
Tailscale IP:      100.87.1.24
Serveri hostname:  ohmu

MÄRKUS (2026-09-04): endine stdio-konteiner `mcp-filesystem` on
eemaldatud. Aktiivne on ainult `mcp-filesystem-sse` (HTTP/SSE,
port 3100). Juhend kirjeldab seda.

------------------------------------------------
1. MIS SEE ON?
------------------------------------------------
MCP (Model Context Protocol) failiserver võimaldab AI assistentidel
(opencode, Open WebUI, n8n jne) lugeda, kirjutada ja hallata faile
üle HTTP/SSE.

------------------------------------------------
2. KUIDAS KÄIVITADA?
------------------------------------------------
   cd /opt/docker-compose/third/server/mcp-filesystem
   docker compose up -d

Käivitab ühe konteineri:
  mcp-filesystem-sse – HTTP/SSE endpoint (port 3100)

------------------------------------------------
3. KONTEINERI EHITAMINE
------------------------------------------------
SSE image (vajab Node.js + Python mcp-proxy; base: python:3.13-slim):
  docker build -t mcp-filesystem-sse /opt/docker-compose/third/server/mcp-filesystem

------------------------------------------------
4. ÜHENDAMINE
------------------------------------------------
opencode (üle Tailscale / võrgu):
  opencode.json:
  {
    "mcp": {
      "filesystem": {
        "type": "remote",
        "url": "http://100.87.1.24:3100/sse"
      }
    }
  }

Open WebUI (Manage Tool Servers):
  URL:   http://mcp-filesystem-sse:3100/mcp
  Type:  MCP (Streamable HTTP)
  Auth:  none

n8n MCP Client:
  Endpoint URL: http://100.87.1.24:3100/sse
  Type: SSE

------------------------------------------------
5. MCP TÖÖRIISTAD (AI-le saadaval)
------------------------------------------------
- filesystem_list_allowed_directories
- filesystem_list_directory
- filesystem_list_directory_with_sizes
- filesystem_read_text_file
- filesystem_read_multiple_files
- filesystem_write_file
- filesystem_edit_file
- filesystem_create_directory
- filesystem_read_media_file
- filesystem_get_file_info
- filesystem_move_file
- filesystem_search_files
- filesystem_directory_tree

------------------------------------------------
6. TESTIMINE
------------------------------------------------
Pärast ühendamist küsi AI-lt:
  "Loetle failid kaustas /projects/data"
  "Millised MCP tööriistad sul saadaval on?"

------------------------------------------------
7. SÜSTEEMI TAASTAMINE (puhtalt uuesti)
------------------------------------------------
Kui kogu süsteem on kadunud:

  cd /opt/docker-compose/third/server/mcp-filesystem
  docker build -t mcp-filesystem-sse .
  docker compose up -d

------------------------------------------------
8. FAILIDE ASUKOHT
------------------------------------------------
Andmed:     /data/mcp-filesystem
Varukoopia: /backups/docker/mcp-fileserver

------------------------------------------------
9. n8n MCP KLIENT
------------------------------------------------
n8n (v2.13+) saab kasutada MCP servereid workflowdes.

Seadistus:
  - Endpoint: http://100.87.1.24:3100/sse
  - N8N_MCP_TOOLS_ENABLED=true lisatud docker-compose.env

Kasutamine n8n-s:
  - Ava https://n8n.tail20e23.ts.net
  - Uus workflow → otsi "MCP Client" node
  - Endpoint URL: http://100.87.1.24:3100/sse
  - Type: SSE
  - Nüüd saad workflowdes faile lugeda/kirjutada.

------------------------------------------------
10. INTEGREERITUD TEENUSED
------------------------------------------------
MCP kaudu nähtavad:
  /projects/data/            – docker-compose konfiguratsioonid (read-write)
  /projects/n8n/             – n8n andmebaas ja logid (read-only)
  /projects/n8n-workflows    – eksporditud workflowd (read-only)
  /projects/anythingllm/     – dokumendid, vektorbaas (read-only)
  /projects/open-webui/      – üleslaetud failid (read-only)
  /projects/backups/         – varukoopiad (read-write)

------------------------------------------------
11. LISATEE
------------------------------------------------
Lähemalt loe: https://opencode.ai/docs/mcp/servers/
