Prerequisites
@modelcontextprotocol/sdk
version ^1.15.1 or higher- Node.js version 18 or higher
Server URLs
Every MCP server on Smithery has a unique URL that you use to connect:Finding Server URLs
- Browse servers at smithery.ai or query our Registry API
- Visit any server page
- Copy the server URL from the page
Example URLs
- Notion:
https://server.smithery.ai/@smithery/notion/mcp
- Exa:
https://server.smithery.ai/exa/mcp
Connection Overview
Here’s how you can connect to a Smithery server.Authentication Flow
Smithery servers follow the MCP Authorization Specification. When connecting to a Smithery server, authentication happens automatically:- First Connection: Your app attempts to connect to the server
- Authentication Required: If not authenticated, the server responds with spec-compliant metadata to direct your app to handle user login
- User Login: Your app redirects users to Smithery where they:
- Sign in or create an account (one-time)
- Configure the server if needed (API keys, settings)
- Authorize your application
- Token Exchange: Smithery provides tokens back to your app
- Connected: Your app can now reconnect and use the MCP server
Implementing an OAuth Provider
The OAuth provider is an interface that tells the MCP SDK how your application handles authentication. It’s not specific to Smithery - it’s about how your client manages the OAuth flow, token storage, and user redirects. Here’s a complete, minimal implementation you can copy and adapt. For a more comprehensive example with interactive CLI features, see the MCP SDK’s example.Browser Applications
Callback Handler
You’ll need to implement a callback page at/oauth/callback
to handle the OAuth response. This page should:
- Extract the authorization code from URL parameters
- Pass it back to your MCP client
- Show success/error status to the user
Token Persistence
After successful authentication, your application receives tokens that should be persisted for future connections. This prevents users from having to log in repeatedly. Important considerations:- Store tokens securely (encrypted storage preferred)
- Tokens expire and need refresh handling
- Different storage strategies for browser vs server environments
- Each server URL requires its own set of tokens
Next Steps
- Browse available servers at smithery.ai
- Learn about Configuration Profiles for managing multiple servers
- Explore the Registry API for programmatic server discovery