How AI Agents Discover and Buy Data: The MCP Purchase Flow
The era of agents browsing dashboards, copying API keys, and manually wiring credit cards is over. As AI systems transition from passive tool-callers to autonomous economic actors, the infrastructure for machine-to-machine commerce must evolve from kludged REST portals into protocol-native transaction flows. The Model Context Protocol (MCP)—originally designed for context provisioning—is emerging as the transport layer for exactly this kind of autonomous commerce, particularly for data products.
This post walks through the complete lifecycle: an AI agent registers with a data marketplace via MCP's JSON-RPC, receives free starter credits, discovers and evaluates DePIN data products, purchases snapshots, and tops up credits via Stripe. We'll formalize the trust model that makes autonomous purchase viable—because when a machine spends money without a human in the loop, provenance is everything.
---
The Problem: Self-Service Commerce for Non-Human Actors
Traditional data marketplaces assume a human at a browser. The purchase flow looks like:
This breaks down at scale. A quant research agent exploring 200 DePIN feeds doesn't have time for step 2, and its operator shouldn't need to intervene for step 3. What's needed is a protocol-native commerce layer where agents can:
- Discover products programmatically with rich metadata.
- Evaluate fitness-for-purpose using structured provenance and verification.
- Transact using metered credits with deterministic settlement.
- Verify post-purchase that the data matches the product description.
---
Step 1: Agent Registration via MCP JSON-RPC
MCP operates over JSON-RPC 2.0, typically transported via stdio or SSE. An agent initiates by connecting to a marketplace's MCP server and exchanging capabilities.
Initialization Handshake
// Client → Server: initialize
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {
"roots": { "listChanged": true },
"sampling": {}
},
"clientInfo": {
"name": "kairos-quant-agent",
"version": "0.4.1"
}
}
}
// Server → Client: initialize response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2025-03-26",
"capabilities": {
"tools": { "listChanged": true },
"resources": { "subscribe": true },
"prompts": { "listChanged": true }
},
"serverInfo": {
"name": "kairos-data-marketplace",
"version": "1.2.0"
}
}
}
After the handshake, the client sends an initialized notification. At this point, the agent is connected but not yet economically identified.
Agent Registration Tool Call
The marketplace exposes a register_agent tool. The agent invokes it with a verifiable identity—typically a public key or a signed JWT from an identity provider:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "register_agent",
"arguments": {
"agent_id": "did:kairos:0x7a3b...f29e",
"public_key": "ed25519:BG3zQk9m8vR4p...",
"signed_challenge": "3045022100e8a1...",
"metadata": {
"operator": "org:kairos-research",
"purpose": "quant_signal_discovery",
"rate_limits": { "max_spend_per_hour": 5000 }
}
}
}
The server validates the signature against the challenge, registers the agent in its identity graph, and returns a credential:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [{
"type": "text",
"text": "{\"agent_id\": \"did:kairos:0x7a3b...f29e\", \"credit_balance\": 1000, \"currency\": \"kairos-credits\", \"expires_at\": \"2025-07-13T00:00:00Z\"}"
}]
}
}
Free credits are issued at registration. This is not generosity—it's a bootstrapping mechanism. The marketplace stakes a small balance (typically 1,000 credits ≈ $1.00 USD equivalent) to let the agent evaluate low-cost products before requiring payment infrastructure. This is the machine equivalent of a free trial, but deterministic and programmatically accessible.
---
Step 2: Product Discovery and Evaluation
Listing Products
The agent discovers available data products through the list_products tool:
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "list_products",
"arguments": {
"category": "depin",
"modality": "weather",
"geohash": "u4pr",
"min_coverage": 0.95
}
}
}
The response returns structured product metadata:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [{
"type": "text",
"text": "[{
\"product_id\": \"depin:weather:helium:u4pr:daily\",
\"name\": \"Helium Weather Feed - Copenhagen Area\",
\"description\": \"Daily aggregated weather observations from Helium IoT sensors in geohash u4pr. Includes temperature, humidity, barometric pressure, wind speed/direction.\",
\"price_per_unit\": 5,
\"unit\": \"snapshot\",
\"data_format\": \"parquet\",
\"schema\": \"s3://kairos-schemas/depin-weather-v3.avsc\",
\"coverage\": 0.973,
\"provenance\": {
\"source_count\": 142,
\"last_audit\": \"2025-06-12T14:30:00Z\",
\"verify_url\": \"https://verify.kairos.network/v1/snapshot/depin:weather:helium:u4pr:daily/QmX7k...\"
},
\"temporal_range\": { \"start\": \"2024-01-01\", \"end\": \"2025-06-12\" },
\"quality_score\": 0.94
}]"
}]
}
}
Evaluation: The Fitness Function
An autonomous agent doesn't "read descriptions"—it computes fitness. The evaluation function combines coverage, quality, provenance depth, and cost:
$$ \mathcal{F}(p) = \alpha \cdot C(p) + \beta \cdot Q(p) + \gamma \cdot \log_2(N_s(p)) - \delta \cdot \frac{P(p)}{B} $$
Where:
- $C(p)$ is coverage (fraction of expected data present)
- $Q(p)$ is the quality score (completeness + accuracy)
- $N_s(p)$ is the number of source devices contributing to the product
- $P(p)$ is the price in credits
- $B$ is the agent's current balance
- $\alpha, \beta, \gamma, \delta$ are tunable weights reflecting the agent's utility preferences
The agent filters products where $\mathcal{F}(p) > \tau$ for a decision threshold $\tau$, then selects the argmax.
---
Step 3: Purchasing a DePIN Data Snapshot
Once the agent selects a product, it initiates a purchase:
{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "purchase_product",
"arguments": {
"product_id": "depin:weather:helium:u4pr:daily",
"unit_type": "snapshot",
"snapshot_date": "2025-06-11",
"delivery_method": "presigned_url",
"agent_id": "did:kairos:0x7a3b...f29e"
}
}
}
The server performs a synchronous, atomic transaction:
credit_balance >= price_per_unit.Response:
```json { "jsonrpc": "2.0", "id": 4, "result": { "content": [{ "type": "text", "text": "{\"purchase_id\": \"purch_9x8k2m...\", \"status\": \"completed\", \"credits_spent\": 5, \"remaining_balance\": 995, \"artifact\": { \"url\": \"https://storage.kairos.network/snapshots/2025-06-11-depin-weather-u4pr.parquet?signature=...\", \"expires_at\": \"2025-06-13T12:00:00Z\", \"content_hash\": \"sha256:a1b2c3d4...\", \"size_bytes\": 8472913 }, \"receipt\": { \"purchase_id\": \"purch_9x8k2m...\", \"verify_url\": \"https://verify.kairos.network/v1/receipt/purch_9x8k2m...\", \"provenance_chain\":