Repository navigation
Quickstart guide, MCP middleware SSE fix, and end-to-end token deploy log - #4
Merged
Merged
Conversation
Covers fresh-clone setup of gateway + MCP: prerequisites, venv, .env/.env.mcp config with bearer generation, local startup, optional public HTTPS exposure (DuckDNS + Let's Encrypt + nginx vhost), client configuration, and security notes. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The previous implementation used Starlette's BaseHTTPMiddleware for both auth and SSE-no-buffer logic, which is documented to break SSE streams (observed in logs as "TypeError: 'NoneType' object is not callable" on every /sse request, because BaseHTTPMiddleware tries to wrap a response that the SseServerTransport bypasses via request._send). It also enforced the Bearer on every request including POST /messages/. Some clients (notably the Anthropic-backed Claude mobile MCP client) only attach Authorization on the /sse handshake; subsequent /messages/ POSTs arrived without it, returning 401 — surfaced upstream as a content-length:0 403 with the "first call OK, then forbidden" pattern. Fix: - Replace AuthMiddleware + SseNoBufferMiddleware with a single pure-ASGI middleware AuthAndSseHeadersASGI. - Bearer is enforced only on GET /sse. POST /messages/?session_id=... is authorised by the unguessable session_id minted after a successful handshake (functionally a one-shot capability — same security model as bearer-on-handshake adopted by most SSE-based MCP gateways). - The /sse response gets X-Accel-Buffering: no, Cache-Control: no-cache, and Connection: keep-alive injected at http.response.start so reverse proxies don't buffer the first event frame. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Documents the full gateway-only flow used to deploy a MOON ExtensionStandard token contract and transfer 100 MOON to a test wallet, with verbatim request/response pairs (private signature material redacted) and lessons learned around Variant param shape (v_string vs V_STRING), fee consistency between Pack and Deploy/Execute, and the WaitForSmartTransaction publicKey field semantics. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent improvements bundled together:
fix(mcp) — pure-ASGI auth middleware, gate Bearer only on
GET /sse(
9747213). Replaces the StarletteBaseHTTPMiddleware-based authmiddleware which broke SSE streams with
TypeError: 'NoneType' object is not callableon every/sserequest, and which also rejected thePOST /messages/?session_id=…calls that mobile/web Claude clients sendwithout re-attaching
Authorization. The session-id minted bySseServerTransportafter a successful handshake is itself thecapability for
/messages/. The newAuthAndSseHeadersASGImiddlewareis pure-ASGI and also injects
X-Accel-Buffering: no/Cache-Control: no-cache/Connection: keep-aliveon/sse.docs(quickstart) —
QUICKSTART.md(7118328+e2ed732).Step-by-step English setup guide: prerequisites, virtualenv,
.env/.env.mcpconfig with bearer generation, local startup,optional public HTTPS exposure (DuckDNS + Let's Encrypt + nginx
vhost), client configuration, security notes.
docs(MOON_DEPLOY_LOG) —
MOON_DEPLOY_LOG.md(6cd3b26).End-to-end record of a token deploy + transfer performed entirely
through the public HTTP gateway (no MCP). Includes verbatim
request/response pairs (signatures redacted), full Java source of a
MOONtoken implementing everyExtensionStandardmethod(
buyTokensno longer a stub,payableconsuming CS to mint), andlessons learned (Variant param shape
v_stringvsV_STRING, feeconsistency between
PackandDeploy/Execute,WaitForSmartTransaction.publicKeysemantics).Test plan
/sse401 without bearer, 200 with bearer,POST /messages/?session_id=…202 without bearer.2T5dmjqYoDuJWiJsueq66qF83tguNZYpr6evYFtWDk2y, 100-MOONtransfer to
MooNRor8…ZSveDpPconfirmed by reading bothbalanceOfvalues back from contract state.QUICKSTART.mdfor env assumptions.