Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Docs-driven MCP server for SafeTrade REST API with a generic client that reads OpenAPI specs, validates requests, signs private calls, and blocks dangerous operations like withdrawals by default.

README.md

safetrade-mcp

Docs-driven Model Context Protocol server for the SafeTrade REST API.

This MCP is intentionally not a one-tool-per-endpoint wrapper. It gives agents a small generic client that reads SafeTrade's OpenAPI docs, validates requests against those docs by default, signs private calls internally, and keeps API secrets out of prompts and command lines.

Tools

safetrade_openapi

Inspect the SafeTrade OpenAPI spec cached by the MCP.

Arguments:

  • path optional API path, such as /trade/public/tickers or /trade/account/members/me
  • method optional HTTP method when path is supplied

Use this first to discover paths, methods, query parameters, body schemas, and response shapes.

safetrade_request

Execute a generic SafeTrade REST request.

Arguments:

  • method: GET, POST, PUT, PATCH, or DELETE; default GET
  • path: relative SafeTrade API path starting with /
  • query: object of query parameters
  • body: JSON body for non-GET requests
  • auth: auto, none, or required; default auto
  • validate: validate method/path against OpenAPI before sending; default true
  • timeoutMs: request timeout; default 15000, max 60000
  • confirmDangerous: must be ALLOW_WITHDRAW for withdraw mutations when withdraws are enabled

Safety model

  • Credentials are read from environment variables or a local key file.
  • Credentials are never returned in tool output.
  • Key files must not be group/world readable. Mode 600 is required.
  • Withdraw mutation endpoints are blocked by default.
  • To allow withdraw mutations, both conditions are required:
  • environment variable SAFETRADE_ALLOW_WITHDRAW=true
  • request argument confirmDangerous: "ALLOW_WITHDRAW"

For normal agent use, create a SafeTrade API key without withdraw permission and IP-lock it at SafeTrade.

Secrets

Preferred key file:

{
  "apiKey": "...",
  "apiSecret": "..."
}

Default path:

~/.config/opencode/keys/safetrade.json

Permissions:

chmod 600 ~/.config/opencode/keys/safetrade.json

Environment variables are also supported:

SAFETRADE_API_KEY=...
SAFETRADE_API_SECRET=...

Install

bun install

Run

bun run index.ts

Self-test:

bun run index.ts --self-test

The self-test checks:

  • OpenAPI lookup works
  • live public /trade/public/tickers request returns HTTP 200
  • withdraw mutation guard blocks before request

If credentials are configured, MCP clients can also call private endpoints such as /trade/account/members/me through safetrade_request.

OMP MCP config example

{
  "mcpServers": {
    "safetrade": {
      "type": "stdio",
      "command": "/home/cachybtw/.bun/bin/bun",
      "args": [
        "run",
        "/home/cachybtw/.config/opencode/mcp/safetrade-mcp/index.ts"
      ],
      "env": {
        "PATH": "/home/cachybtw/.local/bin:/home/cachybtw/.bun/bin:/usr/local/bin:/usr/bin:/bin",
        "SAFETRADE_KEYS_FILE": "/home/cachybtw/.config/opencode/keys/safetrade.json"
      },
      "enabled": true
    }
  }
}

Auth details

The signing implementation follows SafeTrade's official example client:

  • header X-Auth-Apikey: API key
  • header X-Auth-Nonce: millisecond timestamp
  • header X-Auth-Signature: HMAC_SHA256(apiSecret, nonce + apiKey) as lowercase hex

License

MIT

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Files & Docs servers.