optuna
The Optuna MCP Server is a Model Context Protocol (MCP) server to interact with Optuna APIs.
claude mcp add --transport stdio optuna-optuna-mcp uvx optuna-mcp
How to use
The Optuna MCP Server exposes a set of MCP tools built on top of Optuna to automate and analyze hyperparameter optimization tasks. It provides primitives for creating and managing studies, trials, and metrics, plus visualization and dashboard options to inspect optimization progress. Clients can interact with tools such as create_study, set_sampler, ask (to propose new trials), tell (to report results), and various visualization tools to render performance histories, Pareto fronts, and other diagnostics. A Web Dashboard via launch_optuna_dashboard is also available to monitor ongoing optimizations in a browser. You don’t need to memorize Optuna internals; the MCP layer abstracts study management, sampling, and result recording behind simple tool calls, enabling LLM-assisted optimization workflows and interactive analysis through chat interfaces or scripted clients.
How to install
Prerequisites:
- Python 3.12 (or 3.13 as indicated by the project).
- An MCP client capable of using uv (Astral uv) or Docker to run MCP servers.
Option A: Install and run via uv
-
Install uv from Astral:
- Follow the instructions at https://docs.astral.sh/uv/getting-started/installation/
-
Install the Optuna MCP package (Python) if needed for your environment:
- pip install optuna-mcp
-
Configure your MCP client (e.g., Claude Desktop) to reference the Optuna MCP server: In Claude Desktop, go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json and add:
{ "mcpServers": { "Optuna": { "command": "/path/to/uvx", "args": [ "optuna-mcp" ] } } }
-
Optionally specify storage for persistence by including --storage in the args, for example: { "mcpServers": { "Optuna": { "command": "/path/to/uvx", "args": [ "optuna-mcp", "--storage", "sqlite:///optuna.db" ] } } } )
-
Restart Claude Desktop to apply changes.
Option B: Run via Docker
- Ensure Docker is installed and running.
- Use the following MCP config snippet to run the server in a container:
{ "mcpServers": { "Optuna": { "command": "docker", "args": [ "run", "-i", "--rm", "--net=host", "-v", "/PATH/TO/LOCAL/DIRECTORY/WHICH/INCLUDES/DB/FILE:/app/workspace", "optuna/optuna-mcp:latest", "--storage", "sqlite:////app/workspace/optuna.db" ] } } }
- Access the server as configured by your client. The available tools include Study, Trial, Visualization, and Web Dashboard features.
Additional notes
Tips and common considerations:
- If you enable --storage in UV/docker, Optuna will persist studies and metrics to the specified SQLite database path inside the container or local workspace, so ensure the path is writable.
- The Optuna MCP exposes a suite of tools (Study, Trial, Visualization, Web Dashboard). For multi-objective optimization, use best_trials and Pareto-front related visualizations.
- When using Docker, mounting the workspace directory is important to persist the Optuna database across restarts.
- If you encounter connection issues with your MCP client, verify that the Optuna MCP server is reachable at the configured command/args and that the server process is running.
- For experimentation, you can define multiple studies per storage backend by using different study_name values in the create_study tool.
Related MCP Servers
PPTAgent
An Agentic Framework for Reflective PowerPoint Generation
mcp-aktools
📈 提供股票、加密货币的数据查询和分析功能MCP服务器
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
BinAssistMCP
Binary Ninja plugin to provide MCP functionality.
mcp -docy
A Model Context Protocol server that provides documentation access capabilities. This server enables LLMs to search and retrieve content from documentation websites by scraping them with crawl4ai. Built with FastMCP v2.
the -company
TheMCPCompany: Creating General-purpose Agents with Task-specific Tools