Skip to content

Feat/mcp python sdk#1

Open
bondarchukb wants to merge 10 commits intomasterfrom
feat/mcp-python-sdk
Open

Feat/mcp python sdk#1
bondarchukb wants to merge 10 commits intomasterfrom
feat/mcp-python-sdk

Conversation

@bondarchukb
Copy link
Copy Markdown
Collaborator

No description provided.

Bohdan Bondarchuk and others added 10 commits March 21, 2026 14:56
- agentflow Python package: types, exceptions, voucher signing, AgentflowClient
- Voucher CBOR encoding matches TypeScript implementation byte-for-byte
- Simulation mode for demo without live ICP canister
- FastMCP server exposing 7 tools: setup_identity, call_canister,
  request_session_intent, open_session, session_call, close_session,
  get_session_status, approve_icrc2 (stub)
- end-to-end demo script (examples/demo.py)
- pip install -e python/ then agentflow-mcp to run

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…content tool

- Rename package agentflow → ic402, env vars AGENTFLOW_* → IC402_*
- Add content delivery types: ContentRef, AccessGrant, DeliveryMethod,
  ContentDelivery, ContentEntry (mirrors new src/ic402/Types.mo)
- Add fetch_content MCP tool supporting inline, httpUrl, assetCanister,
  and canisterQuery delivery methods (matches integration/mcp fetch_content)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Exposes ic402 payment tools via Gradio's MCP interface.
Tools: setup_identity, request_session_intent, open_session,
session_query, close_session, get_sessions, fetch_content.

Connect to Claude Desktop:
  { "mcpServers": { "ic402": { "url": "http://localhost:7860/gradio_api/mcp/sse" } } }

Run: python python/gradio_mcp.py --simulation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ister calls

- icp.yaml: fix init_args syntax for icp-cli v0.2.1 (path object form)
- main.mo: swap mainnet ckUSDC address for local ledger canister ID so
  openSession / getContent work against the local replica
- gradio_mcp.py: pin server_port=7861, fix MCP endpoint URL in docs
- client.py: multiple ic-py compatibility fixes:
  · Replace removed BasicIdentity with Identity(privkey=hex, type='ed25519')
  · update_raw now returns pre-decoded list — remove stale decode() call
  · Add _remap_fields() to translate hashed Candid field IDs (_1234) back
    to human-readable names (network, token, suggestedDeposit, etc.)
  · Add _candid_open_session() — typed Record encoding for SessionConfig
    and PaymentSignature (ic-py encode requires explicit type objects)
  · Add _candid_session_query() — typed Voucher record + Text encoding
  · Add _candid_text_call() — single Text arg helper used by endSession
  · Use [] instead of None for Opt null values in ic-py record encoding

All five MCP tools verified live against local ICP replica:
setup_identity → request_session_intent → open_session →
session_query (×N, voucher-signed) → get_sessions ✓

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers installation, quickstart, full API reference for AgentflowClient
and SessionHandle, all types and exceptions, MCP server setup (FastMCP
+ Gradio), Claude Desktop integration, voucher crypto, simulation mode,
and known limitations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6 sections: identity setup, charge flow (402), budget guard,
voucher signing (CBOR + Ed25519 verification), session flow
(escrow + 5 streaming vouchers + receipt), content delivery types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tabs: charge flow (402 + budget guard), voucher signing
(Ed25519 + CBOR verification), session flow (open/query/close
with live balance meter), activity log.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tabs were hidden when identity wasn't configured because st.stop()
prevented further rendering. Now shows an info message only, keeping
all four demo tabs accessible at all times.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant