Drop-in OAuth Provider for Personal FastMCP Servers on All Claude Platforms

What This Solves
A developer built a personal memory server using mem0 that Claude can read and write to, creating a personal knowledge vault. While getting it working on Claude Code was straightforward, making it function across Claude.ai web, mobile, and Desktop platforms presented authentication challenges.
The core problem: Claude.ai custom connectors require full OAuth 2.1 compliance. FastMCP provides either an in-memory test provider (unsuitable for production) or a proxy requiring setup of external identity providers like Google, GitHub, or Auth0. For a server intended only for personal use, setting up Auth0 was undesirable overhead.
The Solution
The developer created a single-file authentication provider written in Python that handles the entire OAuth flow without external services. Key features include:
- Dynamic Client Registration (DCR)
- PKCE (Proof Key for Code Exchange)
- Token persistence
- Complete OAuth 2.1 implementation
The provider restricts redirect URIs to claude.ai and localhost only, preventing unauthorized access even though client registration remains open (a Claude.ai requirement that took time to understand).
Implementation Details and Gotchas
The developer encountered several undocumented issues during implementation:
- FastAPI's BaseHTTPMiddleware silently breaks streaming responses, requiring workarounds
- Tool naming conflicts: If tools are named generically (like "add_memory" or "search"), Claude will use its own built-in memory functions instead of calling your server tools. The solution is to prefix tool names distinctively
- Serverless database connections: Neon Postgres (and likely other serverless databases) drop idle connections. Creating a single connection at startup causes tools to randomly fail after a few minutes
- DCR configuration: Dynamic Client Registration is disabled by default in FastMCP. Without enabling it, the /register endpoint returns 404, and Claude.ai silently fails to connect without any error messages
Availability
The solution is available on GitHub at github.com/crumrine/fastmcp-personal-auth as a single Python file under MIT license. This provides a practical alternative for developers who want their personal FastMCP servers to work across all Claude platforms without the complexity of external identity providers.
📖 Read the full source: r/ClaudeAI
👀 See Also

PinchBench Results: First OpenClaw-Specific AI Coding Agent Benchmark
The first OpenClaw-specific benchmark, PinchBench, ranks 32 AI models by success rate, cost, and speed, with Google's Gemini-3-Flash-Preview leading at 95.1% success for $0.72.

Agentlint: GitHub App that catches CLAUDE.md contradictions and broken pointers on every PR
Agentlint is a GitHub App that audits your full agent-rules surface (CLAUDE.md, AGENTS.md, skills, hooks) on every PR, posting inline comments for contradictions, broken paths, and unsupported harness features. Free for public repos.

Comparing Local vs. Cloud AI Agents: OpenClaw and Twin.so
OpenClaw is an open-source local AI agent that runs on your machine with full data control, while Twin.so is a cloud-based platform with 200,000+ community-built agents for 24/7 automation.

How I Built a Skill to Deploy OpenClaw Agents to Web Apps - A Behind-the-Scenes Look
Explore an innovative new skill developed for OpenClaw agents that facilitates easy deployment to web apps. Learn about its features, advantages, and how it transforms production processes.