Minimal MCP server that exposes a persistent bash session via a sandboxed executor. Includes OAuth 2.1 (auth code + PKCE) and SQLite-backed persistence for codes/tokens.
- Copy the example config and edit values:
cp config.env.example config.env- Build:
make build- Run:
./run.shThe MCP endpoint is available at:
http(s)://<host>/mcp
The legacy exec endpoint remains at:
http(s)://<host>/exec
All configuration lives in config.env (loaded by run.sh).
Core settings:
LISTEN_ADDR– address/port to bind (e.g.0.0.0.0:8002)MAX_OUTPUT_CHARSEXECUTOR_PATH
Sandbox settings (executor):
WRITE_ALLOW– colon-separated allowed write pathsBIND_TCP_ALLOW– colon-separated allowed bind portsALLOW_OUTGOING_TCP–true/falseBASH_PATH
Set AUTH_MODE to one of:
api_key– default, usesAPI_KEYas Bearer tokenoauth– OAuth 2.1 authorization code + PKCEany– accept either API key or OAuthnone– no auth
This project includes a minimal OAuth provider with a login form. It requires SQLite for persistence.
Required (when OAuth is enabled):
OAUTH_CLIENT_IDOAUTH_REDIRECT_URIS– space-separated list of allowed redirect URIsOAUTH_SQLITE_PATH– path to SQLite file (e.g../oauth.sqlite)OAUTH_USERNAME/OAUTH_PASSWORD– credentials for the login form
Optional:
OAUTH_ALLOWED_SCOPES– space-separated scopesOAUTH_TOKEN_TTL_SECONDSOAUTH_CODE_TTL_SECONDSPUBLIC_URL– external URL if behind a proxyAUTH_SERVER_URL– override OAuth issuer URL (defaults toPUBLIC_URL)
OAuth endpoints:
/.well-known/oauth-protected-resource/.well-known/oauth-authorization-server/oauth/authorize/oauth/token
- ChatGPT requires OAuth 2.1 auth code + PKCE (client credentials are not supported).
- Configure static client credentials in ChatGPT and set
OAUTH_CLIENT_IDto match. This server accepts public clients only (no client secret). - Ensure
PUBLIC_URLis set if running behind a proxy, and thatOAUTH_REDIRECT_URISincludes ChatGPT’s redirect URI.
make testThe test suite builds server/executor and runs sandbox behavior checks.
cmd/server– HTTP/MCP servercmd/executor– sandboxed executorinternal/mcp– MCP JSON-RPC handlerinternal/auth– OAuth + auth middleware