Skip to content

HEP-KE/mcp-ke

Repository files navigation

MCP-KE

Model Context Protocol (MCP) server providing cosmology analysis tools for LLM agents.

What is MCP-KE?

An MCP server that exposes 20+ tools for cosmological analysis:

  • Domain Tools: Load data, compute power spectra, create visualizations
  • Agent Tools: AI-powered workflows for complex multi-step analysis

Documentation

Quick Start

# Install
pip install -e .

# Run server (for testing)
python mcp_server.py

Available Tools

Domain Tools (16 tools)

Data & Models

  • load_observational_data - Load eBOSS observational data
  • get_lcdm_params, get_nu_mass_params, get_wcdm_params - Cosmology model parameter sets
  • create_theory_k_grid - Generate k-value grid for theory predictions

Analysis

  • compute_power_spectrum - Compute P(k) for given parameters using CLASS
  • compute_all_models - Compute P(k) for all standard models
  • compute_suppression_ratios - Calculate P(k)/P_ref(k) ratios

Visualization

  • plot_power_spectra - Plot P(k) vs observations
  • plot_suppression_ratios - Plot suppression ratios

Helpers

  • save_array, load_array, save_dict, load_dict, list_agent_files

Agent Tools (1 tool)

Require OpenAI-compatible LLM API (Anthropic, Google Gemini, OpenAI, etc.)

power_spectrum_agent (DISABLED - requires litellm)

  • Commented out in agent_tools/__init__.py
  • Use individual tools (compute_power_spectrum, compute_all_models) directly instead
  • End-to-end power spectrum analysis workflow
  • Orchestrates: data agent → modeling agent → visualization agent
  • Example (if re-enabled):
    result = power_spectrum_agent(
        query="Compare ΛCDM and wCDM models with eBOSS data",
        api_key="your-key",
        llm_url="https://api.anthropic.com",
        model_id="claude-3-5-sonnet-20241022"
    )

arxiv_agent

  • Search arXiv, download papers, extract and analyze content
  • Example:
    result = arxiv_agent(
        query="Find recent papers on galaxy mass estimation methods",
        api_key="your-key",
        llm_url="https://api.anthropic.com",
        model_id="claude-3-5-sonnet-20241022"
    )

Testing

# Unit tests (no API key needed)
pytest

# Integration tests (requires GOOGLE_API_KEY)
export GOOGLE_API_KEY="your-key"
pytest tests/test_agent_tools.py -v

Contributing

See CONTRIBUTING.md

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors