🖥️ Computer Use File Server + MCP

🔌 MCP Endpoint

Model Context Protocol (MCP) endpoint for executing commands in isolated Docker containers.

POST /mcp

JSON-RPC endpoint for calling Computer Use tools

GET /mcp

Information about available MCP tools

🔐 MCP Authorization

MCP endpoints require Bearer token:

Authorization: Bearer YOUR_API_KEY

📋 HTTP Headers for MCP

HeaderRequiredDescription
AuthorizationYesBearer token: Bearer <API_KEY>
X-Chat-IdYesUnique session/chat ID. Determines Docker container.
X-User-EmailNoUser email for git config
X-User-NameNoUser name for git config
X-Gitlab-TokenNoGitLab token for git/glab authentication
X-Gitlab-HostNoGitLab host (default: gitlab.com)
X-Anthropic-Api-KeyNoAnthropic API key for sub_agent
X-Anthropic-Base-UrlNoAnthropic base URL

🛠️ MCP Tools

📝 Direct MCP Access Examples

List Tools

curl -X POST https://localhost:8081/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <MCP_API_KEY>" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'

Call Tool

curl -X POST https://localhost:8081/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <MCP_API_KEY>" \
  -H "X-Chat-Id: my-session-123" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "bash_tool",
      "arguments": {
        "command": "echo Hello from container",
        "description": "Test command"
      }
    }
  }'

📁 File API

GET /files/{chat_id}/{filename}

Download file from container outputs directory

GET /files/{chat_id}/archive

Download all files as ZIP archive

POST /api/uploads/{chat_id}/{filename}

Upload file to container uploads directory

GET /api/uploads/{chat_id}/manifest

Get manifest of uploaded files (filename → MD5)

🌐 LiteLLM API Access

Access MCP tools through LiteLLM API (api.anthropic.com):

Available Tools

Required Headers

HeaderDescription
X-OpenWebUI-Chat-IdUnique chat ID (container isolation)
X-OpenWebUI-User-EmailUser email

Request Example

curl -X POST https://api.anthropic.com/v1/chat/completions \
  -H "Authorization: Bearer <API_KEY>" \
  -H "X-OpenWebUI-Chat-Id: my-chat-123" \
  -H "X-OpenWebUI-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude/claude-sonnet-4-5",
    "messages": [{"role": "user", "content": "Run ls -la"}]
  }'

List MCP Tools

curl -X POST https://api.anthropic.com/mcp/docker_ai/list_tools \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

🏗️ Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        Docker Host                              │
│                                                                 │
│  ┌──────────────────┐      ┌─────────────────────────────────┐ │
│  │  File Server     │      │  Docker Containers              │ │
│  │  (this service)  │      │                                 │ │
│  │                  │      │  ┌─────────────────────────┐   │ │
│  │  POST /mcp ──────┼──────┼──│ owui-chat-{chat_id}     │   │ │
│  │                  │      │  │  - bash_tool            │   │ │
│  │  GET /files/* ───┼──────┼──│  - view                 │   │ │
│  │                  │      │  │  - create_file          │   │ │
│  │                  │      │  │  - str_replace          │   │ │
│  └──────────────────┘      │  └─────────────────────────┘   │ │
│           │                │                                 │ │
│           │                │  ┌─────────────────────────┐   │ │
│           ▼                │  │ owui-chat-{other_id}    │   │ │
│  /var/run/docker.sock      │  └─────────────────────────┘   │ │
│                            └─────────────────────────────────┘ │
│                                                                 │
│  /data/{chat_id}/                                              │
│    ├── uploads/   (files from user)                            │
│    └── outputs/   (files created by AI)                        │
└─────────────────────────────────────────────────────────────────┘