1. Set Environment Variables

The MCP server requires the following environment variables to connect to your Opik Comet account:

  • OPIK_API_BASE_URL: Base URL for Opik API (https://www.comet.com/opik/api)
  • OPIK_WORKSPACE_NAME: Workspace name (default or your chosen workspace)
  • OPIK_API_KEY: Your personal Opik API key (your_api_key)

2. Install Meshagent

pip install "meshagent[all]"

3. Sign Up and Authenticate

Sign up and authenticate by following instructions at Meshagent CLI Getting Started.

4. Start an MCP Tool Service in a Meshagent Room

Run the following command to create an agent service in a Meshagent room (replace tokens as needed):

meshagent service test \
  --room=test \
  --role=agent \
  --image=meshagent/mcp-opik:latest \
  --env MESHAGENT_PORT=8001 \
  --env OPIK_API_BASE_URL=https://www.comet.com/opik/api \
  --env OPIK_WORKSPACE_NAME=default \
  --env OPIK_API_KEY=your_api_key \
  --port="num=8001 path=/webhook liveness=/ type=meshagent.callable" \
  --name=mcp-opik-service
  • This command starts a Meshagent room with the MCP server available and callable in the room.
  • Note: Rooms automatically close if they go inactive.

5. Join the Room as a Chatbot with the Opik Toolkit

Run the following command to launch a conversational chatbot agent with access to the Opik tools:

meshagent chatbot join \
  --room=test \
  --agent-name=sample \
  --name=sample \
  --toolkit=mcp-opik
  • The output will include a room link you can use in your browser to interact with the agent and tools.
  • Multiple agents and toolkits can be used in any room for collaborative workflows.

Tools Available

The Opik MCP server (as provided in this image) exposes the following tools for use in Meshagent Rooms and other MCP environments:

ToolShort Description
create-projectCreate a new project/workspace
create-promptCreate a new prompt
create-prompt-versionCreate a new version of a prompt
delete-projectDelete a project
delete-promptDelete a prompt
get-metricsGet metrics data
get-opik-examplesGet examples of how to use Opik Comet’s API for specific tasks
get-opik-helpGet contextual help about Opik Comet’s capabilities
get-opik-tracing-infoGet information about Opik’s tracing capabilities and how to use them
get-project-by-idGet a single project by ID
get-prompt-by-idGet a single prompt by ID
get-server-infoGet information about the Opik server configuration
get-trace-by-idGet a single trace by ID
get-trace-statsGet statistics for traces
list-projectsGet a list of projects/workspaces
list-promptsGet a list of Opik prompts
list-tracesGet a list of traces
update-projectUpdate a project
update-promptUpdate a prompt

Tool Details

create-project

Create a new project/workspace
Parameters:

  • name (string): Name of the project
  • description (string, optional): Description of the project
  • workspaceName (string, optional): Workspace name to use instead of the default

create-prompt

Create a new prompt
Parameters:

  • name (string): Name of the prompt

create-prompt-version

Create a new version of a prompt
Parameters:

  • commit_message (string): Commit message for the prompt version
  • name (string): Name of the original prompt
  • template (string): Template content for the prompt version

delete-project

Delete a project
Parameters:

  • projectId (string): ID of the project to delete
  • workspaceName (string, optional): Workspace name to use instead of the default

delete-prompt

Delete a prompt
Parameters:

  • promptId (string): ID of the prompt to delete

get-metrics

Get metrics data
Parameters:

  • endDate (string, optional): End date in ISO format (YYYY-MM-DD)
  • metricName (string, optional): Metric name to filter
  • projectId (string, optional): Project ID to filter metrics
  • projectName (string, optional): Project name to filter metrics
  • startDate (string, optional): Start date in ISO format (YYYY-MM-DD)

get-opik-examples

Get examples of how to use Opik Comet’s API for specific tasks
Parameters:

  • task (string): Task to get examples for (e.g., ‘create prompt’, ‘analyze traces’, ‘monitor costs’)

get-opik-help

Get contextual help about Opik Comet’s capabilities
Parameters:

  • topic (string): The topic to get help about (prompts, projects, traces, metrics, or general)
  • subtopic (string, optional): Optional subtopic for more specific help

get-opik-tracing-info

Get information about Opik’s tracing capabilities and how to use them
Parameters:

  • topic (string, optional): Specific tracing topic (e.g., ‘spans’, ‘distributed’, ‘multimodal’, ‘annotations’)

get-project-by-id

Get a single project by ID
Parameters:

  • projectId (string): ID of the project to fetch
  • workspaceName (string, optional): Workspace name to use instead of the default

get-prompt-by-id

Get a single prompt by ID
Parameters:

  • promptId (string): ID of the prompt to fetch

get-server-info

Get information about the Opik server configuration
Parameters:

  • random_string (string, optional): Dummy parameter

get-trace-by-id

Get a single trace by ID
Parameters:

  • traceId (string): ID of the trace to fetch
  • workspaceName (string, optional): Workspace name to use instead of the default

get-trace-stats

Get statistics for traces
Parameters:

  • endDate (string, optional): End date in ISO format (YYYY-MM-DD)
  • projectId (string, optional): Project ID to filter traces
  • projectName (string, optional): Project name to filter traces
  • startDate (string, optional): Start date in ISO format (YYYY-MM-DD)
  • workspaceName (string, optional): Workspace name to use instead of the default

list-projects

Get a list of projects/workspaces
Parameters:

  • page (number): Page number for pagination
  • size (number): Number of items per page
  • sortBy (string, optional): Sort projects by this field
  • sortOrder (string, optional): Sort order (asc or desc)
  • workspaceName (string, optional): Workspace name to use instead of the default

list-prompts

Get a list of Opik prompts
Parameters:

  • page (number): Page number for pagination
  • size (number): Number of items per page

list-traces

Get a list of traces
Parameters:

  • page (number): Page number for pagination
  • size (number): Number of items per page
  • projectId (string, optional): Project ID to filter traces
  • projectName (string, optional): Project name to filter traces
  • workspaceName (string, optional): Workspace name to use instead of the default

update-project

Update a project
Parameters:

  • projectId (string): ID of the project to update
  • description (string, optional): New project description
  • name (string, optional): New project name
  • workspaceName (string, optional): Workspace name to use instead of the default

update-prompt

Update a prompt
Parameters:

  • name (string): New name for the prompt
  • promptId (string): ID of the prompt to update

Meshagent and Resources


For additional information on MCP and Docker-based server launches, see the Anthropic Model Context Protocol article and Why is it safer to run MCP Servers with Docker?.