### Example mcp_plexus .env Configuration Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md An example '.env' file demonstrating the configuration of various application settings, including server details, logging levels, storage backends, and critical secrets like encryption keys and API keys. ```env # Uvicorn Development Server DEV_SERVER_HOST=127.0.0.1 DEV_SERVER_PORT=8000 DEV_SERVER_LOG_LEVEL=info DEV_SERVER_RELOAD=True # Application Settings APP_NAME=MCP Plexus Server DEBUG_MODE=True REDIS_HOST=localhost REDIS_PORT=6379 REDIS_DB=0 # REDIS_PASSWORD= # REDIS_SSL=False PLEXUS_FASTMCP_LOG_LEVEL="DEBUG" STORAGE_BACKEND=sqlite SQLITE_DB_PATH=./mcp_plexus_data.sqlite3 HOST_APP_REGISTRATION_SECRET=host_app_secre ADMIN_API_KEY=your_super_secret_admin_api_key_here_12345 PLEXUS_CLI_API_BASE_URL=http://127.0.0.1:8080 PLEXUS_ENCRYPTION_KEY=your_generated_fernet_key_here # see mcp_plexus/utils/generate_key.py ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Installs all Python dependencies required by the mcp_plexus project from the 'requirements.txt' file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Create Tenant via Plexus CLI Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Example of using the Plexus administrative command-line interface (CLI) to create a new tenant with a specified entity ID and name. ```bash plexus admin tenant create --entity-id "mycompany" --name "My Company Inc." ``` -------------------------------- ### MCP Tool Registration Example Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Illustrates how to define and register custom tools within MCP Plexus using Python modules. ```APIDOC ## Tool Registration via `PLEXUS_SERVER_INSTANCE` ### Description Tools, resources, and prompts are registered within MCP Plexus by defining Python modules in the `mcp_plexus/tool_modules/` directory and using the `PLEXUS_SERVER_INSTANCE` to register them. ### Example Tool Module (`mcp_plexus/tool_modules/my_custom_tools.py`) ```python import logging from typing import Dict, Any, Optional, List import httpx from fastmcp import Context as FastMCPBaseContext from mcp_plexus.core.global_registry import PLEXUS_SERVER_INSTANCE from mcp_plexus.plexus_context import PlexusContext from mcp_plexus.oauth.decorators import requires_auth from mcp_plexus.services.decorators import requires_api_key logger = logging.getLogger(__name__) if PLEXUS_SERVER_INSTANCE is None: raise RuntimeError("PLEXUS_SERVER_INSTANCE not initialized when my_custom_tools.py was imported.") @PLEXUS_SERVER_INSTANCE.tool( name="get_tenant_specific_greeting", description="Returns a greeting specific to the current tenant.", allowed_tenant_ids=["mycompany", "another_tenant"] ) async def get_greeting(ctx: FastMCPBaseContext) -> Dict[str, str]: plexus_ctx: PlexusContext = PlexusContext(ctx.fastmcp) entity_id = plexus_ctx.entity_id user_id = plexus_ctx.persistent_user_id session_val = await plexus_ctx.get_session_value("my_key") greeting = f"Hello from entity \'{entity_id}\'!" if user_id: greeting += f" Authenticated user: {user_id}." if session_val: greeting += f" Session value for \'my_key\': {session_val}." return {"greeting": greeting} @PLEXUS_SERVER_INSTANCE.tool( name="get_my_github_repos", description="Fetches the user's GitHub repositories.", tool_sets=["developer_tools"], allowed_tenant_ids=["mycompany"] ) @requires_auth(provider_name="github", scopes=["repo", "read:user"]) async def get_my_github_repos( ctx: FastMCPBaseContext, *, _authenticated_client: httpx.AsyncClient ) -> List[Dict[str, Any]]: plexus_ctx = PlexusContext(ctx.fastmcp) logger.info(f"Fetching GitHub repos for user '{plexus_ctx.persistent_user_id}' in entity '{plexus_ctx.entity_id}'") response = await _authenticated_client.get("https://api.github.com/user/repos") response.raise_for_status() return response.json() ``` ``` -------------------------------- ### Run mcp_plexus Development Server Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Command to start the Uvicorn development server for the mcp_plexus application. The server host and port can be configured via the .env file. ```bash python run_dev.py ``` -------------------------------- ### Create External OAuth Provider CLI Command Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md This command registers an external OAuth provider with Plexus. It requires the entity ID, provider name, client credentials, authorization/token URLs, scopes, and userinfo URL. This setup allows tools to authenticate with third-party services. ```bash plexus admin ext-oauth create --entity-id "mycompany" --provider-name "github" --client-id "YOUR_GITHUB_CLIENT_ID" --client-secret "YOUR_GITHUB_CLIENT_SECRET" --authorization-url "https://github.com/login/oauth/authorize" --token-url "https://github.com/login/oauth/access_token" --scopes "repo,user:email" --userinfo-url "https://api.github.com/user" ``` -------------------------------- ### Create and Activate Python Virtual Environment Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Steps to create a Python virtual environment named 'venv' and activate it. Activation commands differ for Windows and macOS/Linux. ```bash python -m venv venv # On Windows .\venv\Scripts\activate # On macOS/Linux source venv/bin/activate ``` -------------------------------- ### Clone and Navigate mcp_plexus Repository Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Commands to clone the mcp_plexus repository from GitHub and change the directory into the newly created project folder. ```bash git clone https://github.com/Super-I-Tech/mcp_plexus mcp-plexus cd mcp-plexus ``` -------------------------------- ### Register Weather Tool with API Key and Tenant Scope (Python) Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md This Python code snippet demonstrates how to register a tool for fetching weather forecasts using the '@PLEXUS_SERVER_INSTANCE.tool' decorator. It specifies tool details, requires an API key via '@requires_api_key', and restricts access to specific tenants using 'allowed_tenant_ids'. The function 'get_weather' simulates fetching data and highlights how to access Plexus context and injected API keys. ```python import logging from typing import Dict, Any from mcp_plexus.context import PlexusContext from mcp_plexus.decorators import requires_api_key from mcp_plexus.fastmcp import FastMCPBaseContext from mcp_plexus.plexus_server import PLEXUS_SERVER_INSTANCE logger = logging.getLogger(__name__) WEATHER_API_PROVIDER_NAME = "openweathermap" @PLEXUS_SERVER_INSTANCE.tool( name="get_weather_forecast", description=f"Gets weather forecast using {WEATHER_API_PROVIDER_NAME}.", allowed_tenant_ids=["mycompany", "another_tenant"] ) @requires_api_key( provider_name=WEATHER_API_PROVIDER_NAME, key_name_display="OpenWeatherMap API Key", instructions="Please provide an API key for OpenWeatherMap." ) async def get_weather( ctx: FastMCPBaseContext, city: str, *, openweathermap_api_key: str # Injected by @requires_api_key ) -> Dict[str, Any]: plexus_ctx = PlexusContext(ctx.fastmcp) logger.info(f"Fetching weather for {city} for user '{plexus_ctx.persistent_user_id}' in entity '{plexus_ctx.entity_id}' using provided API key.") # Use openweathermap_api_key to call the external weather API # Example: weather_data = await httpx.get(f"api.openweathermap.org/data/2.5/weather?q={city}&appid={openweathermap_api_key}") return {"city": city, "temperature": "20C", "condition": "Sunny (mock data)"} logger.info("my_custom_tools.py - Tools registered with PLEXUS_SERVER_INSTANCE.") ``` -------------------------------- ### Defining MCP Tools with FastMCP Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md MCP Plexus leverages FastMCP's capabilities for defining MCP Tools, Resources, and Prompts using Pythonic decorators and classes. This snippet demonstrates defining a tool using `PLEXUS_SERVER_INSTANCE.tool()`. ```python from fastmcp import PlexusContext @PLEXUS_SERVER_INSTANCE.tool() def basic_tool(ctx: PlexusContext): ctx.log("Executing basic tool.") return "Hello from basic tool!" ``` -------------------------------- ### Initialize MCP Session Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Initializes an MCP session for a specific tenant's MCP endpoint. Requires authentication for Plexus users. ```APIDOC ## POST /{entity_id}/mcp/ ### Description Initializes an MCP session for a specific tenant's MCP endpoint. The server responds with an `Mcp-Session-Id` header. ### Method POST ### Endpoint `/{entity_id}/mcp/` ### Parameters #### Request Header - **Authorization** (string) - Required (for authenticated Plexus users) - Bearer token obtained from registration (e.g., `Bearer `). #### Request Body - **jsonrpc** (string) - Required - JSON-RPC version, should be "2.0". - **method** (string) - Required - The method to call, should be "initialize". - **id** (string) - Required - A unique identifier for the request. - **params** (object) - Required - Parameters for the initialize method. - **protocolVersion** (string) - Required - The desired protocol version (e.g., "2025-03-26"). - **capabilities** (object) - Optional - Client capabilities. - **clientInfo** (object) - Optional - Information about the client. - **name** (string) - Required - The name of the client application. - **version** (string) - Required - The version of the client application. ### Request Example ```json { "jsonrpc": "2.0", "method": "initialize", "id": "client-init-123", "params": { "protocolVersion": "2025-03-26", "capabilities": {}, "clientInfo": { "name": "MyHostApplicationClientName", "version": "1.0.0" } } } ``` ### Response #### Success Response (200) - **Mcp-Session-Id** (string) - A header containing the session ID, which must be included in subsequent requests. ``` -------------------------------- ### Register Host Application User Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Registers a user from your host application with MCP Plexus for a given tenant to enable persistent OAuth tokens across sessions. ```APIDOC ## POST /{entity_id}/plexus-auth/register-user ### Description Registers a user from your host application with MCP Plexus to enable persistent OAuth tokens across sessions. ### Method POST ### Endpoint `/{entity_id}/plexus-auth/register-user` ### Parameters #### Request Header - **X-Host-App-Secret** (string) - Required - Your host application registration secret. #### Request Body - **user_id_from_host_app** (string) - Required - A unique, stable user ID from your main application. ### Request Example ```json { "user_id_from_host_app": "unique_stable_user_id_from_your_main_app" } ``` ### Response #### Success Response (200) - **plexus_user_auth_token** (string) - A secure token for the user. - **persistent_user_id** (string) - The stable user ID from the host application. - **message** (string) - A confirmation message. #### Response Example ```json { "plexus_user_auth_token": "a_long_secure_token_string_for_this_user", "persistent_user_id": "unique_stable_user_id_from_your_main_app", "message": "User token processed successfully." } ``` ``` -------------------------------- ### User Authentication Registration Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Register a user with MCP Plexus to obtain a `plexus_user_auth_token`. ```APIDOC ## POST /{entity_id}/plexus-auth/register-user ### Description Registers a user from a host application with MCP Plexus. This endpoint returns a `plexus_user_auth_token` which links the host application's user to a persistent identity within Plexus. ### Method POST ### Endpoint `/{entity_id}/plexus-auth/register-user` ### Parameters #### Path Parameters - **entity_id** (string) - Required - The identifier for the tenant or entity. #### Request Body - **host_app_user_id** (string) - Required - The unique identifier of the user in the host application. - **email** (string) - Optional - The email address of the user. - **display_name** (string) - Optional - The display name of the user. ### Request Example ```json { "host_app_user_id": "host-user-123", "email": "user@example.com", "display_name": "John Doe" } ``` ### Response #### Success Response (200) - **plexus_user_auth_token** (string) - A token that uniquely identifies the user within Plexus. - **persistent_user_id** (string) - A persistent identifier for the user within Plexus. #### Response Example ```json { "plexus_user_auth_token": "plexus-auth-token-abc123", "persistent_user_id": "plexus-user-456" } ``` ``` -------------------------------- ### Define MCP Plexus Tool Module in Python Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Demonstrates how to define custom tools within MCP Plexus using Python modules. It utilizes the global PLEXUS_SERVER_INSTANCE to register tools and can enforce authentication and tenant restrictions. ```python import logging from typing import Dict, Any, Optional, List import httpx # Required for @requires_auth example from fastmcp import Context as FastMCPBaseContext # For type hinting standard ctx from mcp_plexus.core.global_registry import PLEXUS_SERVER_INSTANCE from mcp_plexus.plexus_context import PlexusContext # For specific Plexus context features from mcp_plexus.oauth.decorators import requires_auth from mcp_plexus.services.decorators import requires_api_key logger = logging.getLogger(__name__) if PLEXUS_SERVER_INSTANCE is None: # This check helps catch issues if tool modules are imported before PLEXUS_SERVER_INSTANCE is set raise RuntimeError("PLEXUS_SERVER_INSTANCE not initialized when my_custom_tools.py was imported.") @PLEXUS_SERVER_INSTANCE.tool( name="get_tenant_specific_greeting", description="Returns a greeting specific to the current tenant.", allowed_tenant_ids=["mycompany", "another_tenant"] # Tool only visible to these tenants ) async def get_greeting(ctx: FastMCPBaseContext) -> Dict[str, str]: plexus_ctx: PlexusContext = PlexusContext(ctx.fastmcp) # Create PlexusContext from base entity_id = plexus_ctx.entity_id user_id = plexus_ctx.persistent_user_id # Will be None for guest users session_val = await plexus_ctx.get_session_value("my_key") greeting = f"Hello from entity '{entity_id}'!" if user_id: greeting += f" Authenticated user: {user_id}." if session_val: greeting += f" Session value for 'my_key': {session_val}." return {"greeting": greeting} # Example: Tool requiring external GitHub OAuth @PLEXUS_SERVER_INSTANCE.tool( name="get_my_github_repos", description="Fetches the user's GitHub repositories.", tool_sets=["developer_tools"], # Categorize tool allowed_tenant_ids=["mycompany"] ) @requires_auth(provider_name="github", scopes=["repo", "read:user"]) async def get_my_github_repos( ctx: FastMCPBaseContext, *, # This enforces subsequent arguments as keyword-only _authenticated_client: httpx.AsyncClient ) -> List[Dict[str, Any]]: plexus_ctx = PlexusContext(ctx.fastmcp) logger.info(f"Fetching GitHub repos for user '{plexus_ctx.persistent_user_id}' in entity '{plexus_ctx.entity_id}'") response = await _authenticated_client.get("https://api.github.com/user/repos") response.raise_for_status() return response.json() ``` -------------------------------- ### Tenant Identification via URL Paths Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md MCP Plexus supports multi-tenancy by identifying tenants from URL paths. This pattern allows for isolated tenant management, including session management and, in the future, tenant-specific configurations. ```url /{entity_id}/mcp/ ``` -------------------------------- ### Registering Users with MCP Plexus Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md This endpoint allows host applications to register their users with MCP Plexus. It facilitates the process of obtaining a plexus_user_auth_token, which links a host application's user to a persistent identity within Plexus. This token is crucial for managing external OAuth tokens and API keys associated with the user. ```python POST /{entity_id}/plexus-auth/register-user ``` -------------------------------- ### Initialize MCP Session Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Initializes an MCP session by sending a JSON RPC request to the MCP endpoint. It requires authentication for Plexus users via a Bearer token and includes client information and desired protocol version. ```json { "jsonrpc": "2.0", "method": "initialize", "id": "client-init-123", "params": { "protocolVersion": "2025-03-26", "capabilities": {}, "clientInfo": { "name": "MyHostApplicationClientName", "version": "1.0.0" } } } ``` -------------------------------- ### Register Host Application User for MCP Plexus Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Registers a user from a host application with MCP Plexus for a given tenant, enabling persistent storage of OAuth tokens. Requires a host application secret for authentication and returns an MCP Plexus user authentication token. ```json { "user_id_from_host_app": "unique_stable_user_id_from_your_main_app" } ``` -------------------------------- ### OAuth 2.1 Authorization Code Grant with PKCE for Tools Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md The `@requires_auth` decorator in MCP tools initiates an OAuth 2.1 Authorization Code Grant with PKCE flow for external providers like GitHub. It handles the OAuth callback, token exchange, and secure storage of tokens, making an authenticated `httpx.AsyncClient` available through `PlexusContext`. ```python from fastmcp import PlexusContext from plexus.decorators import requires_auth @PLEXUS_SERVER_INSTANCE.tool() @requires_auth(provider_name="github", scopes=["repo"]) def my_github_tool(ctx: PlexusContext): # Use ctx.get_authenticated_client() to interact with GitHub client = ctx.get_authenticated_client() response = client.get("https://api.github.com/user") return response.json() ``` -------------------------------- ### API Key Submission Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Submit an API key for a specific provider to be securely stored. ```APIDOC ## POST /{entity_id}/plexus-services/api-keys ### Description Allows users to submit their API keys for external services. These keys are securely stored and can be injected into tools requiring access to those services. ### Method POST ### Endpoint `/{entity_id}/plexus-services/api-keys` ### Parameters #### Path Parameters - **entity_id** (string) - Required - The identifier for the tenant or entity. #### Request Body - **provider_name** (string) - Required - The name of the service provider (e.g., "GitHub"). - **key_name_display** (string) - Required - A user-friendly name for the API key (e.g., "GitHub Personal Access Token"). - **api_key** (string) - Required - The actual API key provided by the user. ### Request Example ```json { "provider_name": "GitHub", "key_name_display": "My GitHub PAT", "api_key": "ghp_YourSecretApiKeyHere" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the API key was successfully stored. #### Response Example ```json { "message": "API key for GitHub stored successfully." } ``` ``` -------------------------------- ### API Key Management Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md This section details the process and endpoint for users to submit API keys required by specific tools. The API key is securely stored and then injected into the tool upon subsequent calls. ```APIDOC ## POST /{entity_id}/plexus-services/api-keys ### Description Submits an API key for a specific service to be securely stored for user authentication with external services. ### Method POST ### Endpoint `/{entity_id}/plexus-services/api-keys` ### Parameters #### Path Parameters - **entity_id** (string) - Required - The unique identifier for the entity or tenant. #### Request Header - **Authorization** (string) - Required - Bearer token for Plexus user authentication (`Bearer `). #### Request Body - **provider_name** (string) - Required - The name of the service provider for which the API key is being submitted. - **api_key_value** (string) - Required - The actual API key value provided by the user. ### Request Example ```json { "provider_name": "my_service", "api_key_value": "users_actual_api_key_value" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the API key has been successfully stored. #### Response Example ```json { "message": "API key successfully stored." } ``` #### Error Response (400/401/403/404/500) - **error** (object) - Contains error details. - **code** (string) - Error code. - **message** (string) - Error message. ```json { "error": { "code": "API_KEY_SUBMISSION_FAILED", "message": "Failed to store API key. Please check your input and authorization." } } ``` ``` -------------------------------- ### External OAuth 2.1 Flow Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Endpoints and mechanisms for facilitating external OAuth 2.1 flows, including handling callbacks and managing tokens. ```APIDOC ## GET /{entity_id}/oauth/external_callback/{provider_name} ### Description Handles the callback from an external OAuth provider after the user has granted or denied access. This endpoint processes the authorization code or error response and manages the OAuth tokens. ### Method GET ### Endpoint `/{entity_id}/oauth/external_callback/{provider_name}` ### Parameters #### Path Parameters - **entity_id** (string) - Required - The unique identifier for the entity or tenant. - **provider_name** (string) - Required - The name of the external OAuth provider (e.g., 'google', 'github'). #### Query Parameters - **code** (string) - Optional - The authorization code received from the OAuth provider. - **state** (string) - Optional - The state parameter used to maintain state between the request and callback. - **error** (string) - Optional - Indicates an error occurred during the OAuth flow. - **error_description** (string) - Optional - A description of the error. ### Response #### Success Response (200 or 302 Redirect) - Typically redirects the user to a success page or back to the application with relevant information (e.g., via URL parameters or session). #### Response Example (Conceptual Redirect) ``` HTTP/1.1 302 Found Location: /application/success?token=... ``` #### Error Response (400/401/403/404/500) - Handles errors during the OAuth callback process, potentially redirecting to an error page or returning an error message. ``` -------------------------------- ### Generate Fernet Encryption Key Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Python command to generate a Fernet encryption key, which is critical for securing sensitive data stored by Plexus. The output should be placed in the .env file. ```bash python -c "from mcp_plexus.utils import generate_fernet_key; print(generate_fernet_key())" ``` -------------------------------- ### API Key Access Decorator and Submission Endpoint Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md This snippet demonstrates the Python decorator `@requires_api_key` used to protect tools requiring external API keys. It also shows the structure for submitting these API keys via a POST request to a dedicated endpoint. The system handles key storage, encryption, and injection into tool calls. ```python from plexus.decorators import requires_api_key @requires_api_key( provider_name="my_service", key_name_display="My Service API Key", instructions="Get your key from ..." ) def my_tool(my_service_api_key): # Tool logic using my_service_api_key pass # API Key Submission Endpoint (conceptual - actual implementation in Flask/FastAPI) # POST /{entity_id}/plexus-services/api-keys # Request Body: # { # "provider_name": "my_service", # "api_key_value": "users_actual_api_key_value" # } ``` -------------------------------- ### Plexus User Authentication Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md Endpoints related to Plexus user registration and authentication within a specific entity. ```APIDOC ## POST /{entity_id}/plexus-auth/register-user ### Description Registers a new Plexus user for the specified entity, obtaining a `plexus_user_auth_token` necessary for authenticating MCP requests. ### Method POST ### Endpoint `/{entity_id}/plexus-auth/register-user` ### Parameters #### Path Parameters - **entity_id** (string) - Required - The unique identifier for the entity or tenant. #### Request Body - **username** (string) - Required - The desired username for the Plexus user. - **password** (string) - Required - The password for the Plexus user. ### Request Example ```json { "username": "plexus_user_123", "password": "secure_password_123" } ``` ### Response #### Success Response (200) - **plexus_user_auth_token** (string) - The authentication token for the registered Plexus user. #### Response Example ```json { "plexus_user_auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." } ``` ``` -------------------------------- ### API Key Management for MCP Tools Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md The `@requires_api_key` decorator prompts users for API keys if not stored and injects the decrypted key into the tool function. API keys are securely encrypted at rest using `PLEXUS_ENCRYPTION_KEY` and stored persistently. Users can submit their keys via a dedicated endpoint. ```python from fastmcp import PlexusContext from plexus.decorators import requires_api_key @PLEXUS_SERVER_INSTANCE.tool() @requires_api_key(provider_name="my_service", key_name_display="MyService API Key", instructions="Please provide your MyService API key.") def my_api_key_tool(ctx: PlexusContext): api_key = ctx.get_api_key("my_service") # Use the api_key to interact with MyService return f"Using API key for MyService: {api_key[:5]}..." ``` ```python POST /{entity_id}/plexus-services/api-keys ``` -------------------------------- ### Decorate Tool Function with @requires_auth Source: https://github.com/super-i-tech/mcp_plexus/blob/main/README.md This Python decorator is used within a tool function to specify the external OAuth provider and the required scopes. When the tool is called, PlexusContext will check for a valid token and inject an authenticated httpx.AsyncClient if available. ```python from plexus.decorators import requires_auth @requires_auth(provider_name="github", scopes=["repo", "read:user"]) def my_tool(authenticated_client: httpx.AsyncClient): # Tool logic using the authenticated_client pass ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.