Query the Materials Project database using the mp_api client. Requires an MP_API_KEY environment variable.
A Model Context Protocol (MCP) server for querying the Materials Project database using the mp_api client.
Install Docker Desktop:
Pull the Docker image:
docker pull benedict2002/materials-project-mcp
Test the installation:
docker run --rm -i -e MP_API_KEY="your-api-key" benedict2002/materials-project-mcp
Install Docker Desktop and make sure it's running
Clone the repository:
git clone <repository-url>
cd materials-project-mcp
Create a .env
file:
echo "MP_API_KEY=your-materials-project-api-key" > .env
Test the setup:
docker-compose up
For background running:
docker-compose up -d
Stop the service:
docker-compose down
Install uv (if not already installed):
curl -Ls https://astral.sh/uv/install.sh | sh
Clone the repository:
git clone <repository-url>
cd materials-project-mcp
Create and activate virtual environment:
uv venv
source .venv/bin/activate # Linux/macOS
# or
.venv\Scripts\activate # Windows
Install dependencies:
uv pip install -r requirements.txt
Set your API key:
export MP_API_KEY="your-api-key" # Linux/macOS
# or
set MP_API_KEY=your-api-key # Windows
Test the installation:
python server.py
Locate your Claude configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
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-key
with your actual API key
Ensure Docker Desktop is running
Restart Claude Desktop
Verify installation:
Open VS Code Settings:
Ctrl+Shift+P
(Windows/Linux) or Cmd+Shift+P
(macOS)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-key
with your Materials Project API key/path/to/your/server.py
with the actual path to server.pyEnsure Docker Desktop is running (for Docker configurations)
Restart VS Code
Test in VS Code:
mcp dev server.py
Look for the line "🔗 Open inspector with token pre-filled:" and use that URLCreate a feature branch:
git checkout -b feature-name
Make 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 --build
Commit and push:
git add .
git commit -m "Add feature description"
git push origin feature-name
Open a pull request
"Invalid API key" error:
"Docker not found" or "Cannot connect to Docker daemon":
docker --version
to verify Docker is accessiblesudo systemctl start docker
Container startup issues:
Docker Compose issues:
docker-compose --version
.env
file exists and has the correct API keyMCP server not recognized in Claude:
mcp dev server.py
for interactive testing and debugging.Yin, Xiangyu. 2025. "Building an MCP Server for the Materials Project." March 23, 2025. https://xiangyu-yin.com/content/post_mp_mcp.html.
Integrates with Metabase for data visualization and business intelligence. Requires METABASE_URL, METABASE_USERNAME, and METABASE_PASSWORD environment variables.
Integrates with Trino and Iceberg for advanced data exploration, querying, and table maintenance.
Access financial statements, including income, balance sheets, and cash flow, for companies listed on the Securities Exchange of Thailand (SET).
Hydrolix time-series datalake integration providing schema exploration and query capabilities to LLM-based workflows.
An MCP server for interacting with a MongoDB database.
Manage MongoDB Atlas projects, including cluster creation, user management, and network access configuration.
An MCP server that provides tools to interact with PostgreSQL databases.
Allows Claude AI to interact directly with MySQL databases.
A read-only MCP server for CSV files from CData, requiring an external JDBC driver for connection.
Access live U.S. congressional data from the Congress.gov API.