Opik MCP server

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

Opik MCP Server is an implementation of the Model Context Protocol for the Opik platform. It provides a unified interface for accessing Opik's capabilities, supporting multiple transport mechanisms for seamless integration with IDEs and offering standardized access to features like prompts management, projects organization, and metrics tracking.

Installation

Prerequisites

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

Setting Up the Server

# 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 by copying the example:

cp .env.example .env

Then edit the .env file with your specific configuration settings, including your Opik API key and workspace information.

Running the Server

You can start the MCP server using one of two transport mechanisms:

Standard Input/Output (Recommended)

Best for local integration where client and server run on the same machine:

npm run start:stdio

Server-Sent Events (Experimental)

For network access and multiple simultaneous clients:

npm run start:sse

Note: SSE transport is currently experimental and recommended only for testing purposes.

IDE Integration

Integrating with Cursor IDE

To use Opik MCP Server with Cursor IDE, create a configuration file in your project:

  1. Create a file at .cursor/mcp.json in your project directory
  2. Add 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 your Node.js executable path
  • /path/to/opik-mcp with your opik-mcp installation path
  • YOUR_API_KEY with your actual Opik API key

Using the Server

Once the server is running, you can:

  • Manage prompts (create, list, update, delete)
  • Organize and access projects/workspaces
  • Track and analyze trace data
  • Gather and query metrics

Command Line Utilities

The project includes a Makefile with helpful commands:

# Show all available commands
make help

# Run tests
make test

# Start with stdio transport
make start-stdio

# Start with SSE transport
make start-sse

Transport Options

Standard Input/Output

This transport method is ideal for local IDE integration:

make start-stdio

Server-Sent Events (SSE)

For remote access and multiple clients (experimental):

make start-sse

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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