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.

Metadata

Release files for cegm-broker 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cegm-broker 0.1.0a1
File Size Uploaded
cegm_broker-0.1.0a1.tar.gz 42.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cegm-broker 0.1.0a1
File Interpreter ABI Platform
cegm_broker-0.1.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 84.5 kB

Release files / cegm_broker-0.1.0a1.tar.gz

Download URL cegm_broker-0.1.0a1.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
14e82297548cf1ecde6b7fdfc0bbe04675db9b21053db083658f483f5677a891
BLAKE2b-256 checksum
How to use checksums
2764d524472041657c6f22022f5e96b998142dbe43ddb5a7cf1f8fe4ae2d30b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 4, 2026.

Transparency log

Release files / cegm_broker-0.1.0a1-py3-none-any.whl

Download URL cegm_broker-0.1.0a1-py3-none-any.whl
Size 42.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
695f62479f24cf0c2f385b19f49b85390c401cedb8885ab583d4abab26f07768
BLAKE2b-256 checksum
How to use checksums
02b2590da6f007eb23e233dc1259cf79f0d6d81cf4e6b39764a741ce7d4b7239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0a1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page