Configure Panel Live Server¶
This guide shows you how to configure Panel Live Server, the Panel web server that executes Python code snippets and renders interactive visualizations.
Prerequisites¶
- Panel Live Server installed, see Installation
Default Configuration¶
Panel Live Server runs on localhost with sensible defaults. No configuration file is
required for local use.
| Setting | Default | Description |
|---|---|---|
| Port | per-environment (base 5077) |
Panel server port, derived from the active interpreter unless PANEL_LIVE_SERVER_PORT is set. Each Python environment gets its own port so servers in different environments do not collide. |
| Host | localhost |
Server host address |
| Database | ~/.panel-live-server/snippets/snippets.db |
SQLite database path |
| Max restarts | 3 |
Maximum automatic restarts on failure |
Configure via Environment Variables¶
All settings are controlled through environment variables:
macOS / Linux:
export PANEL_LIVE_SERVER_PORT=9999
export PANEL_LIVE_SERVER_HOST=127.0.0.1
export PANEL_LIVE_SERVER_DB_PATH=/data/my-snippets.db
export PANEL_LIVE_SERVER_MAX_RESTARTS=5
Windows (PowerShell):
$env:PANEL_LIVE_SERVER_PORT="9999"
$env:PANEL_LIVE_SERVER_HOST="127.0.0.1"
$env:PANEL_LIVE_SERVER_DB_PATH="C:\data\my-snippets.db"
$env:PANEL_LIVE_SERVER_MAX_RESTARTS="5"
Windows (Command Prompt):
set PANEL_LIVE_SERVER_PORT=9999
set PANEL_LIVE_SERVER_HOST=127.0.0.1
set PANEL_LIVE_SERVER_DB_PATH=C:\data\my-snippets.db
set PANEL_LIVE_SERVER_MAX_RESTARTS=5
Then start the server, in standalone mode:
Or in MCP mode:
Configure via CLI Flags¶
Alternatively, pass settings directly to pls serve:
Run pls serve --help for the full list of options.
Running as an MCP Server¶
To use Panel Live Server with AI assistants, start it in MCP mode:
# stdio transport (default, for Claude Desktop, Claude Code, etc.)
pls mcp
# HTTP transport
pls mcp --transport http --host 127.0.0.1 --port 8001
# SSE transport
pls mcp --transport sse
The Panel server starts automatically in the background. You do not need to run pls serve
separately.
For per-client setup instructions (VS Code, Cursor, Claude Desktop, Claude Code, claude.ai) see Installation → Connect to your MCP client.
Example: Custom port via environment variable¶
{
"mcpServers": {
"panel-live-server": {
"command": "/path/to/pls",
"args": ["mcp"],
"env": {
"PANEL_LIVE_SERVER_PORT": "9999"
}
}
}
}
External URL and Remote Environments¶
Panel Live Server needs to know its public URL when running behind a proxy or tunnel so that visualization URLs returned to clients are reachable from the browser.
The following environment variables are detected automatically (in priority order):
| Variable(s) | Environment |
|---|---|
PANEL_LIVE_SERVER_EXTERNAL_URL |
Any, explicit port-inclusive override |
JUPYTERHUB_HOST + JUPYTERHUB_SERVICE_PREFIX |
JupyterHub with jupyter-server-proxy |
CODESPACE_NAME + GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN |
GitHub Codespaces |
claude.ai¶
claude.ai requires a public URL. Expose the Panel server via a tunnel (Cloudflare, ngrok, localhost.run, etc.) and set the URL before starting the MCP server:
Copy the printed URL and set it.
macOS / Linux:
Windows (PowerShell):
Then start the MCP server:
See the MCP server tutorial for the full three-terminal setup.
JupyterHub¶
JUPYTERHUB_SERVICE_PREFIX is set automatically by JupyterHub. However, JUPYTERHUB_HOST
is only set automatically in subdomain-based routing mode. In the more common path-based
routing mode, set it manually in your MCP configuration:
{
"mcpServers": {
"panel-live-server": {
"command": "pls",
"args": ["mcp"],
"env": {
"JUPYTERHUB_HOST": "https://your-hub.example.com"
}
}
}
}
Or set the full URL explicitly.
macOS / Linux:
Windows (PowerShell):
GitHub Codespaces¶
URL detection is automatic, no configuration needed.
Custom Database Location¶
By default the SQLite database is stored at ~/.panel-live-server/snippets/snippets.db.
To use a different location.
macOS / Linux:
Windows (PowerShell):
Or via CLI:
Configuring Auto-Restart Behaviour¶
Panel Live Server automatically restarts the Panel subprocess if it becomes unhealthy, up to
max_restarts times. Adjust this limit.
macOS / Linux:
Windows (PowerShell):
Set to 0 to disable automatic restarts.
Troubleshooting¶
Port Already in Use¶
Change the port:
Or find and stop the process using the port.
macOS / Linux:
Windows (PowerShell):
Windows (Command Prompt):
Server Not Responding¶
Check server health:
Or query the health endpoint directly:
On Windows (PowerShell), curl is aliased to Invoke-WebRequest, which needs -UseBasicParsing
on older versions:
A healthy server returns {"status": "ok", ...}.
Visualizations Not Displaying¶
- Confirm the server is running:
pls status - Check that
showis listed when you ask your AI assistant for available MCP tools - Restart the MCP server if the Panel subprocess failed to start (check startup logs)
Next Steps¶
- Architecture: understand how the components fit together
- Installation Tutorial: create your first visualization
- API Reference: full reference documentation