Octopus API网关管理MCP服务器

一套用于管理自托管 Octopus LLM API 网关的 MCP 服务器,支持通过自然语言创建 API 密钥、配置渠道、调整模型定价、查看统计信息等。

  • by XimilalaXiang
  • Go
  • 本地部署
  • 更新于
在 GitHub 查看 XimilalaXiang/octopus-mcp

使用说明

Octopus MCP Server

MCP (Model Context Protocol) server for managing your self-hosted Octopus LLM API gateway.

Enables AI assistants to manage Octopus via natural language — create API keys, configure channels, adjust model pricing, view statistics, and more.

Features

  • Channel Management — Create, update, enable/disable, delete LLM provider channels
  • API Key Management — Create, update, delete API keys with cost limits and model restrictions
  • Group Management — Configure model groups with load balancing (round-robin, random, failover, weighted)
  • Model Pricing — Set custom input/output/cache prices per model
  • Statistics — View today's, daily, hourly, and total usage stats
  • Settings — Configure proxy, CORS, circuit breaker, sync intervals
  • Logs — Browse and clear relay request logs
  • Database Export — Export full database as JSON

Quick Start

Docker Compose

services:
  octopus-mcp:
    image: ghcr.io/ximilalaxiang/octopus-mcp:latest
    ports:
      - "8767:8767"
    environment:
      - OCTOPUS_URL=http://your-octopus:8080
      - OCTOPUS_USERNAME=admin
      - OCTOPUS_PASSWORD=your-password
      # MCP_AUTH_TOKEN is auto-generated if not set — check container logs

Docker Run

docker run -d --name octopus-mcp \
  -p 8767:8767 \
  -e OCTOPUS_URL=http://your-octopus:8080 \
  -e OCTOPUS_USERNAME=admin \
  -e OCTOPUS_PASSWORD=your-password \
  ghcr.io/ximilalaxiang/octopus-mcp:latest

Build from Source

go build -o octopus-mcp .
OCTOPUS_URL=http://localhost:8080 OCTOPUS_USERNAME=admin OCTOPUS_PASSWORD=admin ./octopus-mcp

Environment Variables

Variable Description Default
OCTOPUS_URL Octopus API base URL http://localhost:8080
OCTOPUS_USERNAME Admin username admin
OCTOPUS_PASSWORD Admin password admin
MCP_AUTH_TOKEN MCP authentication token Auto-generated
MCP_LISTEN_ADDR Listen address 0.0.0.0
MCP_LISTEN_PORT Listen port 8767

MCP Client Configuration

Cursor / Claude Desktop

{
  "mcpServers": {
    "octopus": {
      "url": "http://your-server:8767/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_MCP_AUTH_TOKEN"
      }
    }
  }
}

Compatibility

v2.0.0 targets Octopus v0.13+ (cookie-based login, channel keys/grants, failover groups). It does not work with Octopus v0.9.x; use the v1.x tag for those.

Available Tools (35)

Tool Description
list_channels List channels with status and usage (per-model stats with include_models)
get_channel Full config of one channel (keys, models, grants)
list_channel_grants List channel grants; filter by channel_id / model_name
create_channel Create a channel with one key and grant its models
update_channel Update a channel (reads current config, applies provided fields)
enable_channel Enable/disable a channel
delete_channel Delete a channel
fetch_channel_models Probe a provider for models and supported protocols
list_api_keys List all API keys
create_api_key Create a new API key
update_api_key Update API key settings (other fields are preserved)
delete_api_key Delete an API key
list_groups / get_group List groups / get one with members and routing state
create_group Create a group (manual or failover, members by grant ID)
update_group Update group settings, members, and relay config
delete_group Delete a group
list_models List model prices
create_model_price / update_model_price / delete_model_price Manage model pricing
sync_model_prices / rebuild_model_prices Sync from models.dev / rebuild from channels
get_model_price_update_time Last price sync time
get_stats_daily Daily historical stats
get_stats_hourly Hourly breakdown
get_stats_total All-time totals
get_stats_apikey Per-API-key stats
list_settings / update_setting View / modify system settings
get_log_request_body / get_log_response_body Stored bodies of a relay log
stop_request Cancel an in-flight request (or one round)
clear_logs Clear all logs
export_database Export database as JSON

License

MIT