Local MCP
The Local MCP (Model Context Protocol) deployment enables the OvalEdge MCP server to run as a local stdio subprocess using AUTH_MODE=local. In this mode, MCP clients such as Cursor and Claude Desktop communicate with the server through JSON-RPC over standard input and output streams.
The local deployment uses machine credentials to generate and manage OvalEdge JWT tokens for authenticated API communication. The deployment also supports automatic token refresh, retry handling, and centralized configuration management.
This document describes the installation, configuration, runtime architecture, execution methods, troubleshooting procedures, and security recommendations for Local MCP deployment.
Prerequisites
Ensure the following prerequisites are available before starting the installation:
Python 3.12 or later
Poetry package manager
Access to an OvalEdge environment
Valid OvalEdge machine credentials:
OVALEDGE_USER_TOKENOVALEDGE_USER_SECRET
Access to the following API endpoint:
/api/user/token/generate
macOS, Linux, or Windows operating system
Git repository containing the OvalEdge MCP source code
Local MCP Runtime Architecture
Local MCP mode uses machine credentials to obtain an OvalEdge JWT and execute authenticated API requests.
The runtime workflow is as follows:
The MCP client starts the stdio process using
poetry run oe-mcp-local.entrypoints/local.pyinitializes FastMCP withlocal_lifespan.The lifespan process calls
get_or_refresh_local_token().OvalEdge sends a JWT response through the
POST /api/user/token/generateAPI.The JWT is cached in memory and stored in
ContextVar.Tools use
OvalEdgeClientfor outbound API communication.The application validates token freshness before each request.
The application refreshes the token automatically when required.
The client invalidates the cache and retries the request once upon receiving a local
401response.
Local MCP Components
Entrypoint and Application Composition
entrypoints/local.py
Initializes the local FastMCP lifespan, token exchange process, and stdio transport
server/app.py
Defines tools, resources, prompts, static documentation, and shared FastMCP application components
Authentication and Token Lifecycle
server/auth/token_exchange.py
Handles token exchange, token refresh, token expiration validation, and cache invalidation
server/auth/context.py
Maintains current_oe_jwt ContextVar and local JWT cache
server/client.py
Validates local token availability and retries requests after local 401 responses
Configuration Management
server/config.py
Loads .env configuration values, including authentication mode, base URL, credentials, retry settings, and HTTP authentication scheme
Install Local MCP on macOS and Linux
Configure Script Permissions
Run the following command to provide execute permission for the setup script:
Run the Installation Script
Run the following command:
Installation Actions
The setup script performs the following actions:
Verifies the operating system and Python 3.12 or later.
Installs Poetry if it is not available.
Executes
poetry install.Creates the
.envfile from.env.exampleif the file does not exist.Performs a smoke import validation for
entrypoints.local.Displays an
mcp.jsonconfiguration snippet.
Run Developer Mode Installation
Run the following command to install development dependencies and validation utilities:
Install Local MCP on Windows
Run the PowerShell Installation Script
Run the following command:
Run Developer Mode Installation
Run the following command:
Configure Environment Variable
Configure the following variables in the .env file or through the MCP client environment configuration.
Optional Environment Variables
Configure MCP Client
Configure the mcp.json file as follows:
If the .env file already contains the required values, any additional environment variables in the mcp.json configuration can be omitted.
Restart the MCP client after modifying the configuration.
Run Local MCP Manually
Run the following command to start Local MCP manually:
Troubleshooting
TokenExchangeError with HTTP 200 and Empty Response
Possible causes:
Incorrect base URL
Login page intercepting API requests
Resolution steps:
Verify the configured base URL.
Confirm API routes support the following authorization format:
MCP Client Does Not Start the Server
Possible causes:
Poetry is unavailable in the system path
Invalid repository path
Incomplete dependency installation
Missing
AUTH_MODE=localconfiguration
Resolution steps:
Verify Poetry installation and system path configuration.
Verify the absolute repository path used with
-C.Run poetry
install.Verify the
AUTH_MODEconfiguration.
Security Recommendations
Follow the security recommendations below during Local MCP deployment:
Do not commit
OVALEDGE_USER_TOKEN or OVALEDGE_USER_SECRETvalues to source control repositories.Rotate credentials immediately if exposure occurs.
Use least-privilege OvalEdge service accounts for authentication.
Local MCP Directory Structure
entrypoints/local.py
Local stdio entrypoint
server/app.py
MCP application assembly
server/auth/*
Token exchange and authentication context
server/client.py
Outbound OvalEdge HTTP client
server/tools/*
MCP tools
server/resources/*
MCP resources
server/prompts/workflows.py
Workflow prompt definitions
scripts/setup_local_mcp.sh
macOS and Linux setup script
scripts/setup_local_mcp.ps1
Windows PowerShell setup script
Copyright © 2026, OvalEdge LLC, Peachtree Corners, GA, USA.
Last updated
Was this helpful?

