Skip to main content
Glama
gargl791

MotiveWave MCP

by gargl791
README.md
# MotiveWave MCP — Setup Guide

Two independent pieces. Build and test each on its own before wiring them together.

## Part 1 — Java bridge study (`java-bridge/AIBridgeStudy.java`)

This runs *inside* MotiveWave as a study with no visible plot. It computes price,
VWAP, and four volume profiles, and serves them as JSON on `localhost:7878/snapshot`.

**Now built against your actual SDK Javadoc (as of the `sdk_api_doc_4_.zip` you
uploaded).** Confirmed and used directly:
- `Study.onTick(DataContext, Tick)` — fires per trade; this is what drives everything.
- `com.motivewave.platform.sdk.profile.VolumeProfile` — fed live via `onTick(Tick)`,
  same engine MotiveWave's own studies use, so POC/VAH/VAL/HVN/LVN math should
  match your chart once the settings below are aligned.

**You must still edit these to match your existing native studies exactly (see
the six-point parity checklist from our conversation):**
- `SESSION_ZONE`, `RTH_OPEN_HOUR/MIN`, `RTH_CLOSE_HOUR/MIN` — your actual session times
- `RANGE_TICKS` — row width in ticks; must match your native studies' bin size
- `VALUE_AREA_PCT` — must match your native studies' value area %
- `NODE_SENSITIVITY` — the sensitivity param to `getHVNs`/`getLVNs`; tune by
  comparing output against what's visibly marked as HVN/LVN on your chart

**Known simplification to fix before trusting `prior_week_rth`:** the current
code swaps in the most recently closed day's profile as a stand-in for the
week rather than accumulating volume across all RTH sessions in the week.
This is flagged with a TODO in `onTick()` — needs real weekly accumulation
before that specific number is reliable.

**Build:** add this file to your existing MotiveWave SDK Eclipse project (the
same one you're using for the Risk Calculator study), compile to a jar, and
load it the same way you load your other custom studies. Add it to a chart
with no visual settings needed.

**Validate before trusting it:** run it alongside your visible chart for a
session or two and diff its POC/VAH/VAL/HVN/LVN output against what's drawn.
Fetch `http://127.0.0.1:7878/snapshot` in a browser to see the raw JSON.

## Part 2 — MCP server (`mcp-server/`)

```bash
cd mcp-server
npm install
npm run build
```

Test it standalone (with MotiveWave + the bridge study running):
```bash
curl http://127.0.0.1:7878/snapshot   # confirm the Java side is serving data first
node dist/index.js                    # should print "MotiveWave MCP server running on stdio"
```

### Wiring into Claude Desktop

Add to your Claude Desktop MCP config (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "motivewave": {
      "command": "node",
      "args": ["/absolute/path/to/motivewave-mcp/mcp-server/dist/index.js"]
    }
  }
}
```

Restart Claude Desktop. You should see three tools available: `get_price_and_vwap`,
`get_volume_profile`, and `get_full_snapshot`.

## Suggested next steps, in order

1. Get the Java bridge compiling and serving a snapshot with just price + VWAP —
   confirm the JSON looks right via curl/browser before adding profile logic.
2. Wire the MCP server to that and confirm Claude can read price + VWAP correctly.
3. Add one profile (developing_session is easiest to validate live) and diff it
   against the visible chart.
4. Add the remaining three profiles once the first one's parity is confirmed.
5. Only then consider marked-level/annotation reading (Phase 2 from our earlier
   discussion) — keep it out of this build until the core snapshot is solid.