metrecept-mcp
v0.7.0Metrecept MCP server: signed, independently verifiable Ed25519 receipts for autonomous AI agent calls (chat, web fetch, third-party APIs).
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
metrecept_fetch_web_pages Core: Fetch web pages
Fetch public web pages through the Metrecept compliance filter and return redacted markdown or JSON context, metered and receipted. Use it when you need the page content itself. Not for a model answer grounded in pages: pass fetch_urls to metrecept_create_chat_completion. Not for an authenticated JSON API you hold a key for: use metrecept_call_api. Call metrecept_get_fetch_policy first to pick a valid purpose and stay within its character caps; a few URLs per call is the norm. Pass the same session_id you use on chat and API calls to group them into one metrecept_get_session_receipt receipt. B…
| Parameter | Type | Description |
|---|---|---|
urls * | array | Public http(s) page URLs to fetch; keep it to a handful (per-source and total character caps from metrecept_get_fetch_policy apply). |
format | string | "markdown" (default) or "json" (title/text/meta/json_ld); anything else falls back to markdown. |
purpose | string | Compliance purpose: public_web_retrieval (default), business_catalog, public_company_info or job_listings. |
query | string | Optional plain-text question that focuses the summary; empty string for a general summary. |
session_id | string | Optional session tag grouping this call with others; read the signed aggregate later with metrecept_get_session_receipt. |
metrecept_get_usage Core: Get usage
Read the tenant's live lifetime usage meters: requests, cache hit/miss tokens and ratio, web fetches, API calls, billed USD per meter and total, today's UTC-day values, plan, billing status and whether the soft web-fetch cap is lifted. Use it for 'how much have I used / what plan am I on'. Not for per-day trends: use metrecept_get_usage_history. Not for money saved: use metrecept_get_savings. Not for one run's signed record: use metrecept_get_session_receipt. Read-only, not billed, never cached. A bad or missing key returns the gateway's 401 JSON error. Requires a Metrecept API key (METRECEPT_…
metrecept_list_models Core: List models
List model ids the gateway can route chat to (mock plus examples for OpenAI, Anthropic, Gemini, DeepSeek, Moonshot, Z.ai, Qwen, xAI) and the prefix routing table. Use it before metrecept_create_chat_completion to pick a model; any id under a routed prefix is forwarded verbatim. Not for which vendors are actually configured: use metrecept_list_providers. Static list, read-only, not billed. Non-mock models need your own upstream key (BYOK). Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on remote HTTP); results are scoped to that key's tenant only.
metrecept_list_cache_trees Cache: List cache trees
List every cache tree (isolated exact-replay namespace) the tenant owns, always including the default "main", ordered main first then by creation time. All trees come back in one call. Each tree reports its status: active, frozen or archived. Use it to find a tree_id for the other cache tools. Not for a tree's contents: use metrecept_list_cache_entries. To create, fork or promote use metrecept_manage_cache_tree; to remove a non-main tree use metrecept_delete_cache_tree. Archived trees are hidden unless include_archived=true. Read-only, not billed, live. Requires a Metrecept API key (METRECEPT_…
| Parameter | Type | Description |
|---|---|---|
include_archived | boolean | Also list archived trees (hidden by default). Default false. |
metrecept_list_cache_entries Cache: List cache entries
List entries cached in one tree: request digest, model, token count, byte size and TTL remaining. Metadata only; never returns prompt or response content. Use it to inspect a tree or to get the digest that metrecept_evict_cache_entry needs. Get tree ids from metrecept_list_cache_trees. Page through with offset = previous offset + limit until fewer than limit entries come back. Read-only, not billed, live. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on remote HTTP); results are scoped to that key's tenant only.
| Parameter | Type | Description |
|---|---|---|
limit | integer | Entries per page, 1-100 (clamped server-side; default 25). |
offset | integer | Zero-based offset into the tree's digest index; add limit to page forward (default 0). |
tree_id | string | Cache tree id from metrecept_list_cache_trees (default "main"). |
metrecept_get_savings Core: Get savings
Read the tenant's cumulative savings ledger: cache hit ratio and hit tokens, estimated upstream spend avoided by cache replays, what Metrecept billed for hits and misses, net saving and ROI. Use it for the money view. Not for raw meters or plan: use metrecept_get_usage; for per-day meters use metrecept_get_usage_history. To share these numbers publicly use metrecept_publish_savings_receipt. Avoided-spend figures are list-price estimates (the response carries a disclaimer); billed figures are exact. Read-only, not billed, never cached. A bad or missing key returns the gateway's 401 JSON error.…
metrecept_publish_savings_receipt Receipts: Publish savings receipt
Publish a public, shareable savings receipt: an immutable Ed25519-signed snapshot of current savings at metrecept.co.uk/r/<token>, plus a README badge snippet. Use it when the user wants to share savings outside the tenant. Not for checking the numbers privately: use metrecept_get_savings (call it first to review). Not for a per-run record: use metrecept_get_session_receipt. Side effect: creates a public page that lives 90 days and shows only display_name, never the tenant id or key. Not billed. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on remote HT…
| Parameter | Type | Description |
|---|---|---|
display_name | string | Optional public name shown on the receipt (team or project); empty shows "an anonymous workspace". |
metrecept_register_api_service Core: Register API service
Register or update a third-party API service so metrecept_call_api can make receipted GET calls to it. Use it once per vendor before metrecept_call_api; confirm with metrecept_list_api_services, remove with metrecept_unregister_api_service. Stores only the non-secret shape (base URL, path prefix, auth header name, purpose); the credential travels per call as metrecept_call_api's service_key and is never stored. Re-using a name overwrites that service. Private/internal base URLs are rejected. Not billed. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on r…
| Parameter | Type | Description |
|---|---|---|
base_url * | string | Absolute public http(s) base URL of the vendor API, e.g. "https://api.vendor.example". Private/internal hosts are rejected. |
name * | string | Service id matching [a-z0-9_-]{1,64}, e.g. "vehicle_data". Re-using a name overwrites it. |
allowed_path_prefix | string | Path prefix every call must stay under (default "/"). |
auth_header_name | string | Header the vendor expects the credential in, e.g. "Authorization" or "X-Api-Key" (default "Authorization"). |
purpose | string | Compliance purpose label (default business_api_audit). |
metrecept_list_api_services Core: List API services
List the tenant's registered third-party API services: name, base URL, path prefix, auth header name and purpose. No credentials are stored, so none are returned. Use it to confirm a service name before metrecept_call_api. Register new ones with metrecept_register_api_service; remove with metrecept_unregister_api_service. Read-only, not billed, live, not paginated. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on remote HTTP); results are scoped to that key's tenant only.
metrecept_call_api Core: Call API
Make a read-only GET call to a registered third-party API through the gateway and return the vendor's response body, with a signed receipt that stores only a hash of path and query. Use it for authenticated vendor JSON APIs mid-session. Register the service first with metrecept_register_api_service. Not for public web pages: use metrecept_fetch_web_pages. path must sit under the service's allowed_path_prefix (e.g. prefix "/v1" allows "/v1/lookup"); query is sent as the URL query string. Pass the same session_id as your chat and fetch calls to group them into one metrecept_get_session_receipt r…
| Parameter | Type | Description |
|---|---|---|
path * | string | Path under the service's allowed_path_prefix, e.g. "/v1/lookup". |
service * | string | Registered service name (see metrecept_list_api_services). |
purpose | string | Compliance purpose label (default business_api_audit). |
query | Optional query-string parameters as a flat object. | |
service_key | string | Vendor credential forwarded to the third party and never stored; falls back to METRECEPT_SERVICE_KEY env. |
session_id | string | Optional session tag grouping this call into a metrecept_get_session_receipt receipt. |
metrecept_get_session_receipt Receipts: Get session receipt
Get one signed, aggregated receipt for a session: every chat completion, web fetch and API call tagged with the same session_id, with event count, total billed USD, cache hits/misses, fetch and API counts, first/last timestamps, the compact JWS and a verify_url. Use it at the end of an agent run and put verify_url in the PR, ticket or email the run produced; anyone can verify it in a browser, no account needed. Not for a public savings snapshot: use metrecept_publish_savings_receipt. Not for tenant totals: use metrecept_get_usage. Read-only, makes no upstream call, not billed. An unknown id re…
| Parameter | Type | Description |
|---|---|---|
session_id * | string | The same session_id passed on the tagged chat, fetch and API calls. |
metrecept_list_providers Core: List providers
Show which upstream vendors the gateway has configured and ready (mock, openai, anthropic and each OpenAI-compatible vendor), with BYOK header name and billing model. Use it to debug a failed metrecept_create_chat_completion or check a vendor is ready. Not for picking a model id: use metrecept_list_models. Reports key presence only; keys are never validated upstream or returned. Read-only, not billed, live. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on remote HTTP); results are scoped to that key's tenant only.
metrecept_get_fetch_policy Core: Get fetch policy
Read the web-fetch compliance policy enforced for this tenant: allowed purpose values, robots.txt and PII-redaction settings, whether Terms/DPA acceptance is required, and per-source and total character caps. Use it before metrecept_fetch_web_pages or a metrecept_create_chat_completion with fetch_urls, or after a refused fetch to see which rule applied. Not for third-party APIs: metrecept_call_api uses registered services instead. Read-only, not billed. A bad or missing key returns the gateway's 401 JSON error. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bea…
metrecept_create_chat_completion Core: Create chat completion
Send one user message to a model through the Metrecept gateway (OpenAI-compatible) and return the reply text; an exact repeat of a request is served from the tenant's cache. Use it for model answers, optionally grounded in public pages via fetch_urls. Not for the page content itself: use metrecept_fetch_web_pages. Start with model "mock" to test without an upstream key; pick real ids from metrecept_list_models. purpose only applies when fetch_urls is set; check allowed values with metrecept_get_fetch_policy. Pass one session_id across a run's chat, fetch and API calls, then read metrecept_get_…
| Parameter | Type | Description |
|---|---|---|
prompt * | string | The user message text. |
fetch_urls | Optional public URLs whose compliant, redacted content is attached as context before the model answers (Terms/DPA must be accepted). | |
model | string | Model id from metrecept_list_models; "mock" (default) needs no upstream key, others need BYOK. |
purpose | string | Fetch purpose used only when fetch_urls is set (default public_web_retrieval). |
session_id | string | Optional session tag; read the signed aggregate later with metrecept_get_session_receipt. |
upstream_api_key | string | Optional vendor key for this call (else METRECEPT_UPSTREAM_KEY env); forwarded, never stored. |
metrecept_unregister_api_service Core: Unregister API service
Unregister one of the tenant's third-party API services so metrecept_call_api can no longer reach it. Use it to retire a vendor integration; check exact names with metrecept_list_api_services. Not for changing settings: re-register the same name with metrecept_register_api_service. Destructive and immediate, no undo, though no credential is lost because none is stored. Later calls and repeat unregisters return 404 service_not_found; 404 feature_disabled means API passthrough is off. Not billed. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on remote HTT…
| Parameter | Type | Description |
|---|---|---|
name * | string | Registered service name to remove, e.g. "vehicle_data" ([a-z0-9_-]{1,64}). |
metrecept_get_usage_history Core: Get usage history
Read the tenant's usage meters as a per-UTC-day series, oldest day first, plus window totals: requests, cache hit/miss tokens and USD, prewarm, web fetches, API calls, custody and statement meters, upstream cache tokens and billed_usd. Use it for trends or 'what did I spend each day'. Not for lifetime totals or plan: use metrecept_get_usage. Not for spend avoided: use metrecept_get_savings. Read from the durable per-day ledger; idle days are 0, nothing is estimated. Read-only, not billed. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on remote HTTP); re…
| Parameter | Type | Description |
|---|---|---|
days | integer | Window length in UTC days ending today, 1-90 (default 30; out-of-range values are clamped). |
metrecept_evict_cache_entry Cache: Evict cache entry
Evict one cached response from a cache tree by its request digest, so the next identical request in that tree is a fresh miss sent upstream and billed as a miss. Use it to drop a stale or wrong cached answer. Get the digest from metrecept_list_cache_entries. Not for removing a whole tree: use metrecept_delete_cache_tree. Ownership: eviction removes only this tree's own copy or reference. An entry inherited from a parent is untouched; evict it in the parent. If this tree owns the bytes, trees referencing them after a promote also lose the entry. Destructive and immediate, no undo; not billed. E…
| Parameter | Type | Description |
|---|---|---|
digest * | string | Request digest exactly as returned in entries[].digest by metrecept_list_cache_entries: a 64-character lowercase hex SHA-256 of the normalized request (the server accepts 8-200 characters of A-Z a-z 0… |
tree_id | string | Cache tree id that holds the entry (default "main"). |
metrecept_delete_cache_tree Cache: Delete cache tree
Delete a whole non-main cache tree: its metadata, digest index, references and the cached responses it owns. Use it to clean up after an experiment, typically after metrecept_manage_cache_tree promote. Find ids with metrecept_list_cache_trees. Not for a single entry: use metrecept_evict_cache_entry. Destructive and immediate, no undo; not billed. Refuses "main" (409 cannot_delete_main) and trees with children (409 tree_has_children; delete children first). Responses another tree references after a promote are kept until their TTL. A missing or already-deleted tree returns 404 tree_missing. Req…
| Parameter | Type | Description |
|---|---|---|
tree_id * | string | Id of the tree to delete; any tree except "main". |
metrecept_manage_cache_tree Cache: Manage cache tree
Create, fork or promote a cache tree (an isolated exact-replay namespace). Use it to isolate cache for an experiment or PR: fork main, send chat calls into the fork, promote it back when good, then remove it with metrecept_delete_cache_tree. Not for listing trees: use metrecept_list_cache_trees. Not for deleting a tree or entry: use metrecept_delete_cache_tree or metrecept_evict_cache_entry. create and fork give the new tree an empty local index that reads its parent chain copy-on-write, so it serves parent entries by reference with zero bytes copied; its own new entries stay local. promote ad…
| Parameter | Type | Description |
|---|---|---|
action * | string | "create": new tree under parent (default main). "fork": new child of tree_id. "promote": merge tree_id's own entries into the target tree (default its parent). |
into | string | promote only: target tree id; empty means the child's parent. Use "main" to land a grandchild directly in main. |
name | string | create/fork: optional id for the new tree, [a-z0-9_-]{1,64}; empty generates "t-" plus 10 hex characters. Ignored by promote. |
parent | string | create only: parent tree id the new tree reads through to; empty means "main". |
tree_id | string | fork: tree to fork (main allowed). promote: tree whose entries are merged (not main). Required for fork and promote; ignored by create. |
metrecept_freeze_cache_tree Cache: Freeze cache tree
Freeze a cache tree so it keeps serving its cached responses but accepts no new writes, or unfreeze it (frozen=false) back to active. Use it to pin a known-good cache, for example a release branch's tree, while experiments continue in forks. Not for hiding or retiring a tree: use metrecept_archive_cache_tree. Not for removing it: use metrecept_delete_cache_tree. While frozen, misses are served upstream but not stored, eviction returns 409 tree_frozen and the tree cannot be a fork parent or promote target. Idempotent, not billed, audit-logged. Errors: 409 cannot_freeze_main, 409 tree_archived (…
| Parameter | Type | Description |
|---|---|---|
tree_id * | string | Id of the cache tree to freeze or unfreeze; any tree except "main". |
frozen | boolean | true (default) freezes the tree; false unfreezes it back to active. |
metrecept_archive_cache_tree Cache: Archive cache tree
Archive a cache tree: make it read-only and hide it from metrecept_list_cache_trees, keeping every entry so it can be restored later; archived=false restores it to the status it had before (active or frozen). Use it to retire a finished experiment's tree without losing it. Not for a temporary write lock: use metrecept_freeze_cache_tree. Not for freeing storage: use metrecept_delete_cache_tree. Archived trees still serve hits, but writes, eviction, reset and freeze return 409 tree_archived, and they cannot be a fork parent or promote target. List them with include_archived=true. Idempotent, not…
| Parameter | Type | Description |
|---|---|---|
tree_id * | string | Id of the cache tree to archive or restore; any tree except "main". |
archived | boolean | true (default) archives the tree; false restores it to the status it had before archiving. |
metrecept_prewarm_cache Cache: Prewarm cache
Refresh an about-to-expire Anthropic prompt-cache breakpoint for a session with a one-token call, so the next real turn reads the cache instead of paying a fresh cache write. Use it from an idle timer when a long Claude conversation is about to sit past the cache TTL. Not for the gateway's own exact-replay cache (it never touches it): use metrecept_create_chat_completion. Not for OpenAI or other vendors, whose prompt caching is automatic. Sends your transcript and your upstream key exactly like a chat call; nothing is stored. Unbilled by the gateway (returns billed:false, billed_usd 0; the ven…
| Parameter | Type | Description |
|---|---|---|
messages * | array | The conversation's current transcript (system, user and assistant turns in order). The cached prefix is computed from it; nothing is stored. |
model * | string | Anthropic model id, must start with "claude" (e.g. "claude-sonnet-4-5"); other vendors cache automatically and are refused. |
session_id * | string | Session id of the conversation to keep warm; the same id the client sends on its real chat turns. |
upstream_api_key | string | Optional Anthropic key for this call (else the configured upstream key env); forwarded, never stored. |
metrecept_mint_receipt Receipts: Mint receipt
Mint one fresh signed Ed25519 receipt (compact JWS) of a chosen kind by making the smallest real gateway call that produces it, and return the receipt with its kid, iat and a verify_url. Use it to show or test receipt verification end to end, or to attach a real receipt to a demo or bug report. Not for a run you already made: use metrecept_get_session_receipt. Not for a public savings page: use metrecept_publish_savings_receipt. Each kind makes real calls billed as normal (cache_miss, finops, cache_bypass, web_fetch and api_call are metered; cache_hit bills one miss then a hit). Anyone can che…
| Parameter | Type | Description |
|---|---|---|
kind * | string | Receipt kind to mint. cache_miss/finops: one fresh "mock" chat call. cache_hit: the same prompt twice, receipt from the replay. cache_bypass: fresh call with cache_control no_store. web_fetch: chat ca… |
label | string | Free text mixed into the minted request so each run is unique and recognisable, e.g. a PR or ticket id (default "metrecept-mint"). |