Whats Changed
- Migrated base framework from
mcpSDK (mcp==1.11.0) tofastmcp(fastmcp>=2.14.5) - Introduced
NorthTokenVerifieras a standaloneAuthProviderfor FastMCP- Can be used directly with any
FastMCPinstance (e.g.,FastMCP("my-server", auth=NorthTokenVerifier(...))) - Supports trusted issuers, server secret, and debug configuration
- Can be used directly with any
- Simplified
NorthMCPServerinternals- Removed manual middleware stacking (
sse_app,streamable_http_app,_add_middlewaremethods removed) - Authentication is now delegated to
NorthTokenVerifiervia FastMCP'sauthparameter - Removed
auth_server_providerconstructor parameter
- Removed manual middleware stacking (
- Removed
AuthContextMiddlewareandauth_context_varcontext variable- User context is now available through FastMCP's built-in
get_access_token()dependency
- User context is now available through FastMCP's built-in
- Authenticated requests now return FastMCP's
AuthenticatedUserwrapping anAccessTokenwith structured claims- Claims are validated via new
AuthenticatedNorthUserClaimsPydantic model - Claims include
emailandconnector_access_tokens
- Claims are validated via new
- Added
get_north_context()helper for parsingX-North-Context-*headers- Provides access to custom context values (e.g., tenant IDs, feature flags) passed by the North platform
- Improved Base64 connector token parsing
- Fixed padding calculation for Base64 URL-safe decoding
- Added granular error handling (
binascii.Error,UnicodeDecodeError,json.JSONDecodeError) - Non-string token entries are now skipped with a warning instead of failing the entire parse
- Exported
NorthTokenVerifierandget_north_contextfrom package__all__ - Added
ruffas a dev dependency for linting and formatting - Added
asgi-lifespanas a dev dependency for testing - Added new examples:
server_with_access_token.py,server_with_context.py,server_with_secret.py, andauth-provider-local-mcp/ - Updated all existing examples to use
get_access_token()instead ofget_authenticated_user() - Added new test suites:
test_auth_middleware.py,test_deprecation_warnings.py,test_get_north_context.py,test_north_token_verifier.py,test_utils.py
Deprecation
- Server Secret authentication marked as deprecated
- Utilize other authentication methods (such as OAuth, connector tokens, custom headers)
- Connector Access Tokens unified header marked as deprecated
- Utilize custom headers with connector values to provide connector tokens to MCP server
- Consider use of
get_north_contextfor accessing custom values
get_authenticated_usermarked as deprecated- Use
get_access_tokenfor user context and authentication session details
- Use
Full Changelog: 0.2.4...0.3.0