This document explains how to integrate the Opik MCP server with Cursor IDE.
To use the Opik MCP server with Cursor IDE, you need to create a .cursor/mcp.json
file in your project root. This file tells Cursor how to start and configure the MCP server.
Here's a basic configuration to get started:
{
"mcpServers": {
"opik": {
"command": "node",
"args": [
"/path/to/build/index.js",
"--apiUrl", "https://www.comet.com/opik/api",
"--apiKey", "your-api-key",
"--workspace", "default"
]
}
}
}
Here's a comprehensive example with all available configuration options:
{
"mcpServers": {
"opik": {
"command": "node",
"args": [
"/absolute/path/to/build/index.js",
// API Configuration
"--apiUrl", "https://www.comet.com/opik/api",
"--apiKey", "your-api-key",
"--workspace", "default", // Use "default" unless you have created additional workspaces
// Deployment Configuration
"--selfHosted", "false",
// Debug Settings
"--debug", "false",
// MCP Server Configuration
"--mcpName", "opik-manager",
"--mcpVersion", "1.0.0",
"--mcpLogging", "false",
"--mcpDefaultWorkspace", "default",
// Tool Enablement (omit these to use defaults)
"--disablePromptTools", "false",
"--disableProjectTools", "false",
"--disableTraceTools", "false",
"--disableMetricTools", "false"
],
"env": {
// You can also set environment variables here if preferred
// "OPIK_API_KEY": "your-api-key"
}
}
}
}
You can also use environment variables instead of command-line arguments:
{
"mcpServers": {
"opik": {
"command": "node",
"args": [
"/path/to/build/index.js"
],
"env": {
"OPIK_API_BASE_URL": "https://www.comet.com/opik/api",
"OPIK_API_KEY": "your-api-key",
"OPIK_WORKSPACE_NAME": "default",
"MCP_TRANSPORT": "stdio"
}
}
}
}
If you want to use the SSE transport:
{
"mcpServers": {
"opik": {
"command": "node",
"args": [
"/path/to/build/cli.js",
"serve",
"--transport", "sse",
"--port", "3001"
],
"env": {
"OPIK_API_BASE_URL": "https://www.comet.com/opik/api",
"OPIK_API_KEY": "your-api-key",
"OPIK_WORKSPACE_NAME": "default"
}
}
}
}
-
Absolute Path: Make sure to use an absolute path to the
index.js
file to ensure Cursor can find it regardless of the working directory. -
Workspaces vs Projects: Do not confuse workspaces with projects:
- The workspace name is typically "default" for most users
- Project names (like "Therapist Chat") are NOT valid workspace names
- Using a project name as a workspace name will result in a 400 error from the API
-
Working with Specific Projects: When using the MCP tools, you can specify which project to work with by:
- Using the
projectId
parameter with the project's unique identifier - Using the
projectName
parameter with the project's human-readable name - If neither is specified, the server will use the first available project
- Using the
-
Environment Variables with Spaces: If your environment variables contain spaces, you need to be careful with quoting:
{
"mcpServers": {
"opik": {
"command": "node",
"args": [
"/path/to/build/index.js"
],
"env": {
"OPIK_WORKSPACE_NAME": "Workspace With Spaces"
}
}
}
}
After creating the configuration file:
- Open Cursor IDE
- Navigate to Settings > MCP
- Enable the Opik MCP in your Cursor settings
- Restart Cursor IDE if necessary
If you encounter issues with the MCP connection:
- Check the Cursor console logs for errors (Help > Toggle Developer Tools)
- Verify your API key and other configuration settings
- Ensure the server can be accessed from Cursor (if using SSE transport)
- Check for firewall or network issues (if using SSE transport)