This project provides a FastAPI backend and browser-based portal for managing Model Context Protocol (MCP) sessions. The portal includes preconfigured Chrome DevTools MCP slots backed by XPRA remote desktops and can also connect to custom MCP servers.
- Python 3.10+
- An OpenAI-compatible API key exported as
OPENAI_API_KEY - Optional: Override the default Chrome MCP or XPRA hosts by setting
CHROME_MCP_HOST/CHROME_XPRA_HOST
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCopy .env.example to .env (or create .env) and populate the necessary values, or export them in your shell before starting the server.
cp .env.example .env # optional helper if you maintain an example fileAt minimum, the following variables are expected:
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini # optional, defaults to provider defaults when unset
OPENAI_BASE_URL=https://api.openai.com/v1 # optional
CHROME_MCP_HOST=10.160.13.110 # optional, defaults to 10.160.13.110
CHROME_XPRA_HOST=10.160.13.110 # optional, defaults to CHROME_MCP_HOSTStart the FastAPI application with Uvicorn:
uvicorn index:app --reload --host 0.0.0.0 --port 8000Then open http://localhost:8000 in your browser. The portal lists available MCP collections, allows creating sessions, submitting prompts, and embeds the XPRA remote desktops for active sessions.
The same server exposes a JSON API that the portal consumes. Useful endpoints include:
GET /health– basic health checkGET /collections– list registered MCP collections and slotsPOST /sessions– create a new session from a collection or custom MCP URLPOST /sessions/{session_id}/tasks– run a task against an active session
Refer to index.py for the complete list of routes and payload formats.
- Static assets live in
static/and templates intemplates/. - Modify
ai_mcp_portal/session_manager.pyto customize session allocation or integrate an alternative persistence layer. - Run
python -m compileall .or your preferred test suite before committing changes.