Menu

OAuth support added to MCP Adapter - Vercel
📰
0

OAuth support added to MCP Adapter - Vercel

Vercel News·Allen Zhou·4 days ago
#5YkXEwBo
#vercel#server#auth#const#return#bearertoken
Reading 0:00
15s threshold

Secure your MCP servers with OAuth using version 1.0.0 of the MCP Adapter , which now includes official support for the MCP Authorization spec . This release introduces: Helper functions for OAuth-compliant authorization flows A new withMcpAuth wrapper for securing routes One-click deployable examples with popular auth providers like Better Auth, Clerk, Descope, Stytch, and WorkOS Here’s an example of how to integrate auth in your MCP server: import { createMcpHandler , withMcpAuth } from 'mcp-handler' ; const handler = createMcpHandler ( ( server ) => { server . tool ( 'roll_dice' , 'Rolls an N-sided die' , { sides : z . number ( ) . int ( ) . min ( 2 ) } , async ( { sides } ) => { const value = 1 + Math . floor ( Math . random ( ) * sides ) ; return { content : [ { type : 'text' , text : ` 🎲 You rolled a ${ value } ! ` } ] } ; } ) ; } ) const verifyToken = async ( req : Request , bearerToken ? : string , ) => { if ( ! bearerToken ) return undefined ; const isValid = bearerToken === '123' ; if ( !…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More