Optuna MCP Server

by optuna

Not rated
GitHub

About

Automate optimization and analysis using Optuna.

Details

Author
optuna
Categories
Developer Tools

Setup

Install Optuna MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/optuna/optuna-mcp

Follow the installation instructions in the repository README, then restart your MCP client.

AModel Context Protocol (MCP)server that automates optimization and analysis usingOptuna.

The Optuna MCP Server can be used in the following use cases, for example.

- Automated hyperparameter optimization by LLMs
- Interactive analysis of Optuna's optimization results via chat interface
- Optimize input and output of other MCP tools

The Optuna MCP server can be installed usinguvor Docker. This section explains how to install the Optuna MCP server, using Claude Desktop as an example MCP client.

Before starting the installation process, installuvfromAstral.

Then, add the Optuna MCP server configuration to the MCP client. To include it in Claude Desktop, go to Claude > Settings > Developer > Edit Config >claude_desktop_config.jsonand add the following:

{ "mcpServers": { "Optuna": { "command": "/path/to/uvx", "args": [ "optuna-mcp" ] } } }

Additionally, you can specify the Optuna storage with the--storageargument to persist the results.

{ "mcpServers": { "Optuna": { "command": "/path/to/uvx", "args": [ "optuna-mcp", "--storage", "sqlite:///optuna.db" ] } } }

After adding this, please restart Claude Desktop application. For more information about Claude Desktop, check outthe quickstart page.

You can also run the Optuna MCP server using Docker. Make sure you have Docker installed and running on your machine.

{ "mcpServers": { "Optuna": { "command": "docker", "args": [ "run", "-i", "--rm", "--net=host", "-v", "/PATH/TO/LOCAL/DIRECTORY/WHICH/INCLUDES/DB/FILE:/app/workspace", "ghcr.io/optuna/optuna-mcp:latest", "--storage", "sqlite:////app/workspace/optuna.db" ] } } }

The Optuna MCP provides the following tools. Specifically, it offers primitive functions of Optuna such as Study, Trial, Visualization, and Dashboard. Since MCP clients know the list of tools and the details of each tool, users do not need to remember those details.

- create_study- Create a new Optuna study with the given study_name and directions. If the study already exists, it will be simply loaded.

- study_name: name of the study (string, required).
- directions: The directions of optimization (list of literal strings minimize/maximize, optional).

- name: the name of the sampler (string, required).

- metric_names: The list of metric names for each objective (list of strings, required).

- ask- Suggest new parameters using Optuna.

- search_space: the search space for Optuna (dictionary, required).

- trial_number: the trial number (integer, required).
- values: the result of the trial (float or list of floats, required).

- trial_number: the trial number (integer, required).
- key: the key of the user attribute (string, required).
- value: the value of the user attribute (any type, required).

- trial_number: the trial number (integer, required).

- plot_optimization_history- Return the optimization history plot as an image.

- target: index to specify which value to display (integer, optional).
- target_name: target’s name to display on the axis label (string, optional).

- reference_point: a list of reference points to calculate the hypervolume (list of floats, required).

- target_names: objective name list used as the axis titles (list of strings, optional).
- include_dominated_trials: a flag to include all dominated trial's objective values (boolean, optional).
- targets: a list of indices to specify the objective values to display. (list of integers, optional).

- params: parameter list to visualize (list of strings, optional).
- target: an index to specify the value to display (integer, required).
- target_name: target’s name to display on the color bar (string, required).

- params: parameter list to visualize (list of strings, optional).
- target: an index to specify the value to display (integer, required).
- target_name: target’s name to display on the axis label and the legend (string, required).

- params: parameter list to visualize (list of strings, optional).
- target: an index to specify the value to display (integer, required).
- target_name: target’s name to display on the axis label (string, required).

- params: parameter list to visualize (list of strings, optional).
- target: an index to specify the value to display (integer/null, optional).
- target_name: target’s name to display on the legend (string, required).

- target: an index to specify the value to display (integer, required).
- target_name: target’s name to display on the axis label (string, required).

- params: parameter list to visualize (list of strings, optional).
- target: an index to specify the value to display (integer, required).
- target_name: target’s name to display on the color bar (string, required).

- launch_optuna_dashboard- Launch the Optuna dashboard.

- port: server port (integer, optional, default: 58080).

Here we present a simple example of optimizing the 2D-Sphere function, along with example prompts and the summary of the LLM responses.

Starting the Optuna Dashboard and Analyzing Optimization Results

You can also start theOptuna dashboardvia the MCP server to analyze the optimization results interactively.

By default, the Optuna dashboard will be launched on port 58080. You can access it by navigating tohttp://localhost:58080in your web browser as shown below:

Optuna dashboard provides various visualizations to analyze the optimization results, such as optimization history, parameter importances, and more.

Optimizing the FFmpeg Encoding Parameters

This demo showcases how to use the Optuna MCP server to automatically find optimal FFmpeg encoding parameters. It optimizes x264 encoding options to maximize video quality (measured by the SSIM score) while keeping encoding time reasonable.

This example optimizes a Matplotlib configuration.

Check outexamples/auto-matplotlibfor details.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Create crafted UI components inspired by the best 21st.dev design engineers.

Bring agent evaluations, observability, and synthetic test set generation directly into your IDE for free with Galileo's new MCP server

An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .

MCP server for AI Diagram Maker — generate beautiful software engineering diagrams directly inside Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI agent

ALAPI MCP Tools,Call hundreds of API interfaces via MCP

AI-powered SVG animation generator that transforms static files into animated SVG components using the Allyson platform

MCP server that gives AI assistants on-demand access to 1,500+ amCharts docs, ~300 code examples, and 1000+ class API references.

APIMatic MCP Server is used to validate OpenAPI specifications using APIMatic. The server processes OpenAPI files and returns validation summaries by leveraging APIMatic’s API.

One shared context layer for AI agents and humans — live API specs, DB schemas, and versioned contracts across repos so every agent and teammate works from the same source of truth.

Build and deploy full-stack Next.js apps with 98 tools for React, AWS, and MongoDB

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.