Repository navigation
docs: add deed.page Streamable HTTP MCP publishing example - #119
Conversation
Adds an optional example, docs page and offline tests for publishing agent-written pages to deed.page over LightAgent's existing Streamable HTTP MCP transport. Contributed by the deed.page team (Avatar 8 LLC).
|
The original example and contributor commits are preserved in follow-up PR #122. It adds private no-clobber token storage, symlink/race and file-permission checks, per-connection token reuse, server-scoped credentials, a reserved tool namespace, and protection after refresh/partial discovery failures. Full offline suite: 391 passed, 1 opt-in backend test skipped; 26 focused example/security tests passed. No live publication or model API was invoked. Please review #122 together with SDK compatibility follow-up #121 before merging; no merge or release has been performed. |
|
The completed fixes have now been appended directly to this original contributor branch at 0957291, preserving the existing commits and attribution. The newly triggered CI run passed all 4 checks: https://github.com/wanxingai/LightAgent/actions/runs/40616543427 . Supplemental PR #122 has been closed as redundant. This original PR remains open and unmerged for your review; main has not been modified. |
Summary
example/deed_page_mcp.py, an optional example that lets an agent publish a page it wrote (HTML, or a few static files) and get back a public URL, using the existingtransport: "streamable-http"support againsthttps://deed.page/mcp. It adds no dependency and does no network work at import time.docs/deed_page_mcp.md(configuration, a--directconnection check that needs no model, security notes, and compatibility evidence) and a one-line README pointer next to the Tools Guide.tests/test_deed_page_mcp_example.py: offline tests with fakes, no network or credentials.Affiliation: this comes from the deed.page team (Avatar 8 LLC), which operates the service. Service docs: https://deed.page/docs. There is also an MIT-licensed agent skill for the same API: https://github.com/f-o-x11/deed-page-skill.
Two things in the example are about LightAgent behavior rather than the service, and may be useful for other remote MCP servers too:
setup_mcpregisters every tool a server lists. deed.page lists 26 (includingdelete_siteandrotate_token), sorestrict_new_tools()removes the MCP tools registered by that call exceptpublish_siteandget_site, using only the publicToolRegistrydicts and leaving local tools alone.DEEDPAGE_TOKEN, the first publish returns a one-time owner token in the tool result.protect_publish_token()wraps the registeredpublish_siteso the token is written to a 0600 file and replaced by"token_saved": truebefore the model sees it. With the header set, the service returns no token.Compatibility
agent.run("hello")behavior is unchanged, or the change is documented. (No library code changed.)stream=Truebehavior is unchanged, or the change is documented.Tests
python -m compileall -q LightAgent(alsoexample tests)PYTHONPATH=. python -m pytest -q tests/test_v065_core.py tests/test_v070_tracing.py tests/test_memory_policy.py— 57 passed (6 existingdatetime.utcnow()deprecation warnings on Python 3.12).Also: full suite
PYTHONPATH=. pytest -q373 passed, 1 skipped; the new test file 8 passed;ruff checkclean on the new files;git diff --checkclean. Environment:poetry install --with devfrom the lock file (mcp 1.12.4).Live-service validation, kept separate from the offline tests: against
https://deed.page/mcp,MCPClientManagerregistered the server's tools over Streamable HTTP; afterrestrict_new_tools()onlypublish_siteandget_sitewere left inopenai_function_schemas; the wrappedpublish_sitereturned a URL that served HTTP 200, with the token absent from the result and saved with mode 0600; a call with theAuthorizationheader returned no token;python example/deed_page_mcp.py --directpublished and served 200. All test pages were deleted afterwards and returned 404. The agent mode's model call was not part of this run.Notes
Security: the example reads the token from the environment or a local 0600 file and never embeds it. Published pages are public URLs, which the docs page says plainly. No migration impact. Happy to trim it (for example drop the agent mode and keep only the config and the token/tool helpers), or move it under
example/connectors/if that fits better.