Materials Project
FreeNot checkedIntegrates with the Materials Project database to search materials by elements or formula and retrieve detailed properties including formation energies, band ga
About
Integrates with the Materials Project database to search materials by elements or formula and retrieve detailed properties including formation energies, band gaps, crystal systems, and stability data for computational materials science research.
README
A fastmcp-based tool for writing prompts against data in the Materials Project database.
Installation
You can install the package from source:
pip install -e .
Or using uv:
uv pip install -e .
Usage
You can use the CLI:
mp-mcp
Or import in your Python code:
from materials_project_mcp.main import create_mcp
mcp = create_mcp()
mcp.run()
API Key Setup
The Materials Project API requires an API key. You can set up your API key in several ways:
Pass it directly to the MPRester:
from mp_api.client import MPRester with MPRester("your_api_key_here") as mpr: # do stuff with mprSet it as an environment variable:
export MP_API_KEY="your_api_key_here"
Example
Here's a simple example that demonstrates how to use the MCP tools directly:
import os
import json
from materials_project_mcp.tools import (
get_materials_with_elements,
get_material_details,
find_materials_by_formula
)
# Set your API key
os.environ["MP_API_KEY"] = "your_api_key_here"
# Or load it from a file
# with open("~/materials_project_api.key", "r") as f:
# os.environ["MP_API_KEY"] = f.read().strip()
# Function to print JSON data in a readable format
def print_json(data):
print(json.dumps(data, indent=2))
# Find materials containing Fe and O
print("\n=== Finding materials containing Fe and O ===")
materials = get_materials_with_elements(
elements=["Fe", "O"],
max_records=3
)
print_json(materials)
# Get details for a specific material
if materials:
material_id = materials[0]["material_id"]
print(f"\n=== Getting details for material {material_id} ===")
details = get_material_details(material_id)
print_json(details)
# Find materials with a specific formula
print("\n=== Finding materials with formula Fe2O3 ===")
formula_materials = find_materials_by_formula(
formula="Fe2O3",
max_records=3
)
print_json(formula_materials)
Development
Local Setup
# Clone the repository
git clone https://github.com/justaddcoffee/materials-project-mcp.git
cd materials-project-mcp
# Install development dependencies
uv pip install -e ".[dev]"
Running Tests
pytest
Installing Materials Project
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/fair2wise/materials_project_mcpFAQ
Is Materials Project MCP free?
Yes, Materials Project MCP is free — one-click install via Unyly at no cost.
Does Materials Project need an API key?
No, Materials Project runs without API keys or environment variables.
Is Materials Project hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Materials Project in Claude Desktop, Claude Code or Cursor?
Open Materials Project on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
wenb1n-dev/SmartDB_MCP
A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
by wenb1n-devPostgres Server
This server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
by madhurprashPostgres
Query your database in natural language
by AnthropicPostgreSQL
Read-only database access with schema inspection.
by modelcontextprotocolCompare Materials Project with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All data MCPs
