PyTorch Lightning MCP Server
Provides tools for training, inspecting, validating, testing, predicting, and checkpointing PyTorch Lightning models.
Click on "Deploy 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., "@PyTorch Lightning MCP Server train a ResNet-18 on CIFAR-10 dataset"
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.
PyTorch Lightning MCP Server
A minimal integration layer exposing PyTorch Lightning via a structured, machine-readable API for tools, agents, and orchestration systems.
Features
Structured APIs for training, inspecting, validating, testing, predicting, and checkpointing models
PyTorch Lightning execution
Stdio and HTTP server modes
Related MCP server: mcp-server-lightning-exec
Requirements
Python 3.10–3.12
PyTorch Lightning (compatible version)
uv (recommended for dependency management)
Installation
curl -Ls https://astral.sh/uv/install.sh | sh
git clone https://github.com/<your-org>/lightning-mcp.git
cd lightning-mcp
uv sync --all-extrasUsage
CLI
You can run the MCP server via CLI:
# Stdio server (default)
uv run lightning-mcp
# HTTP server
uv run lightning-mcp --http --host 0.0.0.0 --port 3333Stdio Example
echo '{"id":"1","method":"lightning.inspect","params":{"what":"environment"}}' | uv run lightning-mcpHTTP Example
curl -X POST http://localhost:3333/mcp \
-H "Content-Type: application/json" \
-d '{"id":"1","method":"lightning.inspect","params":{"what":"environment"}}'Available Tools
The MCP server exposes the following tools (methods):
lightning.train
Train a PyTorch Lightning model with explicit configuration.
Input schema:
{
"model": {"_target_": "string", ...},
"trainer": { ... }
}lightning.inspect
Inspect a model or the runtime environment.
Input schema:
{
"what": "model | environment | summary",
"model": {"_target_": "string", ...} // required for model inspection
}lightning.validate
Validate a PyTorch Lightning model.
Input schema:
{
"model": {"_target_": "string", ...},
"trainer": { ... }
}lightning.test
Test a PyTorch Lightning model.
Input schema:
{
"model": {"_target_": "string", ...},
"trainer": { ... }
}lightning.predict
Run prediction/inference with a PyTorch Lightning model.
Input schema:
{
"model": {"_target_": "string", ...},
"trainer": { ... }
}lightning.checkpoint
Manage model checkpoints: save, load, or list.
Input schema:
{
"action": "save | load | list",
"path": "string", // for save/load
"directory": "string", // for list
"model": { ... } // for save/load
}Tool Discovery
To list all available tools and their schemas at runtime:
echo '{"id":"1","method":"tools/list","params":{}}' | uv run lightning-mcpTesting
uv run pytestContributing
See CONTRIBUTING.md and DEVELOPMENT.md.
License
Apache 2.0
Available Tools
6 toolslightning.checkpointB
Manage model checkpoints: save, load, or list.
Inputs: action (required), path, model, directory.
lightning.inspectC
Inspect models or runtime environment.
Inputs: what (required), model.
lightning.predictB
Run prediction/inference with a PyTorch Lightning model.
Inputs: model (required), trainer.
lightning.testC
Test a PyTorch Lightning model.
Inputs: model (required), trainer.
lightning.trainC
Train a PyTorch Lightning model with explicit configuration.
Inputs: model (required), trainer.
lightning.validateC
Validate a PyTorch Lightning model.
Inputs: model (required), trainer.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct stage of the PyTorch Lightning model lifecycle (train, validate, test, predict, checkpoint, inspect), with no overlap in functionality.
All tools follow a consistent 'lightning.<action>' pattern (e.g., lightning.train, lightning.test), making it easy to infer purpose from name.
6 tools cover the essential operations for a PyTorch Lightning workflow without being excessive or insufficient.
The set covers the main lifecycle stages, though advanced features like hyperparameter tuning or model export are absent; still satisfactory for core usage.
Maintenance
Related MCP Connectors
Discover, compare, route, and execute machine-accessible capabilities for AI agents.
Build, validate, deploy — HTTP APIs, cron jobs, webhooks and MCP tools — from your AI client.
Turn any task into the right API calls: discover, evaluate, and integrate public APIs.
Build, validate, and deploy multi-agent AI solutions from any AI environment.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA modular, extensible FastAPI-based platform that aggregates multiple AI tools and microservices into a unified interface with standardized I/O formats, perfect for frontend integration or LLM system orchestration.4MIT
- AlicenseNot gradedqualityDmaintenanceEnables MCP-compatible assistants to execute Python code, files, and notebooks on Lightning.ai GPU Studios (T4, L4, A10G, A100, or CPU) without local GPU hardware.MIT
- FlicenseNot gradedqualityCmaintenanceEnables autonomous agents and multi-agent frameworks to discover and execute modular, class-based tools over SSE with a standardized response contract.-
- AlicenseCqualityBmaintenanceExposes safe JSON contracts for validating and preparing datasets, running supervised fine-tuning, preference learning, RL, distillation, and evaluation, and managing checkpoints and exports through the Tinker SDK and Cookbook. It lets agents discover models and Hugging Face datasets, plan and execute training recipes, compare experiments, and export selected models.48Apache 2.0