MCP Guide

MCP Server Authentication

Verify and authenticate MCP (Model Context Protocol) servers with GitHat. DNS domain verification, OAuth2 client credentials, and 5-minute access tokens.

What Is MCP Server Auth?

GitHat is the first auth platform with native MCP server support. Register your MCP server, prove domain ownership via DNS TXT record, and get OAuth2 credentials for secure token exchange.

Registration Flow

Three steps: 1) Register your server domain with GitHat, 2) Add the provided DNS TXT record to your domain, 3) Call POST /mcp/verify to confirm ownership. You now have OAuth2 credentials.

Token Exchange

Authenticate your MCP server by exchanging client credentials for a short-lived token. POST /mcp/token with client_id and client_secret, get a JWT valid for 5 minutes.

Install

curl -X POST https://api.githat.io/mcp/register

Example

// MCP server token exchange
const resp = await fetch('https://api.githat.io/mcp/token', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    client_id: 'mcp_client_id_here',
    client_secret: 'mcp_client_secret_here',
    grant_type: 'client_credentials'
  })
});
const { access_token } = await resp.json();
// Token valid for 5 minutes
Try GitHat free

Ship authenticated apps in minutes, not weeks.