swanlab-mcp
Enables read-only access to SwanLab workspaces, projects, runs, and metrics through the Model Context Protocol.
README
<div align="center">
SwanLab MCP Server
</div>
A Model Context Protocol (MCP) server implementation for SwanLab, combining SwanLab-OpenAPI & FastMCP.
✨ Features
Core Features
- Workspace Queries - List accessible workspaces and enumerate workspace projects
- Project Queries - List projects and inspect a specific project with run summaries
- Run Queries - Inspect runs with normalized fields (
id,state,profile,user) - Metric Queries - Fetch metric tables with consistent
columns,rows, andtotal - API Integration - Provide read-only access through SwanLab OpenAPI (
swanlab.Api)
Tech Stack
- Language: Python 3.12+
- Core Framework: FastMCP (v2.14.4+)
- API Client: SwanLab SDK
- Config Management: Pydantic Settings
🚀 Quick Start
❗️Configuration
Add the following configuration to your relative mcp config list
{
"mcpServers":
...
{
"swanlab-mcp": {
"command": "uvx",
"args": ["--from", "swanlab-mcp", "swanlab_mcp", "--transport", "stdio"],
"env": {
"SWANLAB_API_KEY": "your_api_key_here"
}
}
}
}
For Claude Code Users, you can config like this:
claude mcp add --env SWANLAB_API_KEY=<your_api_key> -- swanlab_mcp uvx --from swanlab-mcp swanlab_mcp --transport stdio
Prerequisites
- Python >= 3.12
- SwanLab API Key (get it from SwanLab)
Installation
# Using uv (recommended)
uv sync
# Or using pip
pip install -e .
Configuration
Environment Variables
Create a .env file and configure your API key:
cp .env.template .env
Edit the .env file:
SWANLAB_API_KEY=your_api_key_here
Running
# Using stdio transport (default)
python -m swanlab_mcp
# Or using CLI
python -m swanlab_mcp --transport stdio
# Check version
python -m swanlab_mcp --version
Usage
After configuration, restart Claude Desktop to interact with SwanLab via the MCP protocol.
Available Tools:
swanlab_list_workspaces- List workspacesswanlab_get_workspace- Get workspace detailsswanlab_list_projects_in_workspace- List projects in one workspaceswanlab_list_projects- List projectsswanlab_get_project- Get project detailsswanlab_list_runs_in_project- List runs in one projectswanlab_list_runs- List runs with optional filters (state,config.*)swanlab_get_run- Get run detailsswanlab_get_run_config- Get run configswanlab_get_run_metadata- Get run metadataswanlab_get_run_requirements- Get run requirementsswanlab_list_run_metric_keys- List available metric keys for a runswanlab_get_run_metrics- Get run metric table
Resource Definitions:
- workspace: collection of projects (
PERSONorTEAM) identified byusername. - project: collection of runs identified by
path = username/project_name. - run: single experiment identified by
path = username/project_name/experiment_id. - metric: tabular run history returned as
{path, keys, x_axis, sample, columns, rows, total}.
🛠️ Development
Code Formatting
# Using Makefile
make format
# Or manually
uvx isort . --skip-gitignore
uvx ruff format . --quiet
Lint Check
uvx ruff check .
Pre-commit Hooks
bash scripts/install-hooks.sh
📚 References & Acknowledgements
- SwanLab
- Model Context Protocol
- FastMCP v2
- modelscope-mcp-server
- TrackIO-mcp-server
- Simple-Wandb-mcp-server
📄 License
MIT License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.