Materials Project MCP

Materials Project MCP

A tool for querying and analyzing materials data from the Materials Project database using natural language prompts, enabling materials scientists to explore properties, structures, and compositions of materials through conversational interfaces.

Category
Visit Server

Tools

get_materials_with_elements

Find materials containing specific elements. Args: elements: List of elements that must be present in the material (e.g., ["Fe", "O"]). exclude_elements: Optional list of elements that must not be present. max_records: Maximum number of records to return (default: 10). Returns: List of materials containing the specified elements.

get_material_details

Get detailed information about a specific material by its Materials Project ID. Args: material_id: The Materials Project ID (e.g., "mp-149"). Returns: Dictionary containing detailed information about the material.

find_materials_by_formula

Find materials with a specific chemical formula. Args: formula: Chemical formula to search for (e.g., "Fe2O3"). max_records: Maximum number of records to return (default: 10). Returns: List of materials matching the specified formula.

README

Materials Project MCP

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:

  1. Pass it directly to the MPRester:

    from mp_api.client import MPRester
    with MPRester("your_api_key_here") as mpr:
        # do stuff with mpr
    
  2. Set 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured