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 分