市场分析 MCP 服务器

DWLF MCP Server 是一款为 AI 代理和 MCP 兼容客户端打造的金融市场分析服务,提供 45+ 工具以将 K 线、技术指标、交易信号、策略回测、投资组合等市场噪声转化为可供 AI 推理的语义数据,适用于智能投研、自动交易与市场监控等场景。

  • by andywilliams
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 andywilliams/dwlf-mcp-server

使用说明

@dwlf/mcp-server

MCP server for the DWLF market analysis platform. 45+ tools that turn market noise into semantic data AI agents can reason about — candles, indicators, support/resistance, events, strategies, backtests, portfolios, trade journals, symbol activations, and more.

Works with Claude Desktop, Cursor, VS Code, and any MCP-compatible client.

🤖 AI Agents: To ensure strategies created via MCP are accessible via REST API, use the same API key for both. See Agent Onboarding Guide.

Quick Start

The fastest way to get running — no cloning needed:

npx -y @dwlf/mcp-server

Or install globally:

npm install -g @dwlf/mcp-server
dwlf-mcp-server

You'll need a DWLF_API_KEY environment variable. See Getting an API Key below.

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "dwlf": {
      "command": "npx",
      "args": ["-y", "@dwlf/mcp-server"],
      "env": {
        "DWLF_API_KEY": "dwlf_sk_your_key_here"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "dwlf": {
      "command": "npx",
      "args": ["-y", "@dwlf/mcp-server"],
      "env": {
        "DWLF_API_KEY": "dwlf_sk_your_key_here"
      }
    }
  }
}

VS Code

Add to .vscode/mcp.json:

{
  "mcp": {
    "servers": {
      "dwlf": {
        "command": "npx",
        "args": ["-y", "@dwlf/mcp-server"],
        "env": {
          "DWLF_API_KEY": "dwlf_sk_your_key_here"
        }
      }
    }
  }
}

Getting an API Key

Option 1: Web UI (Human Users)

  1. Sign up at dwlf.co.uk
  2. Go to Settings → API Keys
  3. Create a new key — it starts with dwlf_sk_
  4. Set it as DWLF_API_KEY in your MCP client config

Option 2: Programmatic Registration (AI Agents)

AI agents can register programmatically without browser access:

curl -X POST https://api.dwlf.co.uk/v2/agent/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "your-agent@example.com",
    "agentId": "my-trading-bot",
    "purpose": "Autonomous trading"
  }'

Returns an API key immediately. Use this key for both REST API and MCP to ensure account consistency.

📖 See Agent Onboarding Guide for complete setup instructions.

Configuration

Variable Required Default Description
DWLF_API_KEY Yes — Your DWLF API key (dwlf_sk_...)
DWLF_API_URL No https://api.dwlf.co.uk API base URL

Tools

Market Data

Get OHLCV candles, list symbols, support/resistance levels, and indicator events (crossovers, breakouts, divergences, candlestick patterns).

Technical Indicators

Daily SMA/EMA values (10–200), trendlines (daily, weekly, hourly), market regime, and indicator events: DSS, Bollinger, EMA/SMA crosses, swing structure, SMC, VWAP, cycle pivots.

Trade Signals

Active signals, signal history with P&L, and performance stats (win rate, avg return).

Strategies

Create, update, compile, and browse visual trading strategies. List public community strategies.

Backtesting

Run backtests (async), get results with Sharpe ratios, and aggregate performance summaries.

Portfolio & Trade Journal

Portfolio holdings with P&L, historical snapshots, trade logging, notes, and plan templates.

Symbol Activations

Activate symbols for event detection and strategy signal generation. Manage which symbols are actively monitored.

Custom Events

Create custom indicator-based triggers (e.g. "DSS exits oversold with bullish cross").

AI Summaries

Full account dashboard, single-symbol briefs, and strategy performance overviews — pre-aggregated for AI consumption.

Academy

Browse educational tracks, read lessons, and search academy content.

Example Prompts

"How's BTC looking right now?"
"Where is AAPL relative to its 50 and 200 day moving averages?"
"What active trade signals do we have?"
"Create a Golden Cross strategy using EMA 50/200"
"Backtest my strategy on NVDA over the last year"
"Log a long on ETH at 3,200 with stop at 3,050"
"Activate TSLA for my momentum strategy"

Development

git clone https://github.com/andywilliams/dwlf-mcp-server.git
cd dwlf-mcp-server
npm install
npm run build
DWLF_API_KEY=dwlf_sk_your_key npm run start

For hot reload during development:

DWLF_API_KEY=dwlf_sk_your_key npm run dev

Cookbook

For multi-step workflows, see docs/cookbook.md.

Open Source Libraries

Building a dashboard or visualization? Use the same libraries that power the DWLF platform:

Package Description Install
@dwlf/indicators Technical indicators (EMA, Bollinger, DSS, Fibonacci, S/R, Swing, Trendlines) — zero dependencies npm install @dwlf/indicators
@dwlf/charting React charting library with candlestick charts, 20+ annotations, pan/zoom npm install @dwlf/charting

Fetch candles via dwlf_get_market_data, compute indicators with @dwlf/indicators, render with @dwlf/charting.

License

MIT — DWLF / Andy Williams