Materials Project MCPのロゴ

Materials Project MCP

コミュニティ
benedictdebrah

A Model Context Protocol (MCP) server for querying the Materials Project database using the mpapi client.

公開者benedictdebrah
リポジトリmaterials-project-mcp
言語Jupyter Notebook
フォーク
3
スター
13
利用可能なツール
0
通信方式stdio
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    Materials Project MCPは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには13件のスターと3件のフォークがあります。

Materials Project MCP

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

  1. Visit Materials Project
  2. Create a free account or log in
  3. Go to your dashboard
  4. Navigate to API settings
  5. Generate or copy your API key
  6. Keep this key secure - you'll need it for setup

Installation Options

Step 1: Docker (Recommended)

Using Docker Run

  1. Install Docker Desktop:

    • Download from docker.com
    • Install and make sure Docker Desktop is running
  2. Pull the Docker image:

    bash
    docker pull benedict2002/materials-project-mcp
  3. Test the installation:

    bash
    docker run --rm -i -e MP_API_KEY="your-api-key" benedict2002/materials-project-mcp

Using Docker Compose (Easiest)

  1. Install Docker Desktop and make sure it's running

  2. Clone the repository:

    bash
    git clone <repository-url>
    cd materials-project-mcp
  3. Create a .env file:

    bash
    echo "MP_API_KEY=your-materials-project-api-key" > .env
  4. Test the setup:

    bash
    docker-compose up
  5. For background running:

    bash
    docker-compose up -d
  6. Stop the service:

    bash
    docker-compose down

Step 1 : Local Python Installation

  1. Install uv (if not already installed):

    bash
    curl -Ls https://astral.sh/uv/install.sh | sh
  2. Clone the repository:

    bash
    git clone <repository-url>
    cd materials-project-mcp
  3. Create and activate virtual environment:

    bash
    uv venv
    source .venv/bin/activate  # Linux/macOS
    # or
    .venv\Scripts\activate     # Windows
  4. Install dependencies:

    bash
    uv pip install -r requirements.txt
  5. Set your API key:

    bash
    export MP_API_KEY="your-api-key"  # Linux/macOS
    # or
    set MP_API_KEY=your-api-key       # Windows
  6. Test the installation:

    bash
    python server.py

Step 2 : Setup with Claude Desktop

  1. Locate your Claude configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Choose your configuration method:

    Using Docker Run

    json
    {
      "mcpServers": {
        "Materials Project MCP": {
          "command": "docker",
          "args": [
            "run", "--rm", "-i",
            "-e", "MP_API_KEY=your-materials-project-api-key",
            "benedict2002/materials-project-mcp"
          ]
        }
      }
    }
  3. Replace your-materials-project-api-key with your actual API key

  4. Ensure Docker Desktop is running

  5. Restart Claude Desktop

  6. 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

  1. Open VS Code Settings:

    • Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)
    • Type "Preferences: Open User Settings (JSON)"
    • Select it to open settings.json
  2. Add MCP configuration:

    json
    {
      "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
    }
  3. Alternative: Local Python setup for VS Code:

    json
    {
      "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
    }
  4. Replace placeholders:

    • your-api-key with your Materials Project API key
    • /path/to/your/server.py with the actual path to server.py
  5. Ensure Docker Desktop is running (for Docker configurations)

  6. Restart VS Code

  7. 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

  1. Test MCP server locally:
    bash
    mcp dev server.py
    Look for the line "🔗 Open inspector with token pre-filled:" and use that URL

Development Workflow

  1. Create a feature branch:

    bash
    git checkout -b feature-name
  2. Make your changes and test:

    bash
    # 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
  3. Commit and push:

    bash
    git add .
    git commit -m "Add feature description"
    git push origin feature-name
  4. Open 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

  1. "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
  2. "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 --version to verify Docker is accessible
    • On Windows/Mac: Open Docker Desktop application
    • On Linux: Start Docker service with sudo systemctl start docker
  3. 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
  4. Docker Compose issues:

    • Make sure Docker Compose is installed: docker-compose --version
    • Check your .env file exists and has the correct API key
    • Verify the docker-compose.yml file is in the correct location
    • Ensure Docker Desktop is running
  5. 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


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.

インストール

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "benedictdebrah-materials-project-mcp": {
      "command": "",
      "args": []
    }
  }
}

Materials Project MCPのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度Materials Project MCPに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

Materials Project MCPをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. Materials Project MCPのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "benedictdebrah-materials-project-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "materials-project-mcp"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてMaterials Project MCPのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. Materials Project MCPのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Materials Project MCPを使ってこのタスクを手伝ってもらえますか?
Materials Project MCP
はい、読みました。
Materials Project MCPで調べた結果をお伝えします。

よくある質問

Materials Project MCP MCPサーバーは何に使いますか?

Materials Project MCPは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでMaterials Project MCP MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでMaterials Project MCPを利用できます。

TypingMindでMaterials Project MCP MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。Materials Project MCPを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

Materials Project MCP MCPをTypingMindに接続するにはどうすればよいですか?

Materials Project MCPはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでMaterials Project MCP MCPのどのようなツールを利用できますか?

Materials Project MCPはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

Materials Project MCP MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。Materials Project MCPで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇