Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

broker/ — CEGM Python broker

The long-running broker. Auto-spawned by plugin/cegm.lua on Cheat Engine startup. Hosts an MCP Streamable HTTP server, a built-in browser dashboard, and a WebSocket event stream — all on http://127.0.0.1:27077 by default. Spawns the vendored miscusi-peek/cheatengine-mcp-bridge Python child as a stdio MCP server and proxies its tools through.

See docs/ARCHITECTURE.md and ADR-0004.

Stack

  • Python 3.12+
  • mcp 1.27+ (FastMCP merged in-tree)
  • starlette + uvicorn[standard] for HTTP + WebSocket
  • openai SDK with custom base_url for LLM (default DeepSeek)
  • anyio for async, pydantic v2 for models, psutil for parent-PID watching
  • ruff (format + lint), mypy --strict, pytest + pytest-asyncio
  • uv for env management and distribution (uv tool install cegm-broker)

Layout (Phase 1)

broker/
├── pyproject.toml           # PEP 621 metadata, all deps + dev deps, tool configs
├── .python-version          # 3.12
├── README.md
├── src/cegm_broker/
│   ├── __init__.py          # __version__
│   ├── __main__.py          # python -m cegm_broker -> cli.main()
│   ├── cli.py               # argparse: --port, --parent-pid, --log-level, --print-config
│   ├── config.py            # %LOCALAPPDATA%/CEGM/config.json loader (Pydantic)
│   ├── _logging.py          # JSONL logger to file + stderr
│   ├── server.py            # Starlette app, route mount
│   ├── mcp_proxy.py         # spawns miscusi-peek child, forwards tools/list + tools/call
│   ├── mcp_extras.py        # CEGM-namespaced @mcp.tool definitions
│   ├── llm.py               # openai SDK wrapper, tool-call routing for /api/chat
│   ├── event_bus.py         # asyncio fan-out to WebSocket subscribers
│   ├── ws.py                # WebSocket handler at /events
│   ├── api.py               # /api/chat, /api/config REST endpoints
│   ├── parent_watch.py      # exits broker when CE PID disappears
│   └── snapshots.py         # snapshot store under %LOCALAPPDATA%/CEGM/snapshots/
└── tests/
    ├── conftest.py
    ├── test_smoke.py        # imports work; CLI prints help
    ├── test_mcp_proxy.py    # spawn fake child, verify tool listing + call
    ├── test_event_bus.py
    └── test_extras_cegm.py  # cegm.preview_write/commit/cancel round-trip

Run (developer)

cd broker
uv sync               # creates .venv, installs deps + dev deps
uv run cegm-broker --help
uv run cegm-broker --port 27077 --log-level debug

Run (end-user, once published)

uv tool install cegm-broker     # one-time
# then CE plugin spawns it automatically; manual run is also fine:
cegm-broker --port 27077

Logging

Structured JSONL to %LOCALAPPDATA%\CEGM\logs\broker-YYYYMMDD.jsonl and mirrored to stderr. Stdout is reserved (kept clean in case we ever support MCP stdio transport). Activity events (tool calls, chat turns) are also appended to a session-specific file at %LOCALAPPDATA%\CEGM\activity\<session_id>.jsonl.

Status

Scaffold only — see docs/ROADMAP.md Phase 1.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cegm_broker-0.1.0a1.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cegm_broker-0.1.0a1-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

Details for the file cegm_broker-0.1.0a1.tar.gz.

File metadata

  • Download URL: cegm_broker-0.1.0a1.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cegm_broker-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 14e82297548cf1ecde6b7fdfc0bbe04675db9b21053db083658f483f5677a891
MD5 426900bbec12908bda017f8dd66d4dfd
BLAKE2b-256 2764d524472041657c6f22022f5e96b998142dbe43ddb5a7cf1f8fe4ae2d30b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cegm_broker-0.1.0a1.tar.gz:

Publisher: release.yml on dwgx/CEGM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cegm_broker-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: cegm_broker-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 42.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cegm_broker-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 695f62479f24cf0c2f385b19f49b85390c401cedb8885ab583d4abab26f07768
MD5 19d997ce37fb8ca642b5dedd281c81fc
BLAKE2b-256 02b2590da6f007eb23e233dc1259cf79f0d6d81cf4e6b39764a741ce7d4b7239

See more details on using hashes here.

Provenance

The following attestation bundles were made for cegm_broker-0.1.0a1-py3-none-any.whl:

Publisher: release.yml on dwgx/CEGM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0a1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page