Comet ML MCP Server¶
The Comet ML MCP Server provides a Model Context Protocol (MCP) server that enables AI systems to interact with Comet ML API through standardized MCP tools. This server allows you to access experiments, projects, metrics, and other Comet data programmatically from MCP-compatible clients.
Install the MCP Server¶
To use the Comet ML MCP Server in Cursor:
Configure Cursor:
Open Cursor settings and add the MCP server configuration. In your Cursor MCP settings file (typically ~/.cursor/mcp.json or similar), add:
{
"mcpServers": {
"comet-mcp": {
"command": "uvx",
"args": ["comet-mcp"],
"env": {
"COMET_API_KEY": "your_api_key_here",
"COMET_WORKSPACE": "your_workspace_name"
}
}
}
}
Restart Cursor to load the MCP server configuration.
Note
This uses uvx to run the MCP server without requiring a global installation. Make sure you have uv installed on your system.
To run the Comet ML MCP Server locally:
Install the package:
pip install comet-mcp --upgradeSet environment variables:
export COMET_API_KEY=your_comet_api_key_here export COMET_WORKSPACE=your_workspace_nameStart the server:
comet-mcp
The server will initialize and listen for MCP client connections via stdio.
You can also run the Comet MCP server using Docker to avoid installing Python dependencies on your system:
Clone the repository:
git clone https://github.com/comet-ml/comet-mcp.git cd comet-mcpBuild the Docker image:
docker build -t comet-mcp .Configure your MCP client (see Usage section below for configuration examples)
Configuration¶
The server uses standard Comet ML configuration. You can configure it using:
- Using
comet init; or - Using environment variables
Example:
export COMET_API_KEY=your_comet_api_key_here
# Optional: Set default workspace (if not provided, uses your default)
export COMET_WORKSPACE=your_workspace_name
Available Tools¶
The Comet ML MCP Server provides the following tools for interacting with Comet:
Experiment Management¶
list_experiments(workspace, project_name)- List recent experiments with optional filtering by workspace and projectget_experiment_details(experiment_id)- Get comprehensive experiment information including metrics, parameters, and metadataget_experiment_code(experiment_id)- Retrieve source code from experimentsget_experiment_metric_data(experiment_ids, metric_names, x_axis)- Get metric data for multiple experiments
Project Management¶
get_default_workspace()- Get the default workspace name for the current userlist_projects(workspace)- List all projects in a workspacelist_project_experiments(project_name, workspace)- List experiments within a specific projectcount_project_experiments(project_name, workspace)- Count and analyze experiments in a project
Session Management¶
get_session_info()- Get current session status and connection information
All tools return properly typed data structures with graceful error handling for API failures and missing data.
Usage¶
Command-line Options¶
usage: comet-mcp [-h] [--transport {stdio,sse}] [--host HOST] [--port PORT]
Comet ML MCP Server
options:
-h, --help show this help message and exit
--transport {stdio,sse}
Transport method to use (default: stdio)
--host HOST Host for SSE transport (default: localhost)
--port PORT Port for SSE transport (default: 8000)
The comet-mcp server supports both "stdio" and "sse" transport modes.
MCP Client Configuration¶
Create a configuration for your MCP client. For example:
Local Installation:
{
"mcpServers": {
"comet-mcp": {
"command": "comet-mcp",
"env": {
"COMET_API_KEY": "${COMET_API_KEY}"
}
}
}
}
Docker Installation:
{
"mcpServers": {
"comet-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"COMET_API_KEY",
"-e",
"COMET_WORKSPACE",
"comet-mcp",
"comet-mcp",
"--transport",
"stdio"
],
"env": {
"COMET_API_KEY": "your_api_key_here",
"COMET_WORKSPACE": "your_workspace_name"
}
}
}
}