In this tutorial you'll configure the Panel Live Server MCP server so that an AI assistant can create interactive visualizations on your behalf using natural language. By the end, you'll have asked an AI to produce a chart and seen it rendered live in your IDE.
- Panel Live Server installed, see Installation
- Familiarity with snippets and execution methods, see Standalone Server
- An MCP-compatible AI assistant: Claude Code, Claude Desktop, GitHub Copilot (VS Code), or similar
See Installation → Connect to your MCP client for the full setup instructions for VS Code, Cursor, Claude Desktop, Claude Code, and claude.ai.
!!! note
When the MCP server starts, it automatically starts the Panel server in the background.
You do not need to run pls serve separately. If you have a standalone pls serve running,
stop it first as both use port 5077 by default.
Ask your AI assistant:
List your available MCP tools.
You should see four tools in the response:
list_packages: lists what is installed in the server environmentvalidate: checks code before anything is renderedshow: renders the visualization and returns a live URLscreenshot: takes a picture of an already-rendered visualization so the AI can answer questions about how it looks
Download the Palmer Penguins dataset
and save it as penguins.csv. Then ask your AI:
My dataset is penguins.csv. Show the distribution of the 'species' column as an interactive bar chart. Use the show tool.
Your AI will typically call validate first to check the code, then show to render it.
You'll see a response like:
Visualization created successfully!
View at: http://localhost:5077/view?id=...
Click the URL (or the inline MCP App panel if your client supports it) to see the chart.
!!! note
Inline preview support depends on the MCP client. Some clients permit the embedded iframe,
while others block localhost origins and require opening the visualization in your browser.
!!! tip "Prompting tips"
Mentioning the show tool explicitly ("use the show tool") ensures the AI uses it rather
than describing the code. In VS Code you can reference it as #show.
Continue the conversation:
Show me a scatter plot of 'flipper_length_mm' vs 'body_mass_g', colored by species.
The AI will produce a new visualization with a color-coded scatter plot, interactive tooltips, zoom, and pan.
Now ask something that can only be answered by looking at the chart, not by reading the code:
Which species has the widest spread of body mass in that scatter plot?
The AI cannot open a browser, so to answer correctly it calls screenshot on the snippet it
just created, gets back a picture of the rendered chart, and reads the answer off the image.
!!! note "Why this matters"
Plots are not the same as the raw data: heatmaps can flip row order, axes get inverted,
categories get sorted, and histograms bin values. Reasoning from the code alone often gives
a different answer than what the chart actually shows. screenshot lets the AI check the
real rendered output instead of guessing.
Ask the AI to create a full Panel application:
Create an interactive dashboard for the penguins dataset with a dropdown to filter by species and an island selector. Show a scatter plot that updates when the filters change.
The AI will use the server execution method and produce a reactive Panel app with widgets.
The dashboard updates in real time as you interact with it.
If the result isn't what you expected, continue the conversation:
- "Color the points by island instead"
- "Add a trend line"
- "Show only penguins with body mass greater than 4000g"
- "Display the scatter plot and a histogram side by side"
Each message creates a new visualization. Previous ones remain accessible at their URLs.
Ask your AI:
List available packages. Use the list_packages tool.
Or filter by name:
Is plotly available? Use list_packages.
If a package you need is missing, see Installation
for how to add it with --with.
A typical AI-assisted session looks like this:
- The AI calls
validateto check the code (syntax, security, package availability, Panel extensions, and a runtime test run) - The AI calls
show, which sends the code to the Panel server via the REST API - The Panel server stores and executes the snippet, returning a URL
- The URL is shown to you, click it to open the live visualization
- If you ask a question about how the result looks, the AI calls
screenshotto see it before answering
See Architecture for the full picture.
Verify the MCP server started successfully. Check your AI client's MCP server logs for startup
errors. If pls is not on PATH inside the MCP process, use the full path:
{ "command": "/home/user/.local/bin/pls", "args": ["mcp"] }The error message is returned to the AI. Ask it to fix the issue, it has the full error context. Or start with a simpler snippet to confirm the server is working:
Show
1 + 1using the show tool.
If Claude Desktop logs an error in the client console like:
Framing 'http://localhost:5077/' violates the following Content Security Policy directive: "frame-src 'self' blob: data:".
then the visualization URL is valid, but Claude Desktop refused to embed it inline. This is a
Claude Desktop host restriction on iframe origins. Open the returned http://localhost:5077/view?id=...
URL in your browser instead.
The server runs in an isolated uv tool environment. Install missing packages as described in Installation.
The screenshot tool needs the Chromium browser that Playwright manages, which is
not installed automatically. Install it once with:
pls install-browserThis downloads Chromium into the same environment that runs pls. See
Installation → Enable the screenshot tool
for the per-installer command.
- Configure the Panel Live Server MCP server for your AI assistant
- Ask the AI to create visualizations using natural language
- Ask a follow-up question about a visualization's appearance and have the AI check with
screenshot - Iterate on visualizations through conversation
- Check available packages with the
list_packagestool
- Configure the server: custom port, transport, Jupyter proxy
- Architecture: understand the MCP + Panel server design
- Examples: copy-paste snippets to try with your AI