# Tradestack Mcp

> Market Context Protocol for TradingView and every major trading platform. Connect. Query. Analyze. Trade Smarter.

- **Type:** MCP server
- **Install:** `agentstack add mcp-vonzelle-vzt-tradestack-mcp`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [vonzelle-vzt](https://agentstack.voostack.com/s/vonzelle-vzt)
- **Installs:** 0
- **Category:** [Finance & Payments](https://agentstack.voostack.com/c/finance-and-payments)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [vonzelle-vzt](https://github.com/vonzelle-vzt)
- **Source:** https://github.com/vonzelle-vzt/tradestack-mcp

## Install

```sh
agentstack add mcp-vonzelle-vzt-tradestack-mcp
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# TradeStack MCP

**Market Context Protocol for TradingView and every major trading platform.**
*Connect. Query. Analyze. Trade Smarter.*

[](LICENSE)
[](https://nodejs.org/)
[](https://modelcontextprotocol.io)
[](https://github.com/vonzelle-vzt/tradestack-mcp/releases)
[]()
[]()

---

## Why TradeStack

Every other TradingView MCP picks two of {real-time, structured data, hostable, ToS-clean, paid-feature parity, trade execution} and abandons the rest. **TradeStack is the union.** One MCP, one tool surface, every platform.

| | TradeStack | tradesdontlie (CDP) | atilaahmettaner (scrape) | fiale-plus (screener) | ertugrul59 (image) |
|---|:---:|:---:|:---:|:---:|:---:|
| Hostable / remote | ✅ | ❌ | ✅ | ✅ | ✅ |
| Multi-tenant + OAuth | ✅ | ❌ | ❌ | ❌ | ❌ |
| Persistent state (watchlists/journal) | ✅ | ❌ | ❌ | ❌ | ❌ |
| Webhook ingress (TV alerts → MCP) | ✅ | ❌ | ❌ | ❌ | ❌ |
| TV public scanner API | ✅ | ❌ | partial | ✅ | ❌ |
| Real Pine compiler (`pine-facade`) | ✅ | partial | ❌ | ❌ | ❌ |
| Chart image + structured in one call | ✅ | ❌ | ❌ | ❌ | image only |
| Composite & chained alerts | ✅ | ❌ | ❌ | ❌ | ❌ |
| Risk sizing (Kelly / vol-target / VaR) | ✅ | ❌ | ❌ | ❌ | ❌ |
| Lifecycle gates (replay → paper → live) | ✅ | ❌ | ❌ | ❌ | ❌ |
| Plugin SDK (codegen / broker / scanner) | ✅ | ❌ | ❌ | ❌ | ❌ |
| Multi-platform (TV + TradeLocker + NT8 + MT5 + cTrader) | ✅ | TV only | TV only | TV only | TV only |

## Features

| ⚡ **Fast** | 🛡️ **Reliable** | 📊 **Powerful** | 🧩 **Extensible** | 🧑‍💻 **Developer First** |
|---|---|---|---|---|
| High-performance market data access with cache + rate limiter | Built on official `@modelcontextprotocol/sdk`, typed everywhere | Deep market data, screener, Pine, charts, alerts, risk | Plugin SDK for codegen, broker, scanner, data feed | Clean TypeScript API, MIT-licensed, no vendor lock-in |

## Quick start

### Run with Claude Desktop

```jsonc
// ~/Library/Application Support/Claude/claude_desktop_config.json
// (or %APPDATA%\Claude\claude_desktop_config.json on Windows)
{
  "mcpServers": {
    "tradestack": {
      "command": "npx",
      "args": ["-y", "tradestack-mcp"]
    }
  }
}
```

### Run from source

```bash
git clone https://github.com/vonzelle-vzt/tradestack-mcp.git
cd tradestack-mcp
npm install
npm run build
npm start                              # stdio (default)
MCP_TRANSPORT=http MCP_HTTP_PORT=3737 npm start   # remote / hosted
```

### Hosted HTTP usage

```bash
# health probe
curl http://localhost:3737/healthz
# → {"ok":true,"service":"tradestack-mcp","version":"0.2.0"}

# MCP initialize (Streamable HTTP w/ SSE)
curl -i -X POST http://localhost:3737/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Authorization: Bearer my-user-id" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'
```

The `Authorization: Bearer ` (or `X-TradeStack-User`) header scopes all stateful tools (watchlists, webhook tokens) per user.

### Optional persistence (Supabase)

Set `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY` and apply `supabase/schema.sql`. Watchlists and webhook tokens then survive restarts and span MCP clients.

## Tool surface (32 tools)

Every read tool is **ToS-clean** — TV's own public endpoints or pure local math. Write tools (`order_route`, broker calls) require explicit broker credentials.

### Market data (5)
| Tool | Purpose |
|---|---|
| `screener_query` | TV public scanner — 180+ fields, 18 filter ops |
| `symbol_search` | Symbol lookup |
| `symbol_ohlcv` | Historical bars via Polygon / Alpaca plugin |
| `symbol_quote` | Latest bid/ask/last |
| `chart_snapshot` | TV PNG snapshot URL |

### Pine + codegen (4)
| Tool | Purpose |
|---|---|
| `pine_compile` | Validate against `pine-facade.tradingview.com` |
| `codegen_transpile` | Pine ↔ NT8/MT5/TradeLocker via CodegenPlugin |
| `codegen_validate` | Static check generated code |
| `codegen_list` | List registered codegen plugins |

### Watchlists & alerts (8)
| Tool | Purpose |
|---|---|
| `watchlist_get` / `_upsert` / `_add` / `_remove` / `_list` | Per-user persistent lists |
| `webhook_token_get` / `_rotate` | TV alert webhook URL secret |
| `alerts_recent` | Recent inbound alerts |

### Composite alerts (4)
| Tool | Purpose |
|---|---|
| `alert_composite` | Multi-condition orchestration |
| `alert_composite_list` / `_delete` / `_evaluate` | Manage and dry-run |

### Strategy lifecycle (4)
| Tool | Purpose |
|---|---|
| `lifecycle_start` / `_complete` / `_runs` | Track replay/paper/live runs |
| `lifecycle_promote` | Statistical gate check for next stage |

### Risk + portfolio (3)
| Tool | Purpose |
|---|---|
| `risk_position_size` | Fixed-fractional / Kelly / vol-target |
| `risk_portfolio_var` | Parametric VaR |
| `risk_correlation_matrix` | Pearson across return series |

### Brokers + execution (4)
| Tool | Purpose |
|---|---|
| `brokers_list` | List registered broker plugins |
| `order_route` | Submit order with sizing + pre-trade gates |
| `positions_list` | Open positions on a broker |
| `account_info` | Equity / cash / buying power |
| `alert_composite` | Multi-condition alerts orchestrated over single-condition TV alerts |
| `lifecycle_replay` / `lifecycle_paper` / `lifecycle_promote` | Strategy lifecycle with statistical gates |
| `register_plugin` | Internal registry for codegen / broker / scanner / data-feed plugins |

Full tool spec lives in [`docs/TOOLS.md`](docs/TOOLS.md). Roadmap in [`docs/ROADMAP.md`](docs/ROADMAP.md).

## Platform integration

TradeStack ships with first-class plugin contracts for the platforms that matter:

- **[TradingView](docs/platforms/tradingview.md)** — public scanner API, Pine facade compiler, chart snapshots
- **[TradeLocker](docs/platforms/tradelocker.md)** — REST + WebSocket (Streams + BrandSocket APIs), official Python client
- **[NinjaTrader 8](docs/platforms/ninjatrader.md)** — local ATI (DLL) and CrossTrade REST bridge
- **[MetaTrader 5](docs/platforms/metatrader5.md)** — MetaApi cloud or local gateway, FastAPI bridge patterns
- **[cTrader](docs/platforms/ctrader.md)** — Open API (Spotware), works with any cTrader-affiliated broker
- **[Data feeds](docs/platforms/data-feeds.md)** — Polygon, Databento, Alpaca

Each platform doc covers auth, endpoints, gotchas, and the exact plugin contract.

## Webhook ingress (the killer feature)

Paste **one URL** into any TradingView alert message and every fire streams into Claude's context:

```
{{ticker}}|{{strategy.order.action}}|{{close}}|{{interval}}
```

TradeStack receives, deduplicates, attaches symbol metadata, and exposes recent alerts via the `alerts_recent` tool or an SSE stream. Nobody else does this.

## Plugin SDK

```typescript
import { registerBroker, BrokerPlugin } from "tradestack-mcp/plugins";

const myBroker: BrokerPlugin = {
  name: "my-broker",
  async place_order(o) { /* ... */ },
  async cancel_order(id) { /* ... */ },
  async positions() { /* ... */ },
};

registerBroker(myBroker);
```

See [`docs/PLUGINS.md`](docs/PLUGINS.md) for `BrokerPlugin`, `CodegenPlugin`, `ScannerPlugin`, `DataFeedPlugin` contracts.

## Repo layout

```
src/
  server.ts              MCP server entrypoint (stdio + streamable HTTP)
  tools/                 individual tool implementations
  plugins/               plugin registry + typed contracts
  state/                 Supabase-backed persistence (optional)
  lib/                   http client, cache, logger, config
  webhook/               TradingView alert ingress
docs/
  TOOLS.md               full tool reference
  ROADMAP.md             what's next
  PLUGINS.md             plugin SDK reference
  platforms/             per-platform integration notes
supabase/
  schema.sql             persistent state schema (watchlists/journals/alerts)
examples/
  claude_desktop_config.json
```

## Contributing

Pull requests welcome. See [`CONTRIBUTING.md`](CONTRIBUTING.md). All code is MIT-licensed and signed with DCO sign-off (`git commit -s`).

## License

MIT © 2026 [VZT Tech Consulting](https://vzt-techconsulting.com). See [`LICENSE`](LICENSE).

## Acknowledgements

Inspired by — and built to subsume — the prior art:
[tradesdontlie/tradingview-mcp](https://github.com/tradesdontlie/tradingview-mcp),
[atilaahmettaner/tradingview-mcp](https://github.com/atilaahmettaner/tradingview-mcp),
[fiale-plus/tradingview-mcp-server](https://github.com/fiale-plus/tradingview-mcp-server),
[bidouilles/mcp-tradingview-server](https://github.com/bidouilles/mcp-tradingview-server),
[ertugrul59/tradingview-chart-mcp](https://github.com/ertugrul59/tradingview-chart-mcp),
[cklose2000/pinescript-mcp-server](https://github.com/cklose2000/pinescript-mcp-server).

---

Built by VZT. Not affiliated with TradingView, TradeLocker, NinjaTrader, MetaQuotes, or Spotware.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [vonzelle-vzt](https://github.com/vonzelle-vzt)
- **Source:** [vonzelle-vzt/tradestack-mcp](https://github.com/vonzelle-vzt/tradestack-mcp)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-vonzelle-vzt-tradestack-mcp
- Seller: https://agentstack.voostack.com/s/vonzelle-vzt
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
