Skip to main content
This page explains exactly how authentication works when Crow calls your MCP server, and how your MCP server authenticates with your own backend API. Every header, every token, every hop.

The Auth Chain

There are three hops in the full chain. Here’s what happens at each one:

Hop 1: Widget → Crow Backend

The widget sends the user’s identity token (a JWT your backend minted) with every chat message. This is the standard Identity Verification flow. If you haven’t set it up, users are treated as anonymous and identity headers won’t be available.

Hop 2: Crow Backend → Your MCP Server

When Crow connects to your MCP server to execute tools, it sends three types of headers: Your MCP server automatically receives the service key — Crow reads it from your product config and injects it into every request. You don’t need to configure anything for this to happen.

Hop 3: Your MCP Server → Your Backend API

Your MCP server wraps your existing backend API. When a tool executes, it calls your API endpoints to actually do the work (query your database, create records, etc.). Your backend API already has auth — Clerk, Auth0, Firebase, API keys, whatever you use. The MCP server can’t use those because it’s not a user. It’s a service acting on behalf of users. The solution: your backend adds a second auth path that accepts the service key. When the service key is present and valid, your backend trusts the request and reads scoping context (user ID, tenant ID) from headers instead of from a user JWT.
Your existing user auth (Clerk, Auth0, Firebase, etc.) stays completely unchanged. The service key adds a second auth path alongside it — it doesn’t replace anything.

Service Keys

A service key is a shared secret that lets your MCP server authenticate with your backend API. Think of it like a Stripe secret key — Crow generates it, you copy it to your backend.

How It Works

The key lives in two places: Crow is the source of truth. You never generate the key yourself.

Where to Find Your Service Key

  1. Go to DeployAPI Keys in the Crow dashboard
  2. Copy the Service Key
  3. Add it to your backend’s .env:

Adding Service Key Auth to Your Backend

Add a ~15-line middleware alongside your existing auth. This does not replace your current auth — it adds a second path.
Key detail: When the service key is present, your backend trusts the scoping headers (X-User-ID, X-Tenant-ID, etc.) because the caller has proven it’s a trusted service. Without the service key, those headers are ignored and normal user auth applies.
Always use constant-time comparison (hmac.compare_digest in Python, crypto.timingSafeEqual in Node) to prevent timing attacks. Never use == to compare secrets.

Your MCP Server — Forwarding the Key

Your MCP server receives X-Service-Key from Crow automatically. It just needs to include it when calling your backend:
For local development, you can also set SERVICE_KEY as an env var on the MCP server as a fallback:
In production, the header from Crow is the primary source.

Identity Headers

Identity headers let your MCP server (and your backend) know who the end user is. Crow extracts claims from the user’s identity token and sends them as HTTP headers.

How Identity Flows Through the Chain

Configuring Header Mappings

In the dashboard, under IntegrationServer-Side MCPHeader Mappings, add mappings:

Available Sources

identity.* — Any claim from the user’s identity JWT:
Identity claims are only available for authenticated users. If the user hasn’t been identified via Identity Verification, identity headers won’t be sent.
product.* — Fields from the Crow product configuration:

Reading Identity Headers in Your MCP Server


Putting It All Together

Here’s the complete picture: Crow calls your MCP server, which calls your backend API, which serves user-specific data. Dashboard configuration:
Your backend .env:
Your MCP server:
Your backend middleware (see Adding Service Key Auth above). What happens when a user asks “show me my orders”:

Edge Cases


Security Checklist

  • Never expose your service key client-side. It’s a server-to-server secret between your MCP server and your backend.
  • Always validate the service key in your backend middleware.
  • Use constant-time comparison for secret validation — never ==.
  • Set up Identity Verification if your tools need to know who the user is.
  • Use HTTPS in production for your MCP server URL.

Troubleshooting