Opik MCP server

Interact and analyze your Opik enviroment including traces, telemetry and metrics with natural language.
Back to servers
Setup instructions
Provider
Comet
Release date
Mar 12, 2025
Language
Python
Stats
146 stars

Opik MCP Server implements the Model Context Protocol for the Opik platform, providing a unified interface to Opik's capabilities through multiple transport mechanisms. It enables seamless integration with compatible IDEs and provides standardized access to features like prompt management, project organization, and trace analysis.

Installation

Prerequisites

  • Node.js (version 20.11.0 or higher)
  • npm (comes with Node.js)

Manual Installation

# Clone the repository
git clone https://github.com/comet-ml/opik-mcp.git
cd opik-mcp

# Install dependencies and build
npm install
npm run build

Configuration

Create a configuration file based on the example:

cp .env.example .env
# Edit .env with your specific configuration

Usage

Starting the Server

You can start the server using either of the available transport options:

# Start with stdio transport (default)
npm run start:stdio

# Start with SSE transport for network access (experimental)
npm run start:sse

Note: SSE (Server-Sent Events) transport is currently experimental. For production use, the direct process execution approach is recommended.

Using the Makefile

The project includes a Makefile for common operations:

# Display all available commands
make help

# Start the server with stdio transport
make start-stdio

# Start the server with SSE transport (experimental)
make start-sse

# Run tests
make test

IDE Integration

Cursor Integration

To integrate with Cursor IDE, create a .cursor/mcp.json file in your project directory with the following configuration:

{
  "mcpServers": {
    "opik": {
      "command": "/path/to/node",
      "args": [
        "/path/to/opik-mcp/build/index.js",
        "--apiUrl",
        "https://www.comet.com/opik/api",
        "--apiKey",
        "YOUR_API_KEY",
        "--workspace",
        "default",
        "--debug",
        "true"
      ],
      "env": {
        "OPIK_API_BASE_URL": "https://www.comet.com/opik/api",
        "OPIK_API_KEY": "YOUR_API_KEY",
        "OPIK_WORKSPACE_NAME": "default"
      }
    }
  }
}

Replace:

  • /path/to/node with the path to your Node.js executable
  • /path/to/opik-mcp with the path to your opik-mcp installation
  • YOUR_API_KEY with your actual Opik API key

Transport Options

Standard Input/Output (stdio)

This transport is ideal for local integration where the client and server run on the same machine.

make start-stdio

Server-Sent Events (SSE)

This transport enables remote access and multiple simultaneous clients over HTTP.

make start-sse

Features

The MCP server provides access to these Opik platform features:

  • Prompts Management: Create, list, update, and delete prompts
  • Projects/Workspaces Management: Organize and manage projects
  • Traces: Track and analyze trace data
  • Metrics: Gather and query metrics data

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "opik" '{"command":"/path/to/node","args":["/path/to/opik-mcp/build/index.js","--apiUrl","https://www.comet.com/opik/api","--apiKey","YOUR_API_KEY","--workspace","default","--debug","true"],"env":{"OPIK_API_BASE_URL":"https://www.comet.com/opik/api","OPIK_API_KEY":"YOUR_API_KEY","OPIK_WORKSPACE_NAME":"default"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "opik": {
            "command": "/path/to/node",
            "args": [
                "/path/to/opik-mcp/build/index.js",
                "--apiUrl",
                "https://www.comet.com/opik/api",
                "--apiKey",
                "YOUR_API_KEY",
                "--workspace",
                "default",
                "--debug",
                "true"
            ],
            "env": {
                "OPIK_API_BASE_URL": "https://www.comet.com/opik/api",
                "OPIK_API_KEY": "YOUR_API_KEY",
                "OPIK_WORKSPACE_NAME": "default"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "opik": {
            "command": "/path/to/node",
            "args": [
                "/path/to/opik-mcp/build/index.js",
                "--apiUrl",
                "https://www.comet.com/opik/api",
                "--apiKey",
                "YOUR_API_KEY",
                "--workspace",
                "default",
                "--debug",
                "true"
            ],
            "env": {
                "OPIK_API_BASE_URL": "https://www.comet.com/opik/api",
                "OPIK_API_KEY": "YOUR_API_KEY",
                "OPIK_WORKSPACE_NAME": "default"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later