Skip to content
Documentation
Hevia for developers

MCP with OAuth

The MCP endpoint is an OAuth protected resource: discovery, audience-bound tokens and the rights an AI tool gets.

A client that calls the MCP endpoint without a credential gets 401 with a challenge naming the metadata document (RFC 9728):

Text
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="hevia", resource_metadata="https://hevia.app/.well-known/oauth-protected-resource"
  • GET https://hevia.app/.well-known/oauth-protected-resource returns resource (the MCP URL), authorization_servers and the supported scopes. The same document is served at /.well-known/oauth-protected-resource/api/mcp.
  • The authorization server metadata is at https://hevia.app/.well-known/oauth-authorization-server; PKCE with S256 is required.
  • Send resource=https://hevia.app/api/mcp on the authorize request. The token is bound to that audience; the MCP endpoint refuses OAuth tokens issued for anything else or without a resource (401, error="invalid_token").
  • API keys keep working unchanged and are not audience bound: an owner creates them, scopes them and can revoke them.

Rights of an AI tool

QuestionAnswer
What can the tool read?Exactly the read scopes of its key or token.
Can it write?Only with write scopes, and only through the same checks as the API. Writes that need four-eyes approval wait for a person.
Can it reach another business?No. The business comes from the credential.
Can it send messages to customers?No. There is no tool for sending; messages are prepared for approval in Hevia.
How is it stopped?Revoke the key or end the app under API > Apps, or switch MCP off. It stops at once.
Note

Dynamic client registration (RFC 7591) is not offered. MCP clients are registered as developer apps with a named publisher and fixed redirect URIs.

Generated from the product's own registries, so the reference matches the API.