Skip to content

System Maintenance

How to keep the TradingDesk stack healthy, track upstream changes, and handle breakages.


Upstream Tracking

The tradingview-mcp/ directory is a customised fork of tradesdontlie/tradingview-mcp. The upstream is tracked as a git remote.

Check for Updates

# Fetch latest upstream changes
git fetch upstream-mcp main

# See what changed since our version
git log upstream-mcp/main --oneline -20

# Diff a specific file against upstream
git diff HEAD:tradingview-mcp/src/server.js upstream-mcp/main:src/server.js

# Diff entire directory
git diff HEAD -- tradingview-mcp/ upstream-mcp/main -- .

Review What's New

Check these upstream resources regularly:

Resource What to Look For
Releases Version bumps, breaking changes
Issues MSIX/CDP breakages, new tool requests
Pull Requests Incoming fixes, new features
RESEARCH.md Internal API path changes

Apply an Upstream Update

# Option 1: Cherry-pick a specific commit
git fetch upstream-mcp main
git cherry-pick <commit-hash> --no-commit
# Resolve conflicts, test, then commit

# Option 2: Manually compare and port changes
git diff upstream-mcp/main~5..upstream-mcp/main -- src/core/
# Review the diff, apply relevant changes manually

Local Modifications to Track

Files we've customised beyond upstream:

File What Changed Why
scripts/launch_tv_debug.bat Added MSIX COM API detection + delegation MSIX v3.0.0 blocks CDP
scripts/launch_msix_debug.ps1 New file — COM API launcher Not in upstream yet
src/core/index.js Added tab and stream exports Missing from upstream
package.json Version synced to 2.0.0 Was mismatched
tests/e2e.test.js Updated tool count comment Was stale at 70

Known Fragile Dependencies

These are the things most likely to break and how to detect/fix them.

1. TradingView Internal APIs

Risk: HIGH — can break on any TradingView update Detection: Run tv_discover or tv_health_check after any TradingView update Symptoms: Tools return empty data, "Cannot read property" errors, cdp_connected: false

Key internal paths (from connection.js):

window.TradingViewApi._activeChartWidgetWV
window.TradingViewApi._chartWidgetCollection
window.TradingViewApi._replayApi

Fix procedure: 1. Run tv discover to see which paths are alive 2. Check upstream issues for reports of the same breakage 3. If a path changed, update connection.js KNOWN_PATHS 4. If Pine graphics broke, check the _graphics._primitivesCollection chain in data.js

2. MSIX Package Identity

Risk: MEDIUM — changes when TradingView updates their Store package Detection: launch_msix_debug.ps1 fails with "Package not found" Current AUMID: TradingView.Desktop_n534cwy3pjxzj!TradingView.Desktop

Fix procedure: 1. The PS1 script auto-detects AUMID via Get-AppxPackage — no hardcoded ID 2. If Get-AppxPackage -Name '*TradingView*' returns nothing, the package name changed 3. Check Get-AppxPackage | Where Name -match 'Trading' for the new name

3. Let's Encrypt Certificates

Risk: LOW — Caddy auto-renews Detection: Browser shows certificate warning on fatbot.ai Symptoms: HTTPS errors, Caddy logs show ACME failures

Fix procedure: 1. Check docker logs fatbot-caddy --tail 20 for ACME errors 2. Verify DNS still points to correct IP: nslookup fatbot.ai 8.8.8.8 3. Check public IP hasn't changed: curl -s https://api.ipify.org 4. If IP changed, update DNS A records and restart Caddy with clean volumes:

docker compose down
docker volume rm tradingdesk_caddy_data tradingdesk_caddy_config
docker compose up -d

4. Chrome/Electron Version

Risk: LOW — CDP protocol is stable Detection: CDP connects but tools fail Current: Chrome/140.0.7339.133 (Electron 38.2.2)

Fix procedure: Check curl -s http://localhost:9222/json/version for the browser version. If CDP protocol version changed, check upstream for compatibility updates.

5. Docker Base Images

Risk: LOW — Alpine images are stable Detection: Container fails to start after docker compose pull

Fix procedure: Pin to specific versions if needed:

image: node:22-alpine  # consider pinning: node:22.x-alpine
image: caddy:alpine    # consider pinning: caddy:2.x-alpine


Health Checks

Quick System Check

# All containers running?
docker ps --format "table {{.Names}}\t{{.Status}}"

# Dashboard responding?
curl -s -o /dev/null -w "%{http_code}" https://fatbot.ai

# Docs responding?
curl -s -o /dev/null -w "%{http_code}" https://docs.fatbot.ai

# Accounting healthy?
docker exec fatbot-accounting wget -qO- http://localhost:3100/api/health

# CDP connected?
curl -s http://localhost:9222/json/version

# DNS still correct?
nslookup fatbot.ai 8.8.8.8

After a TradingView Update

  1. Kill and relaunch: scripts\launch_tv_debug.bat
  2. Verify CDP: curl -s http://localhost:9222/json/version
  3. Test connection: tv status (via CLI)
  4. Test data: tv ohlcv --summary
  5. Test Pine: data_get_pine_lines on a chart with indicators
  6. If anything fails, check upstream issues

After a System Reboot

# Start Docker containers
docker compose up -d

# Wait for health checks, then verify
docker ps --format "table {{.Names}}\t{{.Status}}"

# Launch TradingView
scripts\launch_tv_debug.bat

Version Log

Track significant changes to avoid confusion:

Date Component Change
2026-04-20 Dashboard server.js Added path traversal protection
2026-04-20 Accounting API Added input validation, try-catch, DB indexes
2026-04-20 Docker Compose Added health checks, fixed accounting service
2026-04-20 MSIX CDP COM API launcher (launch_msix_debug.ps1) confirmed working
2026-04-20 Infrastructure Caddy HTTPS live on fatbot.ai, docs.fatbot.ai
2026-04-20 Git Initialized repo, upstream-mcp remote added
2026-04-12 TradingView Updated to v3.0.0.7652 MSIX (broke CDP, now fixed)

Update Checklist

Use this when performing maintenance:

  • [ ] git fetch upstream-mcp main — check for new commits
  • [ ] git log upstream-mcp/main --oneline -10 — review what's new
  • [ ] Check upstream issues for breakage reports
  • [ ] docker compose pull — update base images
  • [ ] docker compose up -d --build — rebuild and restart
  • [ ] Verify all health checks pass (see Quick System Check above)
  • [ ] curl -s https://api.ipify.org — confirm public IP unchanged
  • [ ] Test CDP connection if TradingView was updated
  • [ ] Update Version Log with any changes made