Gainium Mcp

io.gainium由 gainium.io 發布官方發布者v3.3.0更新於 Oct 27, 2026

MCP server for Gainium — manage trading bots, deals, and balances via AI assistants

已驗證Streamable HTTP可網頁執行金融商業與電商

概覽

AI 產生的概覽

Gainium MCP 讓 AI 助理在 Gainium 平台上管理加密貨幣交易機器人、交易單、餘額並執行回測。

可以做什麼
  • 列出、檢視、建立、更新與複製 DCA、combo、grid 機器人,並啟動、停止、封存、還原或更換交易對
  • 列出與檢視交易單,建立或更新交易單,以及平倉、追加或減少資金
  • 執行回測(驗證、估算、非同步或同步)並列出或查詢回測請求
  • 讀取帳戶餘額、已連結與支援的交易所、全域變數,並查詢加密貨幣篩選器
  • 查詢機器人類型與指標的結構定義,並建立、更新或刪除全域變數
適用情境
適合在 Gainium 上運行交易機器人、希望直接在聊天用戶端中檢視機器人與交易單表現、調整設定或執行回測,而不必開啟網頁介面的使用者。
執行需求
可使用具 OAuth 登入的託管遠端端點,或在 Node.js 下以 npx 執行本機 npm 套件。本機與標頭模式需要 Gainium API 金鑰組,透過 GAINIUM_API_KEY 與 GAINIUM_API_SECRET 提供;另有選用變數可限定單一機器人或僅限模擬交易。需要能存取 Gainium API 的網路。
安裝前請注意
寫入類工具可建立與修改機器人、平倉、調動資金以及刪除全域變數,具寫入權限的 API 金鑰會帶來真實交易風險。建議使用唯讀金鑰,並以 GAINIUM_PAPER_ONLY 或 GAINIUM_ALLOWED_BOT_ID 限制範圍,避免把 API 金鑰寫進共用設定。託管 OAuth 模式會將憑證送往 Gainium 的授權伺服器。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Gainium Mcp,將其新增到工作區。
  2. 連接 所需的 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.gainium%2Fgainium-mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。 客戶端會在首次連接時完成 OAuth 登入。

{
  "mcpServers": {
    "gainium": {
      "type": "http",
      "url": "https://mcp.gainium.io/mcp"
    }
  }
}

README

gainium-mcp

An MCP (Model Context Protocol) server for Gainium — the crypto trading bot platform. Lets AI assistants manage your bots, deals, balances, and more through a standard MCP interface.

Detailed setup and connection documentation is available in docs/using-gainium-mcp.md.

Quick Start

1. Get your API keys

Go to Gainium API Settings and create an API key pair.

2. Add to your MCP client

Add this to your MCP configuration (VS Code, Claude Desktop, etc.):

json
{  "gainium-mcp": {    "command": "npx",    "args": ["-y", "gainium-mcp"],    "env": {      "GAINIUM_API_KEY": "<your-api-key>",      "GAINIUM_API_SECRET": "<your-api-secret>"    }  }}

That's it. The server starts automatically when your AI assistant needs it.

This local stdio mode uses GAINIUM_API_KEY and GAINIUM_API_SECRET from the server process environment.

Environment Variables

VariableRequiredDefaultDescription
GAINIUM_API_KEYYes—Your Gainium API public key
GAINIUM_API_SECRETYes—Your Gainium API secret
GAINIUM_API_BASE_URLNohttps://api.gainium.ioAPI base URL
GAINIUM_MCP_TRANSPORTNostdioTransport mode: stdio, http, streamable-http, sse, or http-sse
GAINIUM_MCP_HOSTNo127.0.0.1Bind host for HTTP mode
GAINIUM_MCP_PORTNo3000Bind port for HTTP mode
GAINIUM_MCP_ALLOWED_HOSTSNo—Comma-separated hostnames (optionally host:port) accepted in the Host/Origin headers. In HTTP mode with env credentials and no OAuth, only loopback, IP-literal and these hosts are served (DNS rebinding protection)
GAINIUM_MCP_HTTP_PATHNo/mcpStreamable HTTP endpoint path
GAINIUM_MCP_SSE_PATHNo/sseDeprecated SSE GET endpoint path
GAINIUM_MCP_MESSAGES_PATHNo/messagesDeprecated SSE POST endpoint path
GAINIUM_OAUTH_ISSUERNo—Authorization-server base URL. Setting this (with MCP_INTROSPECTION_SECRET, in HTTP mode) enables OAuth protected-resource mode
GAINIUM_INTROSPECTION_URLNo<issuer>/oauth/introspectToken introspection endpoint
MCP_INTROSPECTION_SECRETNo—Shared secret presented to the introspection endpoint (must match the auth server)
GAINIUM_MCP_PUBLIC_URLNoderived from requestPublic base URL used in the protected-resource metadata
OPENAI_APPS_CHALLENGE_TOKENNo—When set, served as plain text at /.well-known/openai-apps-challenge for OpenAI Apps domain verification

Authentication Modes

gainium-mcp supports three deployment models:

  • Local stdio mode: the MCP server reads GAINIUM_API_KEY and GAINIUM_API_SECRET from env vars.
  • OAuth 2.1 hosted mode (recommended for hosted/public): the server acts as an OAuth protected resource. Clients (e.g. the Claude connector) obtain an access token from the Gainium authorization server and send it as Authorization: Bearer <token>. See OAuth 2.1 hosted mode below.
  • Header hosted mode (legacy/self-hosted): each request sends X-API-Key and X-API-Secret headers so one shared server can serve many users.

In header/stdio mode, request headers take priority, falling back to GAINIUM_API_KEY / GAINIUM_API_SECRET. When OAuth mode is enabled, the Bearer token is required and the X-API-Key/X-API-Secret headers are ignored.

OAuth 2.1 hosted mode

This is the mode used for the public https://mcp.gainium.io/mcp endpoint and the Anthropic Claude connector directory (which requires OAuth and forbids API-key headers).

Enable it by setting, in HTTP mode:

bash
export GAINIUM_MCP_TRANSPORT=httpexport GAINIUM_OAUTH_ISSUER=https://app.gainium.io        # Gainium authorization serverexport MCP_INTROSPECTION_SECRET=<shared-secret>           # must match the auth serverexport GAINIUM_MCP_PUBLIC_URL=https://mcp.gainium.io      # this server's public URL# optional, defaults to <issuer>/oauth/introspect:# export GAINIUM_INTROSPECTION_URL=https://app.gainium.io/oauth/introspectnode dist/server.js

When enabled, the server:

  1. Serves OAuth Protected Resource Metadata (RFC 9728) at /.well-known/oauth-protected-resource and /.well-known/oauth-protected-resource/mcp, advertising the authorization server.
  2. Rejects unauthenticated MCP requests with 401 Unauthorized and a WWW-Authenticate: Bearer resource_metadata="…" header, so clients can discover the auth server and run the OAuth flow (Dynamic Client Registration + PKCE).
  3. Validates the Bearer access token on each request via the auth server's token introspection endpoint, resolving it to the user's Gainium (apiKey, apiSecret) and per-key restrictions (read/write, paper-only, single-bot), which are still enforced server-side. Introspection results are cached briefly.

The local stdio path is unaffected by these variables.

HTTP and SSE Mode

By default, gainium-mcp runs over stdio for MCP clients that spawn local processes. To run it as an HTTP server instead:

bash
export GAINIUM_MCP_TRANSPORT=httpexport GAINIUM_MCP_HOST=127.0.0.1export GAINIUM_MCP_PORT=3000node dist/server.js

When HTTP mode is enabled, the server exposes both transport styles:

  • GET|POST|DELETE /mcp for the current Streamable HTTP transport
  • GET /sse plus POST /messages?sessionId=... for deprecated HTTP+SSE clients

This makes one server process compatible with both modern MCP HTTP clients and older SSE-based integrations. In hosted mode, authenticate with OAuth (see OAuth 2.1 hosted mode) or, for self-hosted/legacy setups, send X-API-Key and X-API-Secret on each request.

Available Tools (17)

As of v3.0.0 the toolset is consolidated: a single tool per operation, with a botType / dealType / action discriminator instead of one tool per variant. Every tool carries an MCP safety annotation — read-only tools set readOnlyHint, write tools set destructiveHint.

Bots

ToolAccessDescription
list_botsreadList bots by type (dca, combo, grid) with filters and field selection
get_botreadGet a single bot by id and type
create_botwriteCreate a bot (dca, combo, or grid)
update_botwriteUpdate bot settings
clone_botwriteClone a bot with optional overrides
manage_botwriteLifecycle action: start, stop, archive, restore, changePairs

Deals

ToolAccessDescription
list_dealsreadList deals by type (dca, combo, terminal) with filters
get_dealreadGet a single deal by id and type
create_dealwriteCreate a deal
update_dealwriteUpdate an active deal
manage_dealwriteDeal action: close, addFunds, reduceFunds

Backtest

ToolAccessDescription
run_backtestwriteRun a backtest: validate, estimate, async, or sync (request/requestSync submit a job — not read-only)
backtest_inforeadList backtest requests or get one by ID

Discovery, Account & Market

ToolAccessDescription
discoverreadSchema discovery for bot types and indicators
get_accountreadBalances, connected exchanges, supported exchanges, and global variables
get_screenerreadCryptocurrency screener with market metrics
manage_global_variablewriteGlobal variable action: create, update, delete

Field Selection

All GET endpoints support the fields parameter for efficient payloads:

  • Presets: minimal, standard (default), extended, full
  • Custom: comma-separated dot-notation fields (e.g. _id,uuid,settings.name,profit.total)

Using minimal reduces payload size by ~85%.

API Permissions

  • Read-only key: read tools only (list_*, get_*, discover, backtest_info, get_screener, list_presets)
  • Write key: all tools, including create_*, update_*, clone_bot, manage_bot, manage_deal, manage_global_variable, apply_preset, and run_backtest
  • Read-only directory connector (/mcp with GAINIUM_READONLY=true, served at mcp.gainium.io/read): exposes and allows only the 9 readOnlyHint tools — run_backtest and all write tools are excluded
  • Token audience binding (OAuth mode): when GAINIUM_MCP_PUBLIC_URL is set, the server treats <public-url><http-path> as its RFC 8707 resource. An access token whose introspected aud is a different resource is rejected — a token minted for mcp.gainium.io/read can't be replayed against mcp.gainium.io/mcp, and vice versa. Tokens with no aud (legacy grants) are still accepted.

Development

bash
# Clone and installgit clone https://github.com/gainium/gainium-mcp.gitcd gainium-mcpnpm install
# Buildnpm run build
# Run locally (for testing)export GAINIUM_API_KEY=your_keyexport GAINIUM_API_SECRET=your_secretnode dist/server.js
# Run in HTTP/SSE modeexport GAINIUM_MCP_TRANSPORT=httpexport GAINIUM_MCP_PORT=3000node dist/server.js

Architecture

gainium-mcp/├── src/│   ├── server.ts          # MCP server + tool definitions (stdio + HTTP/SSE transports)│   └── gainium-client.ts  # HMAC-authenticated HTTP client for Gainium API v2├── dist/                  # Compiled output (published to npm)├── package.json├── tsconfig.json└── README.md

License

MIT

來源:README.md,提交 989ca82

工具

0
該伺服器需要登入,因此 SourceWeft 無法在沒有帳號的情況下讀取其工具,也未收錄。已連接帳號所能看到的內容可能因帳號及其權限而異。

版本歷史

1
  1. v3.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 85%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分