Environment Setup
Applies to Tenant Delegated connections only. Identity Brokering needs no configuration; Token Exchange needs only two URLs entered in the wizard.
This is a how-to guide. The Contract Specification is the normative reference for environment variables and their canonical defaults.
Environment variables
Your tenant application must set the following environment variables:
| Variable | Description | Example |
|---|---|---|
MCP_CONTRACT_HMAC_KEY | 64-character hex shared secret (from hub admin panel) | 4cec2d76a8b1... |
MCP_CONTRACT_SESSION_TTL_SEC | Session token lifetime in seconds | 3600 |
MCP_CONTRACT_AUTH_CODE_TTL_SEC | Auth code lifetime in seconds (recommended: 60) | 60 |
MCP_CONTRACT_ALLOWED_CALLBACK_HOSTS | Comma-separated allowlist of hub callback hosts | mcpweb.aircwou.in |
The MCP_CONTRACT_HMAC_KEY must be exactly 64 hex characters (representing 32 bytes). This key is shared between the hub and your app — never expose it in client-side code or version control.
// lib/mcp-contract/config.ts
export const MCP_CONTRACT_HMAC_KEY_HEX = process.env.MCP_CONTRACT_HMAC_KEY ?? "";
export const MCP_CONTRACT_SESSION_TTL_SEC = parseInt(
process.env.MCP_CONTRACT_SESSION_TTL_SEC ?? "3600", 10
);
export const MCP_CONTRACT_AUTH_CODE_TTL_SEC = parseInt(
process.env.MCP_CONTRACT_AUTH_CODE_TTL_SEC ?? "60", 10
);
export const MCP_CONTRACT_ALLOWED_CALLBACK_HOSTS = (
process.env.MCP_CONTRACT_ALLOWED_CALLBACK_HOSTS ?? ""
)
.split(",")
.map((s) => s.trim())
.filter(Boolean);
export function isAllowedCallbackUrl(url: string): boolean {
try {
const u = new URL(url);
return MCP_CONTRACT_ALLOWED_CALLBACK_HOSTS.includes(u.host);
} catch {
return false;
}
}Domain Verification
Before your tenant can be activated, the hub requires you to prove ownership of your domain. During onboarding, the hub generates a verification token (visible in the admin panel). You must make this token discoverable via one of two methods:
Method 1: DNS TXT record (recommended)
Add a TXT record to your domain's DNS:
| Field | Value |
|---|---|
| Name / Host | _mcp-verify |
| Type | TXT |
| Value | The token from the admin panel (e.g. mcp-hub-verify=4cec2d76a8b1...) |
For example, if your domain is myapp.example.com, the full record name is:
_mcp-verify.example.com TXT "mcp-hub-verify=4cec2d76a8b1..."DNS propagation can take anywhere from a few minutes to 48 hours depending on your DNS provider. You can verify propagation locally by running: nslookup -type=TXT _mcp-verify.example.com
Method 2: Well-known JSON file
If you cannot modify DNS records, you can instead serve a JSON file at:
https://myapp.example.com/.well-known/mcp-hub-verification.jsonThe file must return application/json with this content:
{
"token": "mcp-hub-verify=4cec2d76a8b1..."
}The well-known file must be served over HTTPS, must not redirect, and must return a Content-Type: application/json header. The hub will reject responses that don't meet these requirements.
Triggering verification
Once you've added the DNS record or well-known file, ask your hub administrator to click "Check DNS TXT" or "Check Well-Known File" in the tenant onboarding panel. The hub will attempt to look up your token and mark the domain as verified.
DNS setup
Your tenant app must be accessible over HTTPS. You can use any hosting provider:
- Vercel — automatic HTTPS via
*.vercel.app - Railway — automatic HTTPS via
*.railway.app - Self-hosted — use a reverse proxy (Nginx, Caddy) with Let's Encrypt
During hub onboarding, the admin enters your app's base URL (e.g., https://myapp.example.com). The hub constructs endpoint URLs relative to that base:
| Endpoint | Full URL |
|---|---|
| Login page | https://myapp.example.com/mcp-login |
| Exchange | https://myapp.example.com/api/mcp/exchange |
| Validate | https://myapp.example.com/api/mcp/validate |
| Refresh | https://myapp.example.com/api/mcp/refresh |
| Logout | https://myapp.example.com/api/mcp/logout |
The login page URL (/mcp-login) must be a GET-able HTML page. All API endpoints accept POST requests with JSON bodies (except /api/mcp/login which accepts form data).