Skip to main content

MCP server for Comet ML API integration

Project description

Comet ML MCP Server

A comprehensive Model Context Protocol (MCP) server that provides tools for interacting with Comet ML API. This server enables seamless integration with Comet ML's experiment tracking platform through a standardized protocol.

Features

  • 🔧 MCP Server: Full Model Context Protocol implementation for tool integration
  • 📊 Experiment Management: List, search, and analyze experiments with detailed metrics
  • 📁 Project Management: Organize and explore projects across workspaces
  • 🔍 Advanced Search: Search experiments by name, description, and project
  • 📈 Session Management: Singleton comet_ml.API() instance with robust error handling

Installation

Prerequisites

  • Python 3.8 or higher
  • Comet ML account and API key

Install from Source

pip install comet-mcp --upgrade

Docker Installation (Alternative)

You can run the Comet MCP server using Docker to avoid installing Python dependencies on your system.

  1. Build the Docker image:

    docker build -t comet-mcp .
    
  2. Configure your MCP client (see Usage section below for configuration examples)

Configuration

The server uses standard comet_ml configuration:

  1. Using comet init; or
  2. 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

Core Comet ML Tools

  • list_experiments(workspace, project_name) - List recent experiments with optional filtering
  • get_experiment_details(experiment_id) - Get comprehensive experiment information including metrics and parameters
  • get_experiment_code(experiment_id) - Retrieve source code from experiments
  • get_experiment_metric_data(experiment_ids, metric_names, x_axis) - Get metric data for multiple experiments
  • get_default_workspace() - Get the default workspace name for the current user
  • list_projects(workspace) - List all projects in a workspace
  • list_project_experiments(project_name, workspace) - List experiments within a specific project
  • count_project_experiments(project_name, workspace) - Count and analyze experiments in a project
  • get_session_info() - Get current session status and connection information

Tool Features

  • Structured Data: All tools return properly typed data structures
  • Error Handling: Graceful handling of API failures and missing data
  • Flexible Filtering: Filter by workspace, project, or search terms
  • Rich Metadata: Includes timestamps, descriptions, and status information

Usage

1. MCP Server Mode

Run the server to provide tools to MCP clients:

# Start the MCP server
comet-mcp

The server will:

  • Initialize Comet ML session
  • Register all available tools
  • Listen for MCP client connections via stdio

2. Configuration File

Create a configuration for your AI system. For example:

Local Installation:

{
  "servers": [
    {
      "name": "comet-mcp",
      "description": "Comet ML MCP server for experiment management",
      "command": "comet-mcp",
      "env": {
        "COMET_API_KEY": "${COMET_API_KEY}"
      }
    }
  ]
}

Docker Installation (Alternative):

{
  "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"
      }
    }
  }
}

comet-mcp supports "stdio" and "sse" transport modes.

4. 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)

5. Integration with Opik for use, testing, and optimization

For complete details on testing this (or any MCP server) see examples/README.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

comet_mcp-1.2.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

comet_mcp-1.2.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file comet_mcp-1.2.0.tar.gz.

File metadata

  • Download URL: comet_mcp-1.2.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for comet_mcp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 ee7ec098c82a2e1adbfbd7f1b0ddbaeb4458b4f59f42a1ce9b5cd67ab908025b
MD5 2e9c5a75f6ccfc35f12d7278233f253a
BLAKE2b-256 4929a673e51c1fbb34d02d669f280211878215d7d8f89172ab493f1d43a989c9

See more details on using hashes here.

File details

Details for the file comet_mcp-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: comet_mcp-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for comet_mcp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fc365a5127208a9319c24dc574a1052087e1f73dfb15be52b9b9f7b90a4c449
MD5 5515c016ee0f650dcc41d8553a60f270
BLAKE2b-256 fba60c4798802dcd04e0489ba90717440e8dcc601ba952249eb50aed1116ac40

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page