PP

phelanshao/pubchem-mcp-server

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

7 stars 5 forks 품질 53 트렌드 15

Enables large language models to correctly query molecular databases and generate structure files

개요

A Model Context Protocol (MCP) server for retrieving chemical compound data from PubChem database. PubChem MCP Server is a Python implementation of an MCP server that allows AI models to query chemical compound information from the PubChem database. It provides easy access to compound properties, 2D structures, and 3D molecular coordinates through a standard MCP interface. - Query compounds by name or PubChem CID - Retrieve comprehensive compound data including: - IUPAC name - Molecular formula - Molecular weight - SMILES notation - InChI and InChIKey - Support for multiple output formats: - JSON (default) - CSV - XYZ (3D structure) - Built-in caching system to improve performance - Automatic retry mechanism for API reliability - Fallback 3D structure generation if PubChem 3D is unavailable - Python 3.

README

원문 README의 일부입니다. 원문 보기.

PubChem MCP Server

A Model Context Protocol (MCP) server for retrieving chemical compound data from PubChem database.

Overview

PubChem MCP Server is a Python implementation of an MCP server that allows AI models to query chemical compound information from the PubChem database. It provides easy access to compound properties, 2D structures, and 3D molecular coordinates through a standard MCP interface.

Features

  • Query compounds by name or PubChem CID
  • Retrieve comprehensive compound data including:
    • IUPAC name
    • Molecular formula
    • Molecular weight
    • SMILES notation
    • InChI and InChIKey
  • Support for multiple output formats:
    • JSON (default)
    • CSV
    • XYZ (3D structure)
  • Built-in caching system to improve performance
  • Automatic retry mechanism for API reliability
  • Fallback 3D structure generation if PubChem 3D is unavailable

Requirements

  • Python 3.8+
  • Requests library
  • RDKit (optional, for enhanced 3D structure handling)

Installation

From Source

# Clone the repository
git clone https://github.com/yourusername/pubchem-mcp-server.git
cd pubchem-mcp-server/python_version

# Install the package
pip install -e .

# For enhanced 3D structure handling, install with RDKit
pip install -e ".[rdkit]"

MCP Configuration

To use the server with Claude or other MCP-capable AI models, add the following to your MCP configuration file:

{
  "mcpServers": {
    "pubchem": {
      "command": "python3",
      "args": ["/path/to/pubchem-mcp-server/python_version/mcp_server.py"],
      "env": {
        "PYTHONUNBUFFERED": "1"
      },
      "disabled": false,
      "autoApprove": [
        "get_pubchem_data",
        "download_structure"
      ]
    }
  }
}

Available Tools

get_pubchem_data

Retrieves chemical compound structure and property data.

Parameters:

  • query (required): Compound name or PubChem CID
  • format (optional): Output format - “JSON” (default), “CSV”, or “XYZ”
  • include_3d (optional): Whether to include 3D structure (only valid when format is “XYZ”)

Example use:


pubchem
get_pubchem_data

{
  "query": "aspirin",
  "format": "JSON"
}

download_structure

Downloads structure files for a compound.

Parameters:

  • cid (required): PubChem CID
  • format (optional): File format - “sdf” (default), “mol”, or “smi”
  • filename (optional): Custom filename for the downloaded structure

Example use:


pubchem
download_structure

{
  "cid": "2244",
  "format": "sdf"
}

Project Structure

pubchem-mcp-server/
├── python_version/               # Python implementation
GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "pubchem": { "command": "python3", "args": ["/path/to/pubchem-mcp-server/python_version/mcp_server.py"], "env": { "PYTHONUNBUFFERED": "1" }, "disabled": false, "autoApprove": [ "get_pubchem_data", "download_structure" ] } } }