laravel-rust-mcp-oauth

OAuth 2.1 sign-in for MCP servers in Laravel for Rust, so people can connect your app to Claude, ChatGPT, Cursor, VS Code and other AI assistants.

When someone adds your MCP server to their assistant, the assistant finds your sign-in page by itself. The person logs in with their normal account, approves the connection, and the assistant gets a token for your MCP route. No API keys to copy.

The crate gives your application:

  • the discovery documents assistants look for (RFC 9728 and RFC 8414);
  • client registration with Client ID Metadata Documents and dynamic registration;
  • an approval page that uses your app's own sign-in, which you can restyle;
  • tokens that rotate on every refresh and are revoked when one is reused;
  • McpAuthenticate, middleware for your MCP route, and the McpGrant and McpUser extractors;
  • a connections API for a "connected apps" page, events, commands and test helpers.

It works today with any route handler, including an rmcp service. The middleware is designed for Laravel's first-party MCP server, which is unreleased, and compatibility is still unverified.

If you want to…Read
Install the crate and connect your first assistantGetting started
Protect your MCP route and use the grant in toolsProtecting routes
Change the approval pageThe approval page
Understand which assistants can connect, and howClients
Show connections, revoke access, react to eventsTokens and connections
See every settingConfiguration
Keep tables you already haveExisting tables
Test your appTesting
Know what the crate protects againstSecurity

Community package, not affiliated with Laravel.