redline-mcp-server
v2.0.0
Published
MCP server for Redline — enforcement, violation detection, trade logging, and discipline scoring for AI trading agents. Runs over stdio (local clients) or Streamable HTTP (ChatGPT / remote connectors).
Maintainers
Readme
redline-mcp-server
MCP (Model Context Protocol) server for the Redline Trading OS. Exposes enforcement, violation detection, trade logging, discipline scoring, and session management as native MCP tools so any Claude-powered agent can call them without custom integration.
Installation
npm install -g redline-mcp-server
# or use npx without installing
npx redline-mcp-server --key rl_live_xxxxxConfiguration
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
| REDLINE_API_KEY | Yes (if not passed via --key) | — | Your Redline API key (rl_live_…). |
| REDLINE_API_BASE | No | https://tradeintelx.com | Override the API base URL. Use this to point the server at a staging or self-hosted environment. |
Staging / Custom Environments
REDLINE_API_BASE=https://staging.tradeintelx.com \
REDLINE_API_KEY=rl_live_xxxxx \
npx redline-mcp-serverOr with the --key flag:
REDLINE_API_BASE=https://staging.tradeintelx.com npx redline-mcp-server --key rl_live_xxxxxMCP Client Setup
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"redline": {
"command": "npx",
"args": ["redline-mcp-server", "--key", "rl_live_xxxxx"]
}
}
}For staging:
{
"mcpServers": {
"redline-staging": {
"command": "npx",
"args": ["redline-mcp-server", "--key", "rl_live_xxxxx"],
"env": {
"REDLINE_API_BASE": "https://staging.tradeintelx.com"
}
}
}
}Cursor / Other MCP Hosts
{
"mcpServers": {
"redline": {
"command": "node",
"args": ["/path/to/redline-mcp/index.js"],
"env": {
"REDLINE_API_KEY": "rl_live_xxxxx"
}
}
}
}Available Tools
| Tool | Description |
|---|---|
| check_enforcement_state | Account state, canTrade flag, discipline score, and active violations. Call before every trade. |
| get_discipline_score | Discipline score (0–100), band (elite/disciplined/developing/at-risk), 7-day trend, and 10 most recent violations. |
| get_analytics_summary | Performance analytics for a period (7d / 30d / 90d / 1y): win rate, profit factor, avg R:R, P&L, drawdown, top setups. |
| get_violation_risk | Stateless pre-trade violation check — returns clear, riskScore, and specific violations without writing data. |
| log_trade | Log a completed trade (triggers violation analysis and score update). |
| get_fingerprint | Trader DNA fingerprint: inferred style, top setups, session peaks, strengths, and leaks. Use to calibrate agent behaviour. |
| get_bot_config | Bot configuration and cumulative feedback summary (approval rate, decision counts). |
| push_bot_signal | Push a trade signal into the trader's Pending Signals Panel (1-hour TTL). |
| submit_bot_feedback | Record the trader's decision (approved / rejected / modified) on a signal. |
| start_session | Start a trading session with optional contract terms. |
| end_session | End a session and retrieve the P&L, win rate, and violation summary. |
Remote / HTTP mode (ChatGPT, OpenAI Responses API, remote connectors)
Local MCP clients (Claude Desktop, Cursor) spawn index.js over stdio.
Remote clients that can't spawn a process — notably ChatGPT — need an MCP
server reachable over HTTP. http-server.js provides that using the MCP
Streamable HTTP transport.
# run the HTTP server locally
REDLINE_API_KEY=rl_live_xxxxx npm run start:http # listens on :8080, MCP at /mcp| Var | Required | Default | Description |
|---|---|---|---|
| PORT | No | 8080 | Listen port (Railway injects this automatically). |
| REDLINE_API_KEY | No* | — | Fallback Redline key. *Required for clients that don't send their own bearer (e.g. ChatGPT without OAuth). |
| REDLINE_API_BASE | No | https://tradeintelx.com | API base URL. |
Auth resolution per request: an incoming Authorization: Bearer rl_live_…
header is forwarded as the Redline key (per-user, multi-tenant ready). If no
such header is present, the server falls back to REDLINE_API_KEY. (Phase 2:
exchange a ChatGPT OAuth token for the user's key in resolveApiKey().)
Deployed on Railway
- Project:
redline-mcp-server(jeffkhalifa's Projects) - Public URL:
https://redline-mcp-server-production.up.railway.app - MCP endpoint:
https://redline-mcp-server-production.up.railway.app/mcp
Redeploy after code changes:
cd redline-mcp && railway up --detachSet the fallback key (triggers a redeploy):
railway variables --set "REDLINE_API_KEY=rl_live_xxxxx"Add to ChatGPT
- ChatGPT → Settings → Connectors → Advanced → Developer mode (Plus/Pro).
- Create / Add custom connector →
- MCP server URL:
https://redline-mcp-server-production.up.railway.app/mcp - Authentication: None (phase 1 — uses the
REDLINE_API_KEYfallback).
- MCP server URL:
- Save. The 18 tools (incl.
search/fetchfor Deep Research) appear in chat.
⚠️ With auth = None and a fallback key set, anyone who learns the URL can call the connector as that account. Treat the URL as a secret until OAuth (phase 2) is added for real per-user authentication.
Requirements
- Node.js 18+ (uses native
fetch) - A valid Redline API key (
rl_live_…)
