convez.ai
MCP ServerFinanceiroAvançado
SleepingTalent

OANDA V20 MCP Server

SleepingTalent/oanda-mcp-server

Integração OANDA para IA: dados, ordens, trades e posições em tempo real

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP que integra a API REST OANDA V20, permitindo que agentes de IA consultem dados de mercado, gerenciem ordens, monitorem trades e controlem posições. Construído com FastMCP e suporta transports stdio (Claude Desktop/Code) e HTTP (Docker).

Instalação

$npx convez-ai SleepingTalent/oanda-mcp-server

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
28%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
2

Casos de uso

  • Automação de trading através de agentes de IA
  • Consulta de dados de mercado e análise de instrumentos
  • Gestão automática de ordens, trades e posições

Veredito

MCP server robusto para operações financeiras automatizadas na OANDA. Abordagem técnica sólida com suporte a múltiplos transports, mas requer conhecimento de trading e credenciais OANDA válidas para uso produtivo.

README

A tradução para o português deste README ainda está na fila.

OANDA V20 MCP Server

An MCP (Model Context Protocol) server that wraps the OANDA V20 REST API, enabling AI agents to query market data, manage orders, monitor trades, and interact with OANDA accounts.

Built with FastMCP and httpx. Supports both stdio (for Claude Desktop / Claude Code) and HTTP transports (for Docker deployments).

Tools

Account

ToolDescription
get_account_summaryBalance, NAV, margin, open trade/position counts
get_account_detailsFull account detail including open trades, positions, and pending orders
get_tradeable_instrumentsList of instruments available on the account
get_account_changesAll changes since a given transaction ID

Instruments & Pricing

ToolDescription
get_candlesOHLCV candlestick data (granularity: S5–M, count, mid/bid/ask)
get_order_bookOrder book snapshot for an instrument
get_position_bookPosition book snapshot for an instrument
get_pricesLive bid/ask prices for one or more instruments
get_home_conversionsHome currency conversion factors

Orders

ToolDescription
create_market_orderMarket order with optional TP/SL/trailing stop
create_limit_orderLimit order (fills when market reaches price)
create_stop_orderStop order (breakout entry)
list_ordersList orders filtered by state or instrument
get_orderDetails of a specific order
cancel_orderCancel a pending order

Trades

ToolDescription
list_tradesList open trades, filtered by state or instrument
get_tradeDetails of a specific trade
close_tradeClose a trade fully or partially
update_trade_ordersUpdate TP/SL/trailing stop on an open trade

Positions

ToolDescription
list_positionsAll positions (open and closed)
list_open_positionsCurrently open positions only
get_positionPosition for a specific instrument
close_positionClose long and/or short side of a position

Transactions

ToolDescription
list_transactionsTransaction history, optionally filtered by time range or type
get_transactionDetails of a specific transaction
get_transaction_rangeAll transactions between two transaction IDs

Requirements

  • Python 3.13+
  • uv
  • An OANDA account with a personal access token
  • Docker (optional, for HTTP transport)

Configuration

Copy .env.example to .env and fill in your credentials:

cp .env.example .env
VariableRequiredDefaultDescription
OANDA_API_KEYYes—Personal access token from OANDA
OANDA_ACCOUNT_IDYes—Account ID (format: 001-001-XXXXXXXX-001)
OANDA_ENVIRONMENTNopracticepractice or live — live uses real money
MCP_PORTNo8000Port for HTTP transport

Usage

stdio (Claude Desktop / Claude Code)

Add to your claude_desktop_config.json or .mcp.json:

{
  "mcpServers": {
    "oanda": {
      "command": "uvx",
      "args": ["oanda-mcp"],
      "env": {
        "OANDA_API_KEY": "your-api-key",
        "OANDA_ACCOUNT_ID": "your-account-id",
        "OANDA_ENVIRONMENT": "practice"
      }
    }
  }
}

Or run directly:

uv run oanda-mcp

HTTP (Docker)

uv run task serve

The server starts on http://localhost:8000 with MCP_TRANSPORT=http.

Docker Hub

Pre-built images are published to Docker Hub on every merge to main. To use the published image instead of building locally, add the following to your .mcp.json:

{
  "mcpServers": {
    "oanda": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "OANDA_API_KEY",
        "-e", "OANDA_ACCOUNT_ID",
        "-e", "OANDA_ENVIRONMENT",
        "sleepingtalent/oanda-mcp-server:latest"
      ],
      "env": {
        "OANDA_API_KEY": "your-api-key",
        "OANDA_ACCOUNT_ID": "your-account-id",
        "OANDA_ENVIRONMENT": "practice"
      }
    }
  }
}

This runs the server in stdio mode inside a container — no local Python install required. Swap latest for a specific version tag (e.g. 0.1.1) to pin the image.

Development

# Install dependencies
uv sync

# Run unit and integration tests
uv run task test

# Run smoke tests
uv run task smoke-test

# Lint
uv run task lint

# Type check
uv run task typecheck

# Start the server (Docker)
uv run task serve

Project Structure

src/oanda_mcp/
  server.py         # FastMCP tool registration and entrypoint
  client.py         # OANDA V20 HTTP client (httpx)
  config.py         # Settings (pydantic-settings, reads .env)
  tools/            # One module per API domain
  models/           # Pydantic request/response models
tests/
  unit/
  integration/
  smoke/

Disclaimer

This server can place real orders on your OANDA account. Set OANDA_ENVIRONMENT=practice (the default) during development and testing. Always verify orders before execution when using a live account.

Ver o original no GitHub

Bom para

Relacionados