Skip to content

Add browser console demo for cMCP#21

Merged
imran-siddique merged 1 commit into
mainfrom
feat/web-console
Jul 24, 2026
Merged

Add browser console demo for cMCP#21
imran-siddique merged 1 commit into
mainfrom
feat/web-console

Conversation

@imran-siddique

Copy link
Copy Markdown
Contributor

What

A browser-based version of the demos, for showing cMCP on a screen instead of a terminal. Lives in web-console/.

pip install cmcp-runtime
python web-console/run.py     # opens http://localhost:8000

Send write_file / read_file (Cedar permits) and list_dir (Cedar forbids) and watch the decisions live; close the session into a signed GatewayClaim; verify it offline with cmcp verify. Every value on the page comes from the real gateway.

How it works

run.py starts the shared MCP filesystem server (:9001), the cMCP gateway (:8443, CMCP_DEV_MODE=1), and a small stdlib web server (:8000). The browser talks only to the web server, which proxies to the gateway server-side — so the bearer token stays off the browser and there's no CORS to configure. It uses the same HTTP endpoints as the CLI demos (POST /mcp, GET /audit/export, POST /sessions/{id}/close) and the same action-dialect Cedar policy as demo-01.

Verified locally end to end: allowed call returns 200 and writes the file, list_dir returns 403 POLICY_DENY, close returns a signed claim (allowed 1 / denied 1), and cmcp verify reports partially_verified in software-only mode.

Note

The catalog here carries definition_hash and a schema-valid TLS fingerprint so it loads on the current cmcp-runtime catalog schema (the older demo catalogs predate that stricter validation — worth a follow-up sweep, not touched here).

🤖 Generated with Claude Code

A point-and-click version of the CLI demos for showing on a screen. Sends real
tool calls through the gateway, shows Cedar allow/deny live, closes the session
into a signed TRACE record, and runs cmcp verify offline. A small stdlib web
server serves the UI and proxies to the gateway so the browser never holds the
bearer token and there's no CORS to configure.

Reuses the shared filesystem MCP server and the same action-dialect Cedar policy
as demo-01. Catalog carries definition_hash and a schema-valid fingerprint so it
loads on current cmcp-runtime.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread web-console/webserver.py
return self._send(404, {"error": "not found"})

def _serve_static(self, rel):
target = (WEB / rel).resolve()
Comment thread web-console/webserver.py

def _serve_static(self, rel):
target = (WEB / rel).resolve()
if not str(target).startswith(str(WEB.resolve())) or not target.is_file():
Comment thread web-console/webserver.py
target = (WEB / rel).resolve()
if not str(target).startswith(str(WEB.resolve())) or not target.is_file():
return self._send(404, "not found", "text/plain")
self._send(200, target.read_bytes(), _CT.get(target.suffix, "application/octet-stream"))
@imran-siddique
imran-siddique merged commit bb78277 into main Jul 24, 2026
2 of 3 checks passed
@imran-siddique
imran-siddique deleted the feat/web-console branch July 24, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants