Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/dvlpjrs/guMCP/llms.txt

Use this file to discover all available pages before exploring further.

Overview

LocalAuthClient is an implementation of BaseAuthClient that reads and writes credentials to local files. It’s designed for local development and self-hosted installations. Source: src/auth/clients/LocalAuthClient.py:17

Class Definition

from .BaseAuthClient import BaseAuthClient, CredentialsT

class LocalAuthClient(BaseAuthClient[CredentialsT]):
    """Implementation that reads/writes credentials to local files."""

Constructor

Source: src/auth/clients/LocalAuthClient.py:25
def __init__(
    self,
    oauth_config_base_dir: Optional[str] = None,
    credentials_base_dir: Optional[str] = None,
):
oauth_config_base_dir
Optional[str]
Directory containing OAuth config files. Defaults to GUMCP_OAUTH_CONFIG_DIR environment variable or {project_root}/local_auth/oauth_configs
credentials_base_dir
Optional[str]
Base directory to store user credentials. Defaults to GUMCP_CREDENTIALS_DIR environment variable or {project_root}/local_auth/credentials

Methods

get_oauth_config

Retrieves OAuth configuration from a local JSON file. Source: src/auth/clients/LocalAuthClient.py:56
def get_oauth_config(self, service_name: str) -> Dict[str, Any]:
service_name
str
required
Name of the service (e.g., “gdrive”, “github”, “slack”)
return
Dict[str, Any]
OAuth configuration loaded from {oauth_config_base_dir}/{service_name}/oauth.json
Raises:
  • ValueError - If OAuth config directory is not set
  • FileNotFoundError - If config file doesn’t exist at expected path

get_user_credentials

Retrieves user credentials from a local JSON file. Source: src/auth/clients/LocalAuthClient.py:74
def get_user_credentials(
    self, service_name: str, user_id: str
) -> Optional[CredentialsT]:
service_name
str
required
Name of the service
user_id
str
required
Identifier for the user
return
Optional[CredentialsT]
Credentials data loaded from {credentials_base_dir}/{service_name}/{user_id}_credentials.json, or None if file doesn’t exist
Raises:
  • ValueError - If credentials directory is not set

save_user_credentials

Saves user credentials to a local JSON file. Source: src/auth/clients/LocalAuthClient.py:95
def save_user_credentials(
    self,
    service_name: str,
    user_id: str,
    credentials: Union[CredentialsT, Dict[str, Any]],
) -> None:
service_name
str
required
Name of the service
user_id
str
required
Identifier for the user
credentials
Union[CredentialsT, Dict[str, Any]]
required
Credentials to save. Can be a dict, an object with a to_json() method, or any JSON-serializable object
Raises:
  • ValueError - If credentials directory is not set
File Location: {credentials_base_dir}/{service_name}/{user_id}_credentials.json

File Structure

OAuth Config Files

{oauth_config_base_dir}/
  ├── slack/
  │   └── oauth.json
  ├── gdrive/
  │   └── oauth.json
  └── github/
      └── oauth.json

Credentials Files

{credentials_base_dir}/
  ├── slack/
  │   ├── user1_credentials.json
  │   └── user2_credentials.json
  └── gdrive/
      └── user1_credentials.json

Environment Variables

GUMCP_OAUTH_CONFIG_DIR
string
Override default OAuth config directory location
GUMCP_CREDENTIALS_DIR
string
Override default credentials directory location

Example Usage

from src.auth.clients.LocalAuthClient import LocalAuthClient

# Create client with default directories
client = LocalAuthClient()

# Get OAuth config
config = client.get_oauth_config("slack")

# Get user credentials
creds = client.get_user_credentials("slack", "user123")

# Save credentials
client.save_user_credentials("slack", "user123", {
    "access_token": "xoxb-...",
    "refresh_token": "xoxr-...",
})

See Also

Build docs developers (and LLMs) love