@vineethnkrishnan/oauth-core
v0.1.3
Published
Shared OAuth 2.0 infrastructure for MCP server packages — token storage, browser flow, and auto-refresh.
Maintainers
Readme
OAuth Core
Shared OAuth 2.0 infrastructure for MCP server packages — token storage, browser-based auth flow, and automatic token refresh.
Overview
oauth-core is an internal library used by MCP servers in the mcp-pool monorepo to provide consistent OAuth2 authentication. It is not intended to be used as a standalone package.
Used By
@vineethnkrishnan/notion-mcp@vineethnkrishnan/linear-mcp@vineethnkrishnan/hubspot-mcp@vineethnkrishnan/intercom-mcp@vineethnkrishnan/shopify-mcp@vineethnkrishnan/google-workspace-mcp
Features
- Token Storage: Persistent local filesystem storage with automatic refresh.
- Browser-Based OAuth Flow: Opens the user's browser for authorization, runs a local callback server.
- CLI Integration: Adds
auth loginandauth logoutsubcommands to MCP server CLIs. - Strategy Pattern:
OAuthStrategyfor OAuth2 flows,StaticTokenStrategyfor API keys — unified behind a commonTokenProviderinterface. - Configuration-Driven: No hardcoded URLs; each consuming package provides its own OAuth config.
API
createAuthProvider(config)
Creates an OAuth2 auth provider with CLI support for login/logout.
createTokenStore(serverName)
Creates a persistent token store scoped to the given server name. Tokens are stored at ~/.mcp-pool/<serverName>/.
StaticTokenStrategy
A TokenProvider implementation for static API keys/tokens that don't expire.
OAuthStrategy
A TokenProvider implementation for OAuth2 tokens with automatic refresh.
Development
# Build
npm run build -w packages/oauth-core
# Test
npm test -w packages/oauth-coreLicense
This project is licensed under the MIT License.
