Get the FREE Ultimate OpenClaw Setup Guide →

mcp s-oauth

Open source upgrade for MCP Servers to support OAuth 2.0 with Okta SSO. Easily replace .env-based auth with secure, enterprise-grade single sign-on.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio xeris-ai-mcp-servers-oauth python server.py \
  --env SF_CLIENT_ID="OAuth Client ID from service provider" \
  --env SF_CLIENT_SECRET="OAuth Client Secret from service provider" \
  --env TOKEN_STORE_PATH="path to token storage file (e.g., token_store.json)" \
  --env SALESFORCE_CONNECTION_TYPE="oauth or username/password (optional; defaults to oauth flow)"

How to use

This MCP server adds OAuth 2.0 authentication to an existing Salesforce MCP workflow. It replaces hard-coded username/password credentials with a secure OAuth flow that exchanges an authorization code for short-lived access tokens and long-lived refresh tokens. On startup, the server checks for a valid access token; if missing or expired, it will attempt to refresh using a stored refresh token or initiate a full OAuth flow by launching a local web server and opening a browser to the service provider's login page. The updated client stores tokens locally to avoid re-authenticating on every restart, and it supports token refresh to keep access active without user intervention. When you call tools through the MCP server, it will re-authenticate or refresh tokens as needed before each operation, ensuring requests are signed with a valid access token.

How to install

Prerequisites:

  • Python 3.8+ installed
  • Internet access to install dependencies
  • Access to configure an OAuth application with your service provider (Client ID and Client Secret)
  1. Clone the repository
  1. Set up a Python virtual environment (recommended)
  • python3 -m venv venv
  • source venv/bin/activate # on Unix or macOS
  • .\venv\Scripts\activate # on Windows
  1. Install dependencies
  • pip install Flask requests python-dotenv
  1. Configure environment variables (example)
  • Create a .env file or export variables in your environment: SF_CLIENT_ID=your-client-id SF_CLIENT_SECRET=your-client-secret SALESFORCE_CONNECTION_TYPE=oauth TOKEN_STORE_PATH=token_store.json
  1. Run the MCP server
  • python server.py
  1. Optional: customize port or redirect URI
  • Modify the oauth_flow.py and server.py to change the local callback port (default 8080) or token storage location as needed.

Additional notes

Tips and common issues:

  • Ensure the OAuth Redirect URI matches what you configured in the provider console (e.g., http://localhost:8080/callback).
  • The server uses a local token_store.json to persist access/refresh tokens; back up this file securely.
  • If you see 403/401 errors, verify that SF_CLIENT_ID and SF_CLIENT_SECRET are correct and that the refresh token is still valid.
  • The flow supports PKCE for enhanced security; keep your client secret confidential and avoid exposing it in logs.
  • If the environment variable SALESFORCE_CONNECTION_TYPE is set to a non-oauth option, the server may fall back to legacy authentication (if implemented). Adjust as needed.
  • The server will refresh tokens automatically before token expiry during tool calls; occasional re-authentication may still occur if the refresh token expires.

Related MCP Servers

Sponsor this space

Reach thousands of developers