Materials Project
FreeNot checkedProvides direct access to the Materials Project database for querying crystal structures, electronic properties, phonon data, magnetic properties, and thermodyn
About
Provides direct access to the Materials Project database for querying crystal structures, electronic properties, phonon data, magnetic properties, and thermodynamic stability through 23 specialized tools designed for materials science research.
README
A Model Context Protocol (MCP) server for querying the Materials Project database using the mp_api client.
Requirements
- Materials Project API Key - Get one here (free account required)
- Docker Desktop (must be running)
- Python 3.12+ with uv
Getting Your Materials Project API Key
- Visit Materials Project
- Create a free account or log in
- Go to your dashboard
- Navigate to API settings
- Generate or copy your API key
- Keep this key secure - you'll need it for setup
Installation Options
Step 1: Docker (Recommended)
Using Docker Run
Install Docker Desktop:
- Download from docker.com
- Install and make sure Docker Desktop is running
Pull the Docker image:
docker pull benedict2002/materials-project-mcpTest the installation:
docker run --rm -i -e MP_API_KEY="your-api-key" benedict2002/materials-project-mcp
Using Docker Compose (Easiest)
Install Docker Desktop and make sure it's running
Clone the repository:
git clone <repository-url> cd materials-project-mcpCreate a
.envfile:echo "MP_API_KEY=your-materials-project-api-key" > .envTest the setup:
docker-compose upFor background running:
docker-compose up -dStop the service:
docker-compose down
Step 1 : Local Python Installation
Install uv (if not already installed):
curl -Ls https://astral.sh/uv/install.sh | shClone the repository:
git clone <repository-url> cd materials-project-mcpCreate and activate virtual environment:
uv venv source .venv/bin/activate # Linux/macOS # or .venv\Scripts\activate # WindowsInstall dependencies:
uv pip install -r requirements.txtSet your API key:
export MP_API_KEY="your-api-key" # Linux/macOS # or set MP_API_KEY=your-api-key # WindowsTest the installation:
python server.py
Step 2 : Setup with Claude Desktop
Locate your Claude configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
Choose your configuration method:
Using Docker Run
{ "mcpServers": { "Materials Project MCP": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "MP_API_KEY=your-materials-project-api-key", "benedict2002/materials-project-mcp" ] } } }Replace
your-materials-project-api-keywith your actual API keyEnsure Docker Desktop is running
Restart Claude Desktop
Verify installation:
- Open a new chat in Claude
- Ask something like "Search for silicon materials in the Materials Project database" or test any of the availabe tools.
- You should see Materials Project data in the response
Setup with VS Code Copilot
Open VS Code Settings:
- Press
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS) - Type "Preferences: Open User Settings (JSON)"
- Select it to open settings.json
- Press
Add MCP configuration:
{ "mcp": { "inputs": [], "servers": { "Materials Project MCP": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "MP_API_KEY=your-api-key", "benedict2002/materials-project-mcp" ] } } }, "chat.mcp.discovery.enabled": true, "workbench.secondarySideBar.showLabels": false }Alternative: Local Python setup for VS Code:
{ "mcp": { "inputs": [], "servers": { "Materials Project MCP": { "command": "/usr/local/bin/uv", "args": [ "run", "--with", "mcp[cli],aiohttp,pydantic,mp_api,pymatgen,emmet-core", "/path/to/your/server.py" ], "env": { "MP_API_KEY": "your-api-key" } } } }, "chat.mcp.discovery.enabled": true }Replace placeholders:
your-api-keywith your Materials Project API key/path/to/your/server.pywith the actual path to server.py
Ensure Docker Desktop is running (for Docker configurations)
Restart VS Code
Test in VS Code:
- Open VS Code chat/copilot
- Ask about materials from the Materials Project
- The Docker container will start automatically when VS Code makes requests
Testing & Development (developers)
Testing Your Installation
- Test MCP server locally:
Look for the line "🔗 Open inspector with token pre-filled:" and use that URLmcp dev server.py
Development Workflow
Create a feature branch:
git checkout -b feature-nameMake your changes and test:
# Local testing with MCP Inspector mcp dev server.py # Use the inspector URL to test your changes interactively # Docker testing docker build -t materials-project-mcp-local . docker run --rm -i -e MP_API_KEY="your-api-key" materials-project-mcp-local # Docker Compose testing docker-compose up --buildCommit and push:
git add . git commit -m "Add feature description" git push origin feature-nameOpen a pull request
Available Tools & Features
- search_materials - Search by elements, band gap range, stability
- get_structure_by_id - Get crystal structures and lattice parameters
- get_electronic_bandstructure - Plot electronic band structures
- get_electronic_dos_by_id - Get electronic density of states
- get_phonon_bandstructure - Plot phonon band structures
- get_phonon_dos_by_id - Get phonon density of states
- get_ion_reference_data_for_chemsys - Download aqueous ion reference data for Pourbaix diagrams
- get_cohesive_energy - Calculate cohesive energies
- get_atom_reference_data - Retrieve reference energies of isolated neutral atoms
- get_magnetic_data_by_id - Magnetic properties and ordering
- get_charge_density_by_id - Charge density data
- get_dielectric_data_by_id - Dielectric constants and properties
- get_diffraction_patterns - X-ray and neutron diffraction
- get_xRay_absorption_spectra - XAFS, XANES, EXAFS spectra
- get_elastic_constants - Mechanical properties
- get_suggested_substrates - Find substrates for thin films
- get_thermo_stability - Thermodynamic stability analysis
- get_surface_properties - Surface energies, work functions, and Wulff shapes
- get_grain_boundaries - Computed grain boundaries for a material
- get_insertion_electrodes - Insertion electrode and battery data
- get_oxidation_states - Element oxidation states, formula, and structure info
Troubleshooting
Common Issues
"Invalid API key" error:
- Verify your API key is correct
- Check that you've set the environment variable properly
- Ensure your Materials Project account is active
"Docker not found" or "Cannot connect to Docker daemon":
- Make sure Docker Desktop is installed and running
- You should see the Docker Desktop icon in your system tray/menu bar
- Try
docker --versionto verify Docker is accessible - On Windows/Mac: Open Docker Desktop application
- On Linux: Start Docker service with
sudo systemctl start docker
Container startup issues:
- Docker containers start automatically when Claude/VS Code makes requests
- No need to manually start containers - they're ephemeral (start → run → stop)
- Each query creates a fresh container instance
Docker Compose issues:
- Make sure Docker Compose is installed:
docker-compose --version - Check your
.envfile exists and has the correct API key - Verify the docker-compose.yml file is in the correct location
- Ensure Docker Desktop is running
- Make sure Docker Compose is installed:
MCP server not recognized in Claude:
- Check your configuration file path
- Verify JSON syntax is correct
- Restart Claude Desktop after configuration changes
- Ensure Docker Desktop is running
Getting Help
- MCP Inspector: Use
mcp dev server.pyfor interactive testing and debugging. - GitHub Issues: Create an Issue for bug reports, feature requests, or questions.
- Materials Project API Docs: docs.materialsproject.org
- MCP Documentation: modelcontextprotocol.io
- Docker Help: docs.docker.com
Authors
- Benedict Debrah
- Peniel Fiawornu
Reference
Yin, Xiangyu. 2025. "Building an MCP Server for the Materials Project." March 23, 2025. https://xiangyu-yin.com/content/post_mp_mcp.html.
Installing Materials Project
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/benedictdebrah/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 modelcontextprotocolRedis
Interact with Redis key-value stores.
by modelcontextprotocolSQLite
Database interaction and business intelligence capabilities.
by modelcontextprotocolmxcp
Open-source framework for building enterprise-grade MCP servers using just YAML, SQL, and Python, with built-in auth, monitoring, ETL and policy enforcement.
by raw-labstadas-github/a2asearch-mcp
MCP server to search 4,800+ MCP servers, AI agents, CLI tools and agent skills. Install: npx -y a2asearch-mcp. Ask Claude: "Find MCP servers for database access
by tadas-githubjulien040/anyquery
Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by desi
by julien040drakonkat/wizzy-mcp-tmdb
A MCP server for The Movie Database API that enables AI assistants to search and retrieve movie, TV show, and person information.
by drakonkatCompare 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
