Metadata-Version: 2.5
Name: sqxtreme-mcp
Version: 0.8.0
Summary: Windows-first DX, Spanish localization, and content library layer over sq-mcp for StrategyQuant X
Project-URL: Homepage, https://github.com/herjarsa/sqxtreme-mcp
Author: SQXtreme contributors
License: MIT
Keywords: claude-code,mcp,opencode,spanish,strategyquant,windows
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: mcp[cli]<2,>=1.13.0
Requires-Dist: pydantic>=2.7.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest>=8.2.0; extra == 'dev'
Requires-Dist: ruff>=0.5.0; extra == 'dev'
Provides-Extra: full
Requires-Dist: sq-mcp<0.5,>=0.4.9; extra == 'full'
Description-Content-Type: text/markdown

# SQXtreme — StrategyQuant X MCP control layer

Wrapper/extension over [sq-mcp](https://github.com/DAVIDAROCA27/sqx-mcp) that adds Windows-first DX, Spanish localization, multi-client configs, and PyPI publish infra for AI agents (opencode, Claude Code, Cursor, VS Code).

**Repo**: https://github.com/herjarsa/sqxtreme-mcp

## What ships in v0.5.0

`sq-mcp` (DAVIDAROCA27) is the foundation: 482 runtime tools, MIT, 1571 tests. SQXtreme v0.5.0 adds (122 tests: 100 unit + 22 E2E live server, CI verde, OIDC publish):

1. **Windows installer** — `iwr install.ps1 | iex` (4 modos: CheckOnly/PyPI/FromSource/FromGit)
2. **Spanish localization** — 5 workflow prompts + 4 sub-agentes (`prompts/es/`) — es/
3. **Multi-client configs** — Claude Code, opencode, Cursor, VS Code (`examples/`)
4. **HTTP transport** — `SQXTREME_TRANSPORT=http` → `streamable-http` en `:8765` (vs nativo `:8082`)
5. **12 features 3 fases** — AlgoWizard auto-import, Builder desde frase, Live Watch, Streaming, Data auto-fix, Auto-curator, Ship MT5, Snapshot rollback, Ashare 119, Scheduled Runner, sqx-tools wrapper, Health Dashboard
6. **CI matrix** — Ubuntu + Windows × Python 3.10/3.11/3.12 — ruff + pytest
7. **PyPI OIDC** — Trusted Publishing sin token manual (`publish.yml`)
8. **E2E test suite** — `tests/e2e/` corre contra server vivo en :8765 (22 tests)
9. **26 audit fixes** — seguridad hardened (2026-08-30)

## Roadmap (post v0.5.0)

Live trading bridge refinements · Multi-workspace orchestrator · Research Agent Loop (moonshot E1).

## Install

```powershell
# One-liner (after PyPI publish)
iwr https://raw.githubusercontent.com/herjarsa/sqxtreme-mcp/main/install.ps1 -UseBasicParsing | iex

# Or from source
git clone https://github.com/herjarsa/sqxtreme-mcp.git
cd sqxtreme-mcp
.\scripts\install.ps1 -FromSource
```

## Native tools (always available, do not require sq-mcp[full])

These 3 tools are registered directly in `server.py` (always available, graceful-degradation if sq-mcp missing):

### `sq_algowizard_import`

Import a Java AlgoWizard snippet into the SQ X `user/extend/<Type>/` directory.

```json
{
  "src_path": "C:\\path\\to\\MyInd.java",
  "target_type": "indicators"  // optional; inferred from package SQ.<Type> if omitted
}
```

Returns: `{ok, dest_path, snippet_name, snippet_type, warnings}` or `{ok:false, error, error_type}` on validation failure.

Required in `.java` file: `package SQ.<Indicators|Signals|Conditions|...>;`.

### `sq_builder_from_phrase`

Parse a Spanish trading phrase and prepare a Builder plan (dry_run by default).

```json
{
  "phrase": "Builder para GBPUSD H1 2023.01.01 mean reversion max 5 condiciones",
  "dry_run": true   // default; if false, would patch project.cfx via cfx_clone + cfx_apply_patch
}
```

Returns: `{ok, dry_run, parsed: {symbol, timeframe, date_from, date_to, max_conditions, strategy_type, raw}, warnings, next_steps}`.

### `sq_live_watch`

Compute live position summary metrics from a list of position dicts.

```json
{
  "positions": [
    {"price": 50.0, "volume": 100, "side": "long"},
    {"price": 100.0, "volume": 50, "side": "short"}
  ]
}
```

Returns: `{net_exposure, gross, pnl_total, n_long, n_short, warnings}`. Validates: price must be finite numeric; volume > 0; side ∈ {"long","short"}.

## Delegated tools (from sq-mcp, 482+ tools)

When `sq-mcp[full]` extra is installed, the server delegates all sq-mcp tool groups (`pkgutil.iter_modules` + `import_module` + `register(mcp)`). Key examples:

| Tool | Purpose |
|---|---|
| `workspace_overview` | Count projects, databanks, .sqx files; mtime of last edits |
| `workspace_doctor` | Health check: engine + license + databanks + recent errors |
| `cfx_inspect` | Read .cfx: task count, ranking types, MM methods |
| `cfx_archetype` | Classify .cfx by task types (Builder, Retester, Optimizer, WalkForward, MonteCarlo) |
| `cfx_apply_patch` | Patch symbol/timeframe/dateFrom/dateTo across all task XMLs |
| `cfx_lint` | Validate .cfx structure |
| `builder_start` / `builder_stop` / `builder_watch_progress` | Launch and monitor a Builder run |
| `retest_strategy` | Retest a single strategy against OOS window |
| `workspace_insights` | Top 10 strategies by profit_to_dd, symbol/timeframe distribution |
| `data_health_freshness_gate` | Pre-trade check: data must be <max_age_minutes old (requires `last_bar_epoch` + `now_epoch`) |
| `health_check` | Engine status, license days remaining, fatal errors |

For full list: run server and call MCP `tools/list` (485+ entries).

## Spanish prompts (9)

| Prompt | Purpose |
|---|---|
| `sqxtreme-morning` | Diagnóstico matutino: engine health + workspace + top strategies + alerts |
| `sqxtreme-build-and-retest` | Builder desde frase → clonar template → parchear → lintear → start |
| `sqxtreme-promote` | Evaluar strategy contra gates de riesgo (conservative/balanced/aggressive) |
| `sqxtreme-post-mortem` | Diagnosticar job fallido + sugerir acciones |
| `sqxtreme-portfolio-rebalance` | Recomputar pesos + proponer rotación |
| `agente-constructor` | Sub-agent enfocado en fase de construcción |
| `agente-promotor` | Sub-agent enfocado en gates de promoción |
| `agente-diagnostico` | Sub-agent enfocado en diagnosticar fallos |
| `agente-cartera` | Sub-agent enfocado en portfolio y rebalanceo |

## What this gets you (honest scope)

Running an AI agent with SQXtreme + `[full]` extra: 9 Spanish MCP prompts + 482 sq-mcp runtime tools delegated + 3 native tools + cross-client install + 26 audit security fixes + 22 E2E tests against live server.

NOT included in v0.5.0: a live AI agent actually connected (manual client setup per `docs/CLIENTS.md`), E2E test with real SQ X engine (file-based tools work, engine-dependent tools require live engine).

## Security

- E2E-tested edge cases: phrase injection (`'; DROP TABLE`), NaN/Inf prices, empty inputs, traversal attempts
- sqxtreme-mcp delegates to upstream sq-mcp which has XXE defense + atomic writes + NaN validation
- 26 audit fixes from v0.4.3 release (security hardened)
- See `CHANGELOG.md` for full security fix list

## License

MIT.
