The Materials Project MCP is a server that allows you to query the Materials Project database directly from AI assistants like Claude using the Model Context Protocol. It provides a convenient way to access materials science data without leaving your assistant's interface.
docker pull benedict2002/materials-project-mcp
docker run --rm -i -e MP_API_KEY="your-api-key" benedict2002/materials-project-mcp
.env file with your API key:
echo "MP_API_KEY=your-materials-project-api-key" > .env
docker-compose up
For background running:
docker-compose up -d
docker-compose down
curl -Ls https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate # Linux/macOS
# or
.venv\Scripts\activate # Windows
uv pip install -r requirements.txt
export MP_API_KEY="your-api-key" # Linux/macOS
# or
set MP_API_KEY=your-api-key # Windows
python server.py
Locate your Claude configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonAdd this configuration (using Docker):
{
"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-key with your actual API key
Ensure Docker Desktop is running
Restart Claude Desktop
Test by asking Claude to search for materials
Open VS Code Settings (JSON) by pressing Ctrl+Shift+P or Cmd+Shift+P and searching for "Preferences: Open User Settings (JSON)"
Add this configuration (using Docker):
{
"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
}
For local Python setup:
{
"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 with your actual values
Restart VS Code
Test by asking about materials from the Materials Project
"Invalid API key" error:
Docker connection issues:
docker --versionsudo systemctl start dockerContainer startup issues:
Docker Compose issues:
.env file exists with the correct API keyMCP server not recognized in Claude:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "Materials-Project-MCP" '{"command":"docker","args":["run","--rm","-i","-e","MP_API_KEY=your-materials-project-api-key","benedict2002/materials-project-mcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:
{
"mcpServers": {
"Materials Project MCP": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"MP_API_KEY=your-materials-project-api-key",
"benedict2002/materials-project-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"Materials Project MCP": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"MP_API_KEY=your-materials-project-api-key",
"benedict2002/materials-project-mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect