ivd

Host apps: tenant keys for the hosted IVD MCP server

A host app is a product that serves many of its own customers (tenants) and wants each of them to use IVD through it. Instead of registering a key per tenant, the host and the server share one secret, and the host derives each tenant’s key on demand. The server recomputes the key to check it: there is no provisioning step and nothing to sync.

What a tenant gets

A tenant key can list and call three content-only tools:

Tool Input
ivd_validate artifact_yaml, optional artifact_type
ivd_review_intent artifact_yaml
canon_check text or document

Deriving a key

key = "ivd_" + tenant + "_" + base64url_nopad( HMAC-SHA256(SECRET, "ivd:" + VERSION + ":" + tenant) )

Python:

import base64, hashlib, hmac

def ivd_tenant_key(secret: str, tenant: str, version: str = "v1") -> str:
    mac = hmac.new(secret.encode(), f"ivd:{version}:{tenant}".encode(), hashlib.sha256).digest()
    return f"ivd_{tenant}_" + base64.urlsafe_b64encode(mac).rstrip(b"=").decode()

Test vector, to check your implementation:

Secret Version Tenant Key
test-secret-do-not-use v1 acme ivd_acme_lapHGNV1gUE0w05P_i0KVkw8RF5Y5R_9-vngns5EZ50

Send it as Authorization: Bearer <key> on every request (Streamable HTTP at /mcp, or legacy SSE at /sse + /messages).

Sessions

Open one MCP session per tenant. A session is bound to the key that opened it: a message on that session with another tenant’s key, or an operator key, is answered as if the session did not exist (404). Reusing one session for two tenants does not work, by design.

Server settings (operator)

Variable Meaning Default
IVD_TENANT_KEY_SECRET Shared secret. Not set: tenant keys are off and nothing changes not set
IVD_TENANT_KEY_VERSIONS Comma-separated versions accepted v1
IVD_REVOKED_TENANTS Comma-separated tenants whose keys are refused empty