Skip to main content
Full feature guide: MCP Auth Server

Overview

@grantex/mcp-auth is a production-ready OAuth 2.1 + PKCE authorization server that adds delegated auth to any MCP (Model Context Protocol) server. Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client.

Install

npm install @grantex/mcp-auth

Quick Start

import { createMcpAuthServer } from '@grantex/mcp-auth';

const auth = createMcpAuthServer({
  grantexApiKey: process.env.GRANTEX_API_KEY!,
  issuer: 'https://auth.myapp.com',
  scopes: ['calendar:read', 'email:send'],
});

// Mount on Express
app.use('/oauth', auth.routes());

What You Get

  • OAuth 2.1 + PKCE — authorization code flow with S256 challenge
  • Client registration — dynamic or pre-registered MCP clients
  • Token introspection — validate tokens issued by this server
  • Token revocation — revoke access at any time
  • Grantex-backed — tokens are Grantex grant tokens with full audit trail