What it does
Fetches a URL and caches the response server-side. If the same URL has been fetched within the TTL window, returns the cached version without hitting the origin. Useful when multiple agents in a workflow might need the same page, or when you want to avoid hammering a server with repeated requests. Cache miss cost: $0.001. Cache hit cost: $0.001 (charged on served request regardless).
When to use it
- Multiple sub-agents in a pipeline all need the same reference page
- Periodically polling an endpoint that changes slowly
- Caching API responses for a multi-turn agent session
Request schema
{
"url": "https://example.com/data.json",
"ttl_seconds": 3600,
"force_refresh": false
} Response schema
{
"url": "https://example.com/data.json",
"content": "{\"result\": \"...\"}",
"content_type": "application/json",
"cached": true,
"cached_at": "2026-05-07T08:00:00Z",
"ttl_seconds": 3600,
"status_code": 200
} Code example — TypeScript via MCP
Install the MCP server once; all 16 services become tool calls.
// Configure @melis-ai/x402-tools-mcp in your MCP client
// Then call the tool:
const result = await mcpClient.callTool("cacheserve", {
"url": "https://example.com/data.json",
"ttl_seconds": 3600,
"force_refresh": false
});
console.log(result);
// ["url","content","content_type","cached","cached_at","ttl_se... → MCP setup guide Code example — Python via direct HTTP
import requests
# x402 payment header must be set by your wallet client
# See x402.org for client libraries
headers = {
"Content-Type": "application/json",
"x-payment": "<signed-x402-payment-header>",
}
resp = requests.post(
"https://cacheserve.melis.ai/fetch",
json={
"url": "https://example.com/data.json",
"ttl_seconds": 3600,
"force_refresh": false
},
headers=headers,
)
print(resp.json()) Code example — curl with internal key bypass
For testing with an issued internal key (skips x402 payment flow):
curl -X POST https://cacheserve.melis.ai/fetch \
-H "Content-Type: application/json" \
-H "x-internal-key: YOUR_KEY" \
-d '{"url":"https://example.com/data.json","ttl_seconds":3600,"force_refresh":false}' FAQ
Does it work without an account?
Yes. x402 is account-less. Your agent's wallet signs the payment and retries automatically. No registration, no API key, no subscription.
What happens on failure?
Returns the origin error code if the URL is unreachable.
What is the rate limit?
None published.
Is this open-source?
The service code is closed-source for security reasons. The MCP wrapper that calls it is open-source and MIT-licensed: github.com/mizukaizen/x402-tools-mcp .
Who built this?
Part of the melis.ai agent infrastructure stack. Running on a dedicated Helsinki VPS since early 2026. Contact sean@melis.ai.