๐Ÿš€ Bitkub MCP Server

CodeQL Go Version License Discord

Model Context Protocol server for Bitkub Cryptocurrency Exchange API

เน€เธŠเธทเนˆเธญเธกเธ•เนˆเธญ Claude Desktop เธเธฑเธš Bitkub Exchange เธœเนˆเธฒเธ™ MCP Protocol

logo

Features โ€ข Installation โ€ข API Tools โ€ข Configuration โ€ข Community


โœจ Features

๐ŸŽฏ Core Features

  • โœ… MCP Server - Built with mcp-go
  • ๐ŸŒ HTTP/SSE - Real-time communication
  • ๐Ÿ” Secure - HMAC SHA256 signature
  • ๐Ÿ’ฐ Wallet - View balances & transactions

๐Ÿš€ Developer Experience

  • ๐Ÿ’Ž Go-Bitkub SDK - Full API v3 support
  • ๐Ÿง  Integration - with Claude Desktop
  • ๐Ÿ“Š Market Data - Real-time ticker & depth
  • ๐Ÿ“– Order - Track open orders

๐Ÿ”ง Installation

Fastest path: install the server โ†’ register it as an MCP server in Claude Code / Codex โ†’ install the bitkub-trade playbook plugin. Steps 3โ€“5 are the important part.

1๏ธโƒฃ Install the MCP server

go install github.com/dvgamerr-app/gokub-mcp@latest

This installs gokub-mcp to $(go env GOPATH)/bin by default.

Windows default path:

# PowerShell
Write-Output "$env:USERPROFILE\go\bin\gokub-mcp.exe"
:: cmd.exe
echo %USERPROFILE%\go\bin\gokub-mcp.exe
# NuShell
$env.USERPROFILE | path join go bin gokub-mcp.exe
# macOS/Linux default
$(go env GOPATH)/bin/gokub-mcp

For local development from a clone:

git clone https://github.com/dvgamerr-app/gokub-mcp.git
cd gokub-mcp
go install .

Prefer containers? Use ๐Ÿณ Docker (HTTP/SSE mode).

2๏ธโƒฃ Credentials

The server reads BTK_APIKEY / BTK_SECRET from its environment โ€” pass them when you register the server (steps 3โ€“4), so no .env file is required. For a plain local go run main.go, a .env in the repo root still works:

BTK_APIKEY=your_api_key
BTK_SECRET=your_secret_key

3๏ธโƒฃ Register the MCP server in Claude Code

The current way is the claude mcp add CLI (replaces hand-editing JSON). Pass the env inline with -e:

claude mcp add bitkub \
  -e BTK_APIKEY=your_api_key \
  -e BTK_SECRET=your_secret_key \
  -- "$(go env GOPATH)/bin/gokub-mcp"

Windows:

# PowerShell
claude mcp add bitkub `
  -e BTK_APIKEY=your_api_key `
  -e BTK_SECRET=your_secret_key `
  -- "$env:USERPROFILE\go\bin\gokub-mcp.exe"
:: cmd.exe
claude mcp add bitkub -e BTK_APIKEY=your_api_key -e BTK_SECRET=your_secret_key -- "%USERPROFILE%\go\bin\gokub-mcp.exe"
# NuShell
let gokub = ($env.USERPROFILE | path join go bin gokub-mcp.exe)
claude mcp add bitkub -e BTK_APIKEY=your_api_key -e BTK_SECRET=your_secret_key -- $gokub
  • Add -s user to make it global across all projects (default scope is project-local .mcp.json).
  • It runs over stdio by default โ€” no extra flags. Verify with /mcp in a session.

4๏ธโƒฃ Register the MCP server in Codex

codex mcp add gokub \
  --env BTK_APIKEY=your_api_key \
  --env BTK_SECRET=your_secret_key \
  -- "$(go env GOPATH)/bin/gokub-mcp"

Windows:

# PowerShell
codex mcp add gokub `
  --env BTK_APIKEY=your_api_key `
  --env BTK_SECRET=your_secret_key `
  -- "$env:USERPROFILE\go\bin\gokub-mcp.exe"
:: cmd.exe
codex mcp add gokub ^
  --env BTK_APIKEY=your_api_key ^
  --env BTK_SECRET=your_secret_key ^
  -- "%USERPROFILE%\go\bin\gokub-mcp.exe"
# NuShell
let gokub = ($env.USERPROFILE | path join go bin gokub-mcp.exe)
codex mcp add gokub --env BTK_APIKEY=your_api_key --env BTK_SECRET=your_secret_key -- $gokub

โ€ฆor edit ~/.codex/config.toml directly:

[mcp_servers.gokub]
command = "/absolute/path/to/gokub-mcp"
args = []

[mcp_servers.gokub.env]
BTK_APIKEY = "your_api_key"
BTK_SECRET = "your_secret_key"

Verify with /mcp inside Codex.

5๏ธโƒฃ Install the trading playbook plugin (skill)

The tools are the hands; the bitkub-trade plugin is the brain โ€” the strategy playbook + guardrails. The repo doubles as a plugin marketplace for both clients:

# Claude Code
/plugin marketplace add dvgamerr-app/gokub-mcp
/plugin install bitkub-trade@gokub-mcp

# Codex
codex plugin marketplace add dvgamerr-app/gokub-mcp
codex plugin add bitkub-trade@gokub-mcp

See plugins/bitkub-trade for details.

๐Ÿณ Docker

Runs the server in HTTP/SSE mode (good for a shared/remote server; for a local client that spawns the binary over stdio, use the native build above):

docker build -t gokub-mcp .
docker run --rm -p 8080:8080 \
  -e BTK_APIKEY=your_api_key \
  -e BTK_SECRET=your_secret_key \
  gokub-mcp

Then point an SSE-capable client at http://localhost:8080/sse. Override the port with -e PORT=9000 -p 9000:9000.

The build fetches Go deps from the module proxy (needs internet). For an offline / hermetic build, run go mod vendor first and build with -mod=vendor.

๐ŸŽฎ Usage

HTTP/SSE Server Mode

# Default port 3000
go run main.go

# Custom port
PORT=9000 go run main.go

Default port is 3000 (override with PORT). Docker image defaults to 8080.

Endpoint Purpose Method
http://localhost:3000/sse SSE Connection GET
http://localhost:3000/msg Send Message POST

๐Ÿ› ๏ธ Available Tools

39 tools covering the full long-only swing-trading workflow (screen โ†’ analyze โ†’ size โ†’ place โ†’ manage โ†’ log).

get_wallet_balance ยท get_ticker ยท get_market_depth ยท get_my_open_orders ยท get_symbols ยท get_symbol_rules ยท get_fee_schedule

calculate_spread ยท calculate_liquidity_depth ยท get_market_screener ยท get_historical_candles ยท extract_close_prices

calculate_ema ยท calculate_roc ยท calculate_atr ยท calculate_rsi ยท check_market_regime ยท calculate_capm

detect_breakout_signal ยท detect_pullback_signal ยท calculate_relative_strength_rank

calculate_position_size ยท validate_trade_setup ยท round_to_exchange_rules

place_limit_order ยท place_stop_limit_order ยท cancel_order ยท get_order_status

check_trade_pnl ยท calculate_trailing_stop ยท check_exit_signals ยท client_side_stop_worker (Bitkub has no native stop/OCO โ€” client-side trigger)

log_trade_entry ยท log_trade_exit ยท calculate_expectancy ยท get_trade_history (flat-file journal trades.json, override with TRADES_FILE)

get_market_overview ยท simulate_trade ยท pnl_with_fees

๐Ÿง  Trading Playbook (Plugin / Skill)

The tools are the hands; the bitkub-trade plugin is the brain โ€” a playbook skill that encodes the strategy (screen โ†’ regime โ†’ relative-strength โ†’ ATR โ†’ signal โ†’ size โ†’ validate gate โ†’ round โ†’ place โ†’ manage โ†’ log) and the hard guardrails (โ‰ค2% risk/trade, long-only, no entry unless can_trade=true, client-side stop, TP โ‰ฅ2R).

โ†’ Install it in step 5 of Installation. Details: plugins/bitkub-trade.

โš™๏ธ Configuration

๐Ÿ” Environment variables

Variable Required Purpose
BTK_APIKEY for trading/wallet Bitkub API key
BTK_SECRET for trading/wallet Bitkub API secret
PORT no (default 3000) HTTP/SSE port (-serv mode)
TRADES_FILE no (default trades.json) trade-journal file path

Pass keys when you register the MCP server (see Installation steps 3โ€“4) โ€” that's preferred over a committed .env. Public market-data tools work without keys; wallet/order tools need them.

โš ๏ธ Keep secrets in env vars / your client config, never commit .env (it's gitignored).

If you run the HTTP server (or the Docker image) and use the Claude Desktop app, point it at the SSE endpoint:

{
  "mcpServers": {
    "gokub": { "url": "http://localhost:3000/sse", "transport": "sse" }
  }
}

Windows: %APPDATA%\Claude\claude_desktop_config.json ยท Mac: ~/Library/Application Support/Claude/claude_desktop_config.json

For Claude Code / Codex, prefer claude mcp add / codex mcp add (stdio) above.

๐Ÿ“ Project Structure

gokub-mcp/
โ”œโ”€โ”€ ๐Ÿ“„ main.go                      # MCP Server entry point (HTTP/SSE) + tool registration
โ”œโ”€โ”€ ๐Ÿณ Dockerfile                   # HTTP/SSE server image
โ”œโ”€โ”€ ๐Ÿ“‚ tools/                       # 39 MCP tools (+ unit tests)
โ”œโ”€โ”€ ๐Ÿ“‚ prompts/                     # trading_strategy, market_analysis prompts
โ”œโ”€โ”€ ๐Ÿ“‚ resources/                   # bitkub://symbols, bitkub://ticker/{symbol}
โ”œโ”€โ”€ ๐Ÿ“‚ utils/                       # Utility functions
โ”œโ”€โ”€ ๐Ÿ“‚ docs/                        # ASSIGNMENT.md (spec & build progress)
โ”œโ”€โ”€ ๐Ÿ“‚ plugins/bitkub-trade/        # bitkub-trade plugin (playbook skill)
โ”‚   โ”œโ”€โ”€ .claude-plugin/plugin.json  # Claude manifest
โ”‚   โ”œโ”€โ”€ .codex-plugin/plugin.json   # Codex manifest
โ”‚   โ””โ”€โ”€ skills/playbook/SKILL.md    # shared trading playbook
โ”œโ”€โ”€ ๐Ÿ“‚ .claude-plugin/              # Claude plugin marketplace
โ””โ”€โ”€ ๐Ÿ“‚ .agents/plugins/             # Codex plugin marketplace

๐Ÿ“Š API Rate Limits

Category Rate Limit Note
๐Ÿ“ˆ Market Data 100 req/sec Public endpoints
๐Ÿ’ฑ Trading Operations 150-200 req/sec Authenticated endpoints

๐Ÿ“š Bitkub API Docs เธชเธณเธซเธฃเธฑเธšเธ‚เน‰เธญเธกเธนเธฅเน€เธžเธดเนˆเธกเน€เธ•เธดเธก

๐Ÿš€ Roadmap

โœ… Completed

  • Bitkub API golang library + MCP Server (HTTP/SSE + stdio)
  • 39 trading tools โ€” foundation, indicators, entry signals, risk, orders, management, logging
  • Risk-based position sizing + pre-trade validate_trade_setup gate
  • Client-side stop worker (Bitkub has no native stop/OCO)
  • Trade journal + expectancy (flat-file trades.json)
  • bitkub-trade playbook plugin โ€” installable in Claude Code & Codex

๐Ÿšง In Progress / Next

  • git push the plugin so the marketplaces resolve from GitHub
  • Optional MCP prompts/resources for non-Claude/Codex clients
  • Backtesting over OHLCV history

๐ŸŽฏ Planned Features

  • Rebalancing / Grid strategy presets
  • Docker image + WebSocket real-time data

๐Ÿ“š References

๐Ÿ”ง MCP-Go Framework

๐Ÿ’Ž Go-Bitkub SDK

๐Ÿ“– Bitkub Official API Docs

๐Ÿค– Protocol MCP Spec

๐Ÿ‘ฅ Community

Discord

Join our community to discuss, get help, and share your trading strategies!

Made with โค๏ธ by dvgamerr-app

โญ Star this repo if you find it helpful!

Report Bug โ€ข Request Feature โ€ข Contribute