Skip to content

emdgroup/baybe-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

baybe-mcp

MCP server that exposes BayBE's Bayesian optimization as tools for AI agents.

Setup

Requires Python >= 3.10 and uv.

uv sync

Running the server

uv run python -m baybe_mcp.server

This starts the MCP server on stdio (the default MCP transport).

Tools

validate

Validates a JSON configuration for any BayBE object. Useful for agents to check their configs before passing them to recommend.

Input:

  • json_config (string): JSON string with a "type" field identifying the concrete BayBE class.

Returns: JSON with "valid" (bool) and "message" (string).

Example:

{
  "type": "NumericalDiscreteParameter",
  "name": "temperature",
  "values": [100.0, 150.0, 200.0]
}

recommend

Performs a stateless Bayesian optimization recommendation. No Campaign or server-side state -- all context is passed per call.

Inputs:

Parameter Type Required Description
batch_size int yes Number of experiments to recommend
searchspace_json string yes JSON-serialized SearchSpace
objective_json string yes JSON-serialized Objective
measurements_json string no Past measurements as a DataFrame (see formats below)
recommender_json string no Recommender config. Default: TwoPhaseMetaRecommender
pending_experiments_json string no Pending experiments DataFrame
output_format string no "records" (default) or "base64"

Returns: JSON-serialized DataFrame of recommended experiments.

Example searchspace:

{
  "type": "SearchSpace",
  "constructor": "from_product",
  "parameters": [
    {"type": "NumericalDiscreteParameter", "name": "x1", "values": [1.0, 2.0, 3.0]},
    {"type": "NumericalDiscreteParameter", "name": "x2", "values": [10.0, 20.0, 30.0]}
  ]
}

Example objective:

{
  "type": "SingleTargetObjective",
  "target": {
    "type": "NumericalTarget",
    "name": "y",
    "transformation": {"type": "IdentityTransformation"},
    "minimize": false
  }
}

DataFrame Formats

Measurements and pending experiments accept three formats:

  • records (agent-friendly): [{"x1": 1.0, "x2": 10.0, "y": 0.5}, ...]
  • base64: BayBE's native base64-encoded pickle string (from converter.unstructure(df))
  • constructor dict: {"constructor": "from_records", "data": [...]}

Output can be "records" (list of dicts) or "base64".

Tests

uv sync --extra test
uv run pytest

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages