Documentation Index
Fetch the complete documentation index at: https://docs.alterauth.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Alter Python SDK turns any FastMCP server into a multi-user MCP server with built-in OAuth 2.0. Each user authenticates with an identity provider, and the SDK resolves their OAuth grants automatically — no shared credentials, no per-user configuration, nomcp-remote shim.
One server, many users, each with their own OAuth tokens.
Prerequisites
- Alter Vault API key (from the Developer Portal)
- OAuth provider configured in the Developer Portal (e.g., Google, GitHub, Slack)
- Identity provider configured (e.g., Auth0, Clerk) for user authentication
- Python 3.11+
Install Dependencies
- pip
- Poetry
Build the Server
Create a file calledserver.py:
The
base_url parameter must match the URL where the MCP server is
mounted (e.g., http://localhost:8000/mcp). The SDK uses this as the
OAuth issuer and advertises endpoint URLs relative to it.Run the Server
http://localhost:8000 with the MCP endpoint at /mcp.
How Multi-User Auth Works
When any MCP client connects, the server handles the full OAuth 2.0 flow automatically:Discovery
The client fetches
/.well-known/oauth-authorization-server to discover OAuth endpoints (authorization, token, registration).Client Registration
The client registers itself via the
/register endpoint (dynamic client registration per RFC 7591).User Login
A browser window opens for IDP login (e.g., Auth0, Clerk). The user authenticates with existing credentials.
Token Exchange
The SDK exchanges the authorization code for access and refresh tokens (with PKCE). The client stores these locally.
Connecting MCP Clients
Claude Code
Add the MCP server to the project configuration. Create or edit.claude.json in the project root:
Claude Desktop
Add the same configuration to the Claude Desktop config file:- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Any MCP Client
Any MCP client that supports the HTTP transport with OAuth 2.0 (RFC 8414 discovery + PKCE) can connect using the same URL. No client-specific configuration is needed on the server side.Adding More Tools
Add additional tools by stacking the@mcp.tool() and @alter_mcp.tool() decorators:
Next Steps
MCP Tool API
Detailed
@alter.tool() decorator reference, error recovery, nested tools, and AlterContext API.FastAPI Integration
Build combined REST + MCP servers with shared identity resolution.
LangChain Integration
Use
@alter_tool with LangChain agents and LangGraph workflows.Python SDK Quickstart
Full SDK setup, configuration options, and error handling.