hydroemu-mcp-server
hydroemu-mcp-server
HACC宇宙論的流体シミュレーションエミュレータ(事前学習済みSEPIAガウス過程モデル)を、任意のLLMエージェント向けツールとして公開するMCPサーバーです。
このリポジトリが教える一つのアイデア
科学コードは通常のPythonのまま。MCPラッパーはそれを公開するだけ。
tools/は通常の科学パッケージです。MCPを一切インポートしません。エミュレータツールはtools/hydro_tools.pyに、SEPIAラッパーの中核はtools/emulator.pyにあります。mcp_server/は約70行の汎用ラッパーです。pyproject.tomlから1行の設定を読み、科学パッケージをインポートし、その__all__にリストされたすべての関数をMCPツールとして登録します。
[tool.mcp-server]
tool_modules = ["tools"]あなたの型ヒント、Pydanticの Field 制約、docstringが、エージェントが見るツールスキーマになります。独自サーバーを構築するには:モジュールを tools/ に置く(またはその1行の設定を自分のパッケージに向ける)だけで、__all__ に公開関数をリストすれば完了です。
Related MCP server: MCP Refana Server
レイアウト
models/ Pre-trained SEPIA pickles (copy from CosmoHydro/models/)
tools/
emulator.py Core SEPIA wrapper: lazy load, predict, redshift interpolation
hydro_tools.py The 5 MCP tool functions + ArtifactResult contract
__init__.py __all__ — ONLY these names become tools
mcp_server/ Generic drop-in wrapper (FastMCP)
tests/test_tools.py Tools tested as plain Python, no MCP needed
docs/mcp-clients.md Multi-client setup guideパラメータ
合計7パラメータ(サブグリッド5 + 宇宙論2):
パラメータ | 記号 | 範囲 | 単位 |
AGN風結合 | κ_w | [0.03, 3.0] | — |
AGNエネルギー効率 | e_w | [0.001, 0.1] | — |
BH種質量 | M_seed | [0.5, 50.0] | 10⁶ M☉ |
運動学的フィードバック速度 | v_kin | [0.1, 1.0] | 10⁴ km/s |
運動学的フィードバック効率 | ε_kin | [0.1, 1.0] | 10¹ |
物質密度 | ω_m | [0.12, 0.155] | — |
ゆらぎ振幅 | σ₈ | [0.7, 0.9] | — |
設計:ラテン超方格設計による110シミュレーション(400 Mpc/hボックス)。
観測量
観測量 | 説明 | スナップショット | z範囲 |
GSMF | 銀河恒星質量関数 | 11 | 0–2 |
HMF | ハロー質量関数 | 11 | 0–2 |
fGas | 銀河団ガス質量比 | 7 | 0–1.0 |
CGD | 銀河団ガス密度プロファイル | 5 | 0–0.5 |
CGED | 銀河団ガス電子密度プロファイル | 5 | 0–0.5 |
CPP | 銀河団ガス圧力プロファイル | 5 | 0–0.5 |
CTP | 銀河団ガス温度プロファイル | 5 | 0–0.5 |
CEP | 銀河団ガスエントロピープロファイル | 5 | 0–0.5 |
CEEP | 銀河団電子エントロピープロファイル | 5 | 0–0.5 |
CMP | 銀河団ガス金属量プロファイル | 5 | 0–0.5 |
CYP | 銀河団Compton-y(tSZ)プロファイル | 5 | 0–0.5 |
ツール
ツール | 機能 |
| 11個すべてのエミュレート観測量をメタデータ付きで一覧表示 |
| 7パラメータの設計空間と範囲を表示 |
| z=0で任意の観測量を予測し、CSVを書き出す |
| 任意のz(補間)で予測 |
| 2パネル図:観測量+比 |
科学MCPサーバーにコピーする価値のある2つの慣習:
すべてのツールは
{status, files, message, metadata}(ArtifactResult)を返す。配列はツール間でファイルパスとして移動し、エージェントのコンテキストウィンドウを経由しない。
インストール
conda create -n hydroemu python=3.12 -y
conda activate hydroemu
pip install -e ".[dev]"
pytest # tests pass without SEPIA models (fixture data)事前学習済みモデル
CosmoHydro/models/ から学習済みSEPIA pickleを models/ ディレクトリにコピーします:
cp -r /path/to/CosmoHydro/models/GSMF_multiz models/
cp -r /path/to/CosmoHydro/models/HMF_multiz models/
# ... etc for each observableモデルがなくても、list_observables()、describe_parameters()、plot_observable_comparison() は動作します。pickleを必要とするのは predict_observable と predict_observable_redshift のみです。
サーバーの起動
Streamable HTTP — サーバーはURLを持つ可視プロセスです:
python -m mcp_server --transport streamable-http --port 8000クライアントは http://127.0.0.1:8000/mcp に接続します。サーバーを停止するには Ctrl+C を押します(Ctrl+Zは一時停止するだけで、ポートが占有されたままになります。その場合はサーバーを再起動するだけです:ポートを保持している残存 mcp_server を検出し、自動的にクリアします)。
このサーバーをClaude Code、Claudeデスクトップアプリ、Codex、Cursor、その他のMCPクライアントから使用するには、docs/mcp-clients.md を参照してください。チェックイン済みの .mcp.json がすでにClaude Codeに配線しています。
アーキテクチャ
このサーバーは spectra-mcp-server と同じアーキテクチャに従います:
エミュレータプロット
CosmoHydroトレーニングノートブックからの24の検証、感度、比較プロットについては、完全なギャラリー を参照してください。ハイライト:
|
|
GSMF:エミュレータ vs 保留シミュレーション | P(k)抑制:パラメータごとの感度 |
アーキテクチャ(詳細)
mcp_server/は汎用ドロップインMCPラッパー(リポジトリ間でコピー)tools/にはドメイン固有の科学関数が含まれるpyproject.tomlの[tool.mcp-server]設定がそれらを結びつけるすべてのSEPIAインポートは遅延(モジュールスコープではなく関数内)
モデルは初回使用時にロードされ、以降の呼び出しでキャッシュされる
This server cannot be deployed
Maintenance
Related MCP Connectors
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Free public MCP for AI agents — 193 tools, 44 workflows. No API key.
MCP-Native LLM Orchestration Agent
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides MCP tools for high-performance computing (HPC) and converged computing, enabling agentic interactions with HPC resources and workflows.6MIT
- FlicenseAqualityDmaintenanceEnables Mu2e analysis workflows by exposing event counting, cut analysis, sensitivity computation, and ML selection as MCP tools for agentic frameworks.10-
- AlicenseAqualityAmaintenanceExposes SwarmLabs physics-informed scientific experiment predictions as MCP tools, enabling agents to run predictions, list engines, and perform parameter sweeps with honesty-first uncertainty reporting.6MIT
- FlicenseNot gradedqualityCmaintenanceMCP server that exposes cosmology tools to LLM agents, including CLASS matter power spectrum computation, eBOSS DR14 Lyman-α forest data retrieval, and plotting capabilities.2-

