MCP TensorBoard
Enables GitHub Copilot in VS Code to access TensorBoard data for AI-assisted analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP TensorBoardWhat's the latest training loss from run experiment_1?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP TensorBoard
A Model Context Protocol (MCP) server that exposes TensorBoard data through a standardized API. Built with FastMCP, this server enables AI coding agents to query and analyze TensorBoard experiment data programmatically.
Features
Pure Python implementation - No subprocess or external binaries required
Multiple transports - stdio, Streamable HTTP, and SSE
Full TensorBoard support - Scalars, tensors, histograms, distributions, and images
Structured output - Pydantic models for type-safe, validated responses
AI-optimized - Compact data formats ideal for LLM consumption
Related MCP server: tb-query
Quickstart
Run directly from GitHub (no installation)
uvx --from git+https://github.com/1Kraks/mcp-tensorboard mcp-tensorboard --logdir /path/to/logsInstall with uv (recommended)
# Clone the repository
git clone https://github.com/1Kraks/mcp-tensorboard
cd mcp-tensorboard
# Create virtual environment and install
uv venv
source .venv/bin/activate # macOS/Linux
uv sync
# Run the server
uv run mcp-tensorboard --logdir /path/to/logsInstall with pip
pip install -e .
mcp-tensorboard --logdir /path/to/logsUsage
Command Line Options
mcp-tensorboard --logdir <path> [--transport stdio|http|sse] [--port PORT] [--host HOST] [--debug]Option | Default | Description |
| (required) | Path to TensorBoard logs directory |
|
| Transport protocol |
|
| Port for HTTP/SSE transport |
|
| Host for HTTP/SSE transport |
| off | Enable debug logging |
Environment Variables
TENSORBOARD_LOGDIR- Default log directory (alternative to--logdir)TENSORBOARD_LOGS- Alternative log directory variable
Available Tools
Run Management
Tool | Description |
| List all runs in the log directory |
Scalars
Tool | Description |
| List scalar tags for a run |
| Get time series for a scalar |
| Get multiple scalars in one call |
| Get the most recent scalar value |
Tensors
Tool | Description |
| List tensor tags for a run |
| Get time series for scalar tensors |
Histograms & Distributions
Tool | Description |
| List histogram tags |
| Get raw histogram data |
| List distribution tags (alias) |
| Get compressed distributions (recommended) |
Images
Tool | Description |
| List image tags |
| Get image references (blob keys) |
| Fetch image by blob key (returns base64) |
RL Reward Analysis (Stage 4)
Tool | Description |
| List all reward experiments with metadata |
| Get summary statistics for a reward experiment |
| Compare multiple reward functions side-by-side |
| Get training trajectories for analysis |
| Generate comprehensive analysis report |
Convergence Analysis
Tool | Description |
| Rank rewards by convergence speed (steps to threshold GC) |
| Get summary statistics for convergence analysis |
Convergence Metrics:
steps_to_threshold— First checkpoint where goal_completion >= thresholdgc_at_threshold— GC value at threshold step (tie-breaker for same-step convergence)converged— Whether threshold was reached
Usage Example:
{
"method": "tools/call",
"params": {
"name": "reward_rank_by_convergence",
"arguments": {
"reward_ids": ["reward_0001", "reward_0002", "reward_0003"],
"threshold": 0.95
}
}
}Ranking Logic:
Converged rewards ranked before non-converged
Among converged: lower steps = better (faster learning)
Tie-breaker: higher GC at threshold = better
Integration with Coding Agents
Claude Code
Option 1: Run from git (no install)
claude mcp add --transport http tensorboard-http \
uvx --from git+https://github.com/1Kraks/mcp-tensorboard mcp-tensorboard --logdir /path/to/logs --transport httpOption 2: Local installation
# Install globally or in a shared venv
pip install -e /path/to/mcp-tensorboard
# Add to Claude Code
claude mcp add tensorboard mcp-tensorboard --logdir /path/to/logsOption 3: Via Claude Code settings.json
Add to ~/.claude/settings.json:
{
"mcpServers": {
"tensorboard": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/1Kraks/mcp-tensorboard",
"mcp-tensorboard",
"--logdir",
"/path/to/logs"
]
}
}
}GitHub Copilot / VS Code
Add to VS Code settings.json:
{
"github.copilot.chat.mcp.servers": {
"tensorboard": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/1Kraks/mcp-tensorboard",
"mcp-tensorboard",
"--logdir",
"/path/to/logs"
]
}
}
}Cline (VS Code Extension)
Add to Cline's MCP settings:
{
"mcpServers": {
"tensorboard": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/1Kraks/mcp-tensorboard",
"mcp-tensorboard",
"--logdir",
"/path/to/logs"
]
}
}
}Cursor
Add to Cursor's MCP configuration:
{
"mcpServers": {
"tensorboard": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/1Kraks/mcp-tensorboard",
"mcp-tensorboard",
"--logdir",
"/path/to/logs"
]
}
}
}Generic MCP Client (Streamable HTTP)
For HTTP transport, run the server:
mcp-tensorboard --logdir /path/to/logs --transport http --port 8000Connect to http://localhost:8000/mcp from any MCP-compatible client.
Example Usage
List all runs
{
"method": "tools/call",
"params": {
"name": "tensorboard_list_runs",
"arguments": {}
}
}Get scalar training loss over time
{
"method": "tools/call",
"params": {
"name": "tensorboard_get_scalar_series",
"arguments": {
"run": ".",
"tag": "loss",
"max_points": 500
}
}
}Compare multiple metrics
{
"method": "tools/call",
"params": {
"name": "tensorboard_get_scalar_series_batch",
"arguments": {
"run": "experiment_1",
"tags": ["loss", "accuracy", "val_loss", "val_accuracy"],
"max_points": 200
}
}
}Get compressed distribution (AI-friendly)
{
"method": "tools/call",
"params": {
"name": "tensorboard_get_distribution_series",
"arguments": {
"run": ".",
"tag": "weights",
"max_points": 50
}
}
}Development
Setup
# Clone and set up environment
git clone https://github.com/1Kraks/mcp-tensorboard
cd mcp-tensorboard
uv venv
source .venv/bin/activate
uv sync --all-extrasRun tests
pytestRun with debug logging
mcp-tensorboard --logdir /path/to/logs --debugCode style
# Format code
ruff format .
# Lint
ruff check .Project Structure
mcp-tensorboard/
├── pyproject.toml # Project configuration
├── README.md # This file
├── src/mcp_tensorboard/
│ ├── __init__.py # Package init
│ ├── __main__.py # python -m entry point
│ ├── server.py # FastMCP server & tools
│ ├── data_reader.py # Pure Python event file reader
│ └── types.py # Pydantic response models
└── tests/
└── test_server.py # Unit testsTroubleshooting
No runs found
Ensure
--logdirpoints to the directory containing TensorBoard event filesEvent files are typically named
events.out.tfevents.*
Import errors
Run
uv syncorpip install -e .to install dependencies
HTTP transport not connecting
Verify the server is running:
curl http://localhost:8000/mcpCheck firewall settings for the specified port
Images not displaying
Image support requires Pillow:
pip install pillowSome TensorBoard image formats may not be supported
License
MIT License - See LICENSE file for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/1Kraks/mcp-tensorboard'
If you have feedback or need assistance with the MCP directory API, please join our Discord server