Optuna MCP Server
An MCP server from the Optuna team: a model picks hyperparameters, reports trial results and plots the optimization history
- 91 ★ on the repository
- Last commit
Extended access
Why this level
- Runs a local Python process and, with `launch_optuna_dashboard`, starts a web dashboard on port 58080
- With `--storage` writes results to a file or database at the given URL
Install
- Works in
Manual install
{"mcpServers":{"Optuna":{"command":"/path/to/uvx","args":["optuna-mcp","--storage","sqlite:///optuna.db"]}}}Needs `uv`. Edit `claude_desktop_config.json`, then restart the app. Without `--storage` results are not persisted.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Runs a local Python process and, with `launch_optuna_dashboard`, starts a web dashboard on port 58080
- With `--storage` writes results to a file or database at the given URL
This is third-party code. Review the repository files before installing.
What it does
Optuna MCP Server exposes the basic operations of the Optuna library for parameter search to an MCP client. A model creates a study (`create_study`) with a minimize or maximize direction, picks a sampler (`set_sampler`), asks Optuna for a parameter set (`ask`) within a given search space and reports a trial result (`tell`). The loop repeats until the model or a person stops it. `best_trial` and `best_trials` return the best trial and the Pareto front. The second group is visualization. `plot_optimization_history`, `plot_contour`, `plot_parallel_coordinate`, `plot_slice`, `plot_param_importances`, `plot_pareto_front` and others return charts as images, and `launch_optuna_dashboard` starts the Optuna web dashboard on port 58080. The objective value is computed by the model itself or another tool, such as a JavaScript interpreter. The repository examples tune x264 encoding options in FFmpeg by SSIM, a cookie recipe and Matplotlib settings. Results can be saved by passing a database URL, for example SQLite, to `--storage`.
Who it is for. Researchers and engineers who tune model hyperparameters or program settings and want to run the search as a dialogue in Claude Desktop or Claude Code.
Good fit when
- Model hyperparameters are tuned by hand and you want to hand the ask and tell loop to an agent
- Results of earlier runs sit in an Optuna database and you want to dig into them by chat: parameter importance, history, Pareto front
- An external program's settings, such as x264 in FFmpeg, are searched by SSIM under a time limit
- You want to optimize the output of another MCP tool: Optuna picks parameters and a second server scores them
- The Optuna dashboard should open with one sentence, without hunting for the launch command
Not a fit when
- The objective is heavy and slow: every trial goes through chat, and running Optuna from a script is cheaper
- You need distributed search across many machines with a shared database: the server is built for a single MCP client
- You need detailed pruner and sampler settings: the README only lists `set_sampler` by name
- Python 3.12 or 3.13 is unavailable and cannot be installed
Example request
Create an Optuna study that minimizes the sum of squares of x and y, suggest parameters from -1 to 1 and plot the optimization historyMCP
- Transport
- stdio
- Authentication
- not required
Limitations
- The server needs Python 3.12 or 3.13 and runs through `uvx` or Docker.
- Without `--storage` studies live in process memory and vanish when the client restarts. To persist them, pass a database URL such as `sqlite:///optuna.db`.
- The server does not compute the objective: the model or another tool sends it through `tell`.
- `launch_optuna_dashboard` starts a web dashboard on port 58080, and in Docker that route needs `--net=host`.
How to disable. Delete the `Optuna` entry from `claude_desktop_config.json` and restart the app, or run `claude mcp remove optuna` in Claude Code. The database file given in `--storage` stays on disk.
FAQ
How do I connect Optuna MCP to Claude Desktop?
Open Claude, Settings, Developer, Edit Config and add an `Optuna` server with the command `uvx` and the argument `optuna-mcp`. Then restart the app.
How do I keep results between sessions?
Add `--storage` and a database URL to the arguments, for example `sqlite:///optuna.db`. In Docker, mount the folder with the database file at `/app/workspace`.
Which charts can the server draw?
Optimization history, hypervolume history, Pareto front, contour, parallel coordinates, slice, parameter importances, EDF, timeline and rank plots. All come back as images.
Who computes the objective value?
The model sends the number through `tell` and the server does not compute it. You can get it, for example, from a JavaScript interpreter or an FFmpeg run.
How do I run the server in Docker?
Use the image `ghcr.io/optuna/optuna-mcp:latest` with `-i --rm --net=host`, mount the database folder and pass `--storage sqlite:////app/workspace/optuna.db`.
Discussion
No questions or reviews yet.
Related
MCP serversMySQL MCP Server Pro
mysql_mcp_server_pro
A MySQL MCP server that runs SQL under access roles, finds tables by comments and analyzes locks, indexes and query plans
A skill and Python package for hyperparameter tuning: the agent reads the code, proposes the next set of values, and your own run measures the result
OpenStudio MCP
openstudio-mcp
MCP server for building energy modeling: an agent builds an OpenStudio model, runs EnergyPlus and reads the results.
MCP server for Open-Meteo: 17 tools, a 16-day forecast, archive from 1940, air quality, marine data, floods and climate
A Claude Code plugin and MCP server: over 1000 scientific tools for biology, chemistry and medicine, data-check commands and routing skills
Official MCP server from the OpenSearch project exposes a cluster to agents: indexes, mappings, DSL search and shard state.
README in short
The README names three use cases: model-driven hyperparameter tuning, analyzing Optuna results by chat, and optimizing the input and output of other MCP tools. It then covers install with `uv` and Docker, a tool list grouped as Study, Trial, Visualization and Dashboard, and five examples with prompts and screenshots.