使用说明
门本地mcp
一个本地(stdio)MCP服务器,它公开了完整的 门 API v4到任何兼容MCP的客户端(Claude Desktop等)。
正在查找远程MCP服务器? 如果您需要基于HTTP/SSE的远程访问而不是本地stdio,请参阅 闸门/闸门mcp.
特性
- 330工具 涵盖现货、期货、交割、保证金、钱包、账户、期权、赚取、闪电掉期、统一、子账户、多抵押品贷款、P2P、TradFi、CrossEx、Alpha和返佣API
- 公共端点的零配置 --市场数据、股票行情、订单簿无需任何凭证即可工作
- 经过身份验证的端点 --交易、钱包和账户工具在以下情况下自动激活
GATE_API_KEY+GATE_API_SECRETenv变量已设置 - 测试网支持 --set
GATE_BASE_URL使用测试网端点 - 模块过滤 --通过仅加载所需的模块
GATE_MODULES或--modules;使用GATE_READONLY或--readonly仅限于只读工具
快速入门(克劳德桌面版)
仅限公共端点(无需身份验证)
{
"mcpServers": {
"gate": {
"command": "npx",
"args": ["-y", "gate-mcp"]
}
}
}
通过身份验证(交易、钱包、账户)
{
"mcpServers": {
"gate": {
"command": "npx",
"args": ["-y", "gate-mcp"],
"env": {
"GATE_API_KEY": "your-api-key",
"GATE_API_SECRET": "your-api-secret"
}
}
}
}
带凭据的测试网
{
"mcpServers": {
"gate": {
"command": "npx",
"args": ["-y", "gate-mcp"],
"env": {
"GATE_BASE_URL": "https://api-testnet.gateapi.io",
"GATE_API_KEY": "your-testnet-key",
"GATE_API_SECRET": "your-testnet-secret"
}
}
}
}
模块过滤
默认情况下,所有330个工具(17个模块)都已注册。要减少刀具数量(例如,光标警告超过80),请限制在特定模块:
CLI标志:
# Load only spot and futures tools (95 tools)
GATE_API_KEY=... npx gate-mcp --modules=spot,futures
# Load futures tools in read-only mode (36 tools)
npx gate-mcp --modules=futures --readonly
MCP配置(环境变量):
{
"mcpServers": {
"gate": {
"command": "npx",
"args": ["-y", "gate-mcp"],
"env": {
"GATE_MODULES": "spot,futures",
"GATE_READONLY": "true",
"GATE_API_KEY": "your-api-key",
"GATE_API_SECRET": "your-api-secret"
}
}
}
}
可用模块: spot, futures, delivery, margin, wallet, account, options, earn, flash_swap, unified, sub_account, multi_collateral_loan, p2p, tradfi, crossex, alpha, rebate
| 模块 | 总计 | 只读 |
|---|---|---|
| 地点 | 31 | 19 |
| 期货 | 64 | 36 |
| 交货时间 | 11 | 9 |
| 边距 | 17 | 14 |
| 钱包 | 22 | 18 |
| 帐户 | 10 | 6 |
| 选项 | 28 | 22 |
| 赚取 | 23 | 18 |
| flash_swap | 3 | 3 |
| 统一 | 16 | 12 |
| 子计数 | 11 | 5 |
| 多重抵押贷款 | 12 | 9 |
| p2p | 17 | 10 |
| 翻译 | 18 | 12 |
| crossex | 31 | 21 |
| 阿尔法 | 9 | 7 |
| 返利 | 7 | 7 |
环境变量
| 变量 | 必填 | 默认 | 描述 |
|---|---|---|---|
GATE_API_KEY |
没有经过身份验证的终结点的 | - | neneneba API密钥 |
GATE_API_SECRET |
没有经过身份验证的终结点的 | - | neneneba API机密 |
GATE_BASE_URL |
没有 | https://api.gateio.ws |
覆盖基本URL(例如用于测试网) |
GATE_MODULES |
否 | 所有模块 | 要加载的以逗号分隔的模块列表(例如。 spot,futures) |
GATE_READONLY |
没有 | false |
设置为 true 禁用所有写入(订购/传输)工具 |
可用工具
标记的工具 * 需要身份验证(GATE_API_KEY + GATE_API_SECRET).
现货(31种工具)
cex_spot_list_currencies, cex_spot_get_currency, cex_spot_list_currency_pairs, cex_spot_get_currency_pair, cex_spot_get_spot_tickers, cex_spot_get_spot_order_book, cex_spot_get_spot_trades, cex_spot_get_spot_candlesticks, cex_spot_get_spot_fee*, cex_spot_get_spot_accounts*, cex_spot_list_spot_account_book*, cex_spot_list_spot_orders*, cex_spot_create_spot_order*, cex_spot_get_spot_order*, cex_spot_cancel_spot_order*, cex_spot_amend_spot_order*, cex_spot_cancel_all_spot_orders*, cex_spot_create_spot_batch_orders*, cex_spot_cancel_spot_batch_orders*, cex_spot_get_spot_batch_fee*, cex_spot_list_spot_my_trades*, cex_spot_list_all_open_orders*, cex_spot_list_spot_price_triggered_orders*, cex_spot_create_spot_price_triggered_order*, cex_spot_get_spot_price_triggered_order*, cex_spot_cancel_spot_price_triggered_order*, cex_spot_cancel_spot_price_triggered_order_list*, cex_spot_countdown_cancel_all_spot*
期货(45种工具)——前缀缩写为 cex_fx_
cex_fx_list_fx_contracts, cex_fx_get_fx_contract, cex_fx_get_fx_order_book, cex_fx_get_fx_candlesticks, cex_fx_get_fx_tickers, cex_fx_get_fx_funding_rate, cex_fx_get_fx_trades, cex_fx_list_contract_stats, cex_fx_get_fx_premium_index, cex_fx_get_fx_accounts*, cex_fx_list_fx_account_book*, cex_fx_get_fx_fee*, cex_fx_list_fx_positions*, cex_fx_get_fx_position*, cex_fx_get_leverage*, cex_fx_update_fx_position_leverage*, cex_fx_update_fx_position_margin*, cex_fx_update_fx_position_risk_limit*, cex_fx_list_fx_orders*, cex_fx_create_fx_order*, cex_fx_get_fx_order*, cex_fx_cancel_fx_order*, cex_fx_cancel_all_fx_orders*, cex_fx_amend_fx_order*, cex_fx_create_fx_batch_orders*, cex_fx_cancel_fx_batch_orders*, cex_fx_get_fx_orders_with_time_range*, cex_fx_list_fx_my_trades*, cex_fx_get_fx_my_trades_timerange*, cex_fx_list_position_close*, cex_fx_list_fx_liq_orders*, cex_fx_list_price_triggered_orders*, cex_fx_create_fx_price_triggered_order*, cex_fx_get_fx_price_triggered_order*, cex_fx_cancel_fx_price_triggered_order*, cex_fx_cancel_fx_price_triggered_order_list*, cex_fx_countdown_cancel_all_fx*, cex_fx_list_fx_risk_limit_tiers*, cex_fx_set_fx_dual*, cex_fx_get_fx_dual_position*, cex_fx_update_fx_dual_position_margin*, cex_fx_update_fx_dual_position_leverage*, cex_fx_update_fx_dual_position_risk_limit*, cex_fx_update_fx_position_cross_mode*, cex_fx_update_fx_dual_position_cross_mode*
交付(11种工具)——前缀缩写为 cex_dc_
cex_dc_list_dc_contracts, cex_dc_get_dc_contract, cex_dc_list_dc_order_book, cex_dc_list_dc_candlesticks, cex_dc_list_dc_tickers, cex_dc_list_dc_accounts*, cex_dc_list_dc_positions*, cex_dc_list_dc_orders*, cex_dc_create_dc_order*, cex_dc_cancel_dc_order*, cex_dc_get_my_dc_trades*
保证金(17工具)
cex_margin_list_margin_accounts*, cex_margin_list_margin_account_book*, cex_margin_get_auto_repay_status*, cex_margin_set_auto_repay*, cex_margin_get_margin_transferable*, cex_margin_list_funding_accounts*, cex_margin_get_user_margin_tier*, cex_margin_set_user_market_leverage*, cex_margin_list_margin_user_account*, cex_margin_list_cross_margin_loans*, cex_margin_list_cross_margin_repayments*, cex_margin_list_uni_loans*, cex_margin_create_uni_loan*, cex_margin_list_uni_loan_records*, cex_margin_list_uni_loan_interest_records*, cex_margin_get_uni_borrowable*, cex_margin_get_margin_uni_estimate_rate*
钱包(22工具)
cex_wallet_list_currency_chains, cex_wallet_get_total_balance*, cex_wallet_list_withdrawals*, cex_wallet_list_deposits*, cex_wallet_get_deposit_address*, cex_wallet_create_transfer*, cex_wallet_list_sa_balances*, cex_wallet_get_wallet_fee*, cex_wallet_create_sa_transfer*, cex_wallet_create_sa_to_sa_transfer*, cex_wallet_get_transfer_order_status*, cex_wallet_list_withdraw_status*, cex_wallet_list_sa_transfers*, cex_wallet_list_sa_margin_balances*, cex_wallet_list_sa_fx_balances*, cex_wallet_list_sa_cross_margin_balances*, cex_wallet_list_saved_address*, cex_wallet_list_small_balance*, cex_wallet_convert_small_balance*, cex_wallet_list_small_balance_history*, cex_wallet_list_push_orders*, cex_wallet_get_low_cap_exchange_list*
账户(10个工具)
cex_account_get_account_detail*, cex_account_get_account_rate_limit*, cex_account_get_debit_fee*, cex_account_set_debit_fee*, cex_account_get_account_main_keys*, cex_account_list_stp_groups*, cex_account_create_stp_group*, cex_account_list_stp_group_users*, cex_account_add_stp_group_users*, cex_account_delete_stp_group_user*
选项(28个工具)
cex_options_list_options_underlyings, cex_options_list_options_expirations, cex_options_list_options_contracts, cex_options_get_options_contract, cex_options_list_options_order_book, cex_options_list_options_tickers, cex_options_list_options_underlying_tickers, cex_options_list_options_candlesticks, cex_options_list_options_underlying_candlesticks, cex_options_list_options_settlements, cex_options_get_options_settlement, cex_options_list_options_trades, cex_options_list_options_account*, cex_options_list_options_account_book*, cex_options_list_my_options_settlements*, cex_options_list_options_positions*, cex_options_get_options_position*, cex_options_list_options_position_close*, cex_options_list_options_orders*, cex_options_create_options_order*, cex_options_cancel_options_order*, cex_options_get_options_order*, cex_options_cancel_options_orders*, cex_options_countdown_cancel_all_options*, cex_options_get_options_mmp*, cex_options_set_options_mmp*, cex_options_reset_options_mmp*, cex_options_list_my_options_trades*
赚取(23工具)
cex_earn_list_dual_investment_plans, cex_earn_list_structured_products, cex_earn_find_coin, cex_earn_list_uni_currencies, cex_earn_get_uni_currency, cex_earn_list_uni_chart, cex_earn_list_uni_rate, cex_earn_list_dual_orders*, cex_earn_place_dual_order*, cex_earn_list_dual_balance*, cex_earn_list_structured_orders*, cex_earn_place_structured_order*, cex_earn_swap_staking_coin*, cex_earn_order_list*, cex_earn_award_list*, cex_earn_asset_list*, cex_earn_list_user_uni_lends*, cex_earn_create_uni_lend*, cex_earn_change_uni_lend*, cex_earn_list_uni_lend_records*, cex_earn_get_uni_interest*, cex_earn_list_uni_interest_records*, cex_earn_get_uni_interest_status*
Flash Swap(3个工具)——前缀缩写为 cex_fc_
cex_fc_list_fc_currency_pairs, cex_fc_list_fc_orders*, cex_fc_get_fc_order*
统一帐户(16个工具)
cex_unified_list_currency_discount_tiers, cex_unified_get_unified_accounts*, cex_unified_list_unified_currencies*, cex_unified_get_unified_mode*, cex_unified_set_unified_mode*, cex_unified_get_unified_risk_units*, cex_unified_get_unified_borrowable*, cex_unified_get_unified_transferable*, cex_unified_get_unified_estimate_rate*, cex_unified_list_unified_loans*, cex_unified_create_unified_loan*, cex_unified_list_unified_loan_records*, cex_unified_list_unified_loan_interest_records*, cex_unified_get_user_leverage_currency_setting*, cex_unified_set_user_leverage_currency_setting*, cex_unified_set_unified_collateral*
子账户(11个工具)——前缀缩写为 cex_sa_
cex_sa_list_sas*, cex_sa_create_sa*, cex_sa_get_sa*, cex_sa_lock_sa*, cex_sa_unlock_sa*, cex_sa_list_sa_keys*, cex_sa_get_sa_key*, cex_sa_create_sa_key*, cex_sa_update_sa_key*, cex_sa_get_sa_unified_mode*, cex_sa_delete_sa_key*
多重抵押贷款(12种工具)——前缀: cex_mcl_
cex_mcl_list_multi_collateral_orders*, cex_mcl_create_multi_collateral*, cex_mcl_get_multi_collateral_order_detail*, cex_mcl_list_multi_repay_records*, cex_mcl_repay_mcl*, cex_mcl_list_multi_collateral_records*, cex_mcl_operate_multi_collateral*, cex_mcl_list_user_currency_quota*, cex_mcl_list_multi_collateral_currencies*, cex_mcl_get_multi_collateral_ltv*, cex_mcl_get_multi_collateral_fix_rate*, cex_mcl_get_multi_collateral_current_rate*
P2P(17种工具)
cex_p2p_get_user_info*, cex_p2p_get_counterparty_user_info*, cex_p2p_get_myself_payment*, cex_p2p_get_pending_transactions*, cex_p2p_get_completed_transactions*, cex_p2p_get_transaction_details*, cex_p2p_confirm_payment*, cex_p2p_confirm_receipt*, cex_p2p_cancel_transaction*, cex_p2p_place_ad_order*, cex_p2p_update_ad_status*, cex_p2p_get_ad_detail*, cex_p2p_list_my_ads*, cex_p2p_list_ads*, cex_p2p_get_chat_messages*, cex_p2p_send_chat_message*, cex_p2p_upload_chat_file*
TradFi(18种工具)——前缀: cex_tradfi_
cex_tradfi_query_categories, cex_tradfi_query_symbols, cex_tradfi_query_symbol_detail, cex_tradfi_query_symbol_kline, cex_tradfi_query_symbol_ticker, cex_tradfi_query_mt5_account_info*, cex_tradfi_query_user_assets*, cex_tradfi_query_transaction*, cex_tradfi_create_transaction*, cex_tradfi_query_order_list*, cex_tradfi_create_tradfi_order*, cex_tradfi_update_order*, cex_tradfi_delete_order*, cex_tradfi_query_order_history_list*, cex_tradfi_query_position_list*, cex_tradfi_update_position*, cex_tradfi_close_position*, cex_tradfi_query_position_history_list*
CrossEx(31种工具)——前缀缩写为 cex_crx_
cex_crx_list_crx_rule_symbols, cex_crx_list_crx_rule_risk_limits, cex_crx_list_crx_transfer_coins, cex_crx_get_crx_fee, cex_crx_get_crx_interest_rate, cex_crx_list_crx_coin_discount_rate, cex_crx_list_crx_transfers*, cex_crx_create_crx_transfer*, cex_crx_list_crx_open_orders*, cex_crx_create_crx_order*, cex_crx_get_crx_order*, cex_crx_update_crx_order*, cex_crx_cancel_crx_order*, cex_crx_list_crx_history_orders*, cex_crx_list_crx_history_trades*, cex_crx_create_crx_convert_quote*, cex_crx_create_crx_convert_order*, cex_crx_get_crx_account*, cex_crx_update_crx_account*, cex_crx_list_crx_account_book*, cex_crx_list_crx_positions*, cex_crx_list_crx_margin_positions*, cex_crx_list_crx_adl_rank*, cex_crx_get_crx_positions_leverage*, cex_crx_update_crx_positions_leverage*, cex_crx_get_crx_margin_positions_leverage*, cex_crx_update_crx_margin_positions_leverage*, cex_crx_close_crx_position*, cex_crx_list_crx_history_positions*, cex_crx_list_crx_history_margin_positions*, cex_crx_list_crx_history_margin_interests*
Alpha(9个工具)
cex_alpha_list_alpha_currencies, cex_alpha_list_alpha_tickers, cex_alpha_list_alpha_tokens, cex_alpha_list_alpha_accounts*, cex_alpha_list_alpha_account_book*, cex_alpha_list_alpha_orders*, cex_alpha_get_alpha_order*, cex_alpha_quote_alpha_order*, cex_alpha_place_alpha_order*
返佣(7个工具)
cex_rebate_partner_transaction_history*, cex_rebate_partner_commissions_history*, cex_rebate_partner_sub_list*, cex_rebate_broker_commission_history*, cex_rebate_broker_transaction_history*, cex_rebate_user_info*, cex_rebate_user_sub_relation*
*需要身份验证(GATE_API_KEY + GATE_API_SECRET)
发展
# Install dependencies
npm install
# Build
npm run build
# Run locally
npm start
# Development mode (no build step)
npm run dev
局部烟雾测试
# List all tools
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | node dist/index.js
# Get BTC_USDT ticker (public, no auth)
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"cex_spot_get_spot_tickers","arguments":{"currency_pair":"BTC_USDT"}}}' | node dist/index.js
许可证
麻省理工学院