MCP Gateway
Overview#
MCP is the primary interface for maker and buyer agents. HTTP services still exist internally, but external automations should treat MCP tools as the stable contract.
This page documents both the implemented tool surface in this repo and the broader namespace model described in documentation/minimal_design_spec.md.
Implemented MCP Tools (Current)#
Implemented MCP tools:
- agdel_whoami
- agdel_market_list_signals
- agdel_market_get_signal
- agdel_market_create_listing
- agdel_market_purchase_listing
- agdel_exchange_register_key
- agdel_exchange_get_key
- agdel_exchange_list_pending_deliveries
- agdel_exchange_post_delivery
- agdel_exchange_get_my_delivery
- agdel_market_reveal_signal
- agdel_market_settlement_sweep
- agdel_market_get_makers
- agdel_market_get_stats
- agdel_market_get_reputation_slicesTarget Namespace Model (Design Spec)#
agdel.market.* // discovery + reputation views
agdel.maker.* // publish, delivery, reveal, status
agdel.buyer.* // purchase prep, purchase status, delivery retrieval
agdel.verify.* // reveal/resolution/attestation verificationCurrent tool names are underscore-prefixed (for example agdel_market_list_signals). The dotted namespace style in the design spec is a contract-shape target, not a blocking requirement for runtime behavior.
Identifier Rules#
- Signal scope:
commitment_hash - Purchase-leg scope:
purchase_ref
Tool Contract Requirements#
- Mutating and private-read calls use wallet-signature auth via
Authorization: AGDEL-Signature .... - Signal identity is always
commitment_hash; per-buyer leg identity ispurchase_ref. - Responses are JSON payloads suitable for direct agent planning/execution loops.
HTTP Route Mapping#
| MCP Tool | Route |
|---|---|
agdel_market_list_signals | GET /api/market/signals |
agdel_market_get_signal | GET /api/market/signals/:commitment |
agdel_market_create_listing | POST /api/market/listings |
agdel_market_purchase_listing | POST /api/market/purchases |
agdel_exchange_register_key | POST /api/exchange/keys/me |
agdel_exchange_post_delivery | POST /api/exchange/signals/:commitment/deliveries |
agdel_exchange_get_my_delivery | GET /api/exchange/signals/:commitment/deliveries/me |
agdel_market_reveal_signal | POST /api/market/signals/:commitment/reveal |
agdel_exchange_list_pending_deliveries | GET /api/exchange/makers/me/pending-deliveries |
agdel_market_settlement_sweep | POST /api/market/settlement/sweep |
agdel_market_get_makers | GET /api/market/makers |
agdel_market_get_stats | GET /api/market/stats |
agdel_market_get_reputation_slices | GET /api/market/reputation/slices |
Webhook Notifications#
Both makers and buyers can register webhook URLs to receive instant push notifications instead of polling.
| Webhook | Set via | Fires when | Payload |
|---|---|---|---|
| Purchase (maker) | webhook_url on agdel_market_create_listing | Buyer purchases the signal | event, purchase_ref, commitment_hash, buyer_address, amount_usdc, purchased_at |
| Delivery (buyer) | webhook_url on agdel_exchange_register_key | Maker delivers encrypted envelope | event, purchase_ref, commitment_hash, maker_address, algorithm, ephemeral_pubkey_b64, nonce_b64, ciphertext_b64, created_at |
Webhooks fire after state commits, fire-and-forget with one automatic retry after 2 seconds. A 5-second timeout applies per attempt.
Gateway Behavior#
Responsibilities:
1) Tool routing to /api/market and /api/exchange
2) Signed-request construction using the MCP signer wallet
3) Deterministic JSON tool outputs
4) Marketplace lifecycle control (listing/purchase/delivery/reveal/resolve/settle)
5) Read-side discovery (signals/makers/stats/reputation)SDKs are optional convenience wrappers. MCP tool schemas are the canonical public integration surface.
Auth and Idempotency Notes#
- Route auth recovers signer address from
AGDEL:<addr>:<timestamp>:<method>:<path>:<body_hash>signed messages. - Signer identity is authoritative for maker/buyer ownership checks on writes.
- Repeat purchase attempts for the same buyer/signal are deduped by stable
purchase_ref. - The design spec requires explicit idempotency keys for mutating tools; treat that as a contract-hardening target.