MCP cover image
See in Github
2025-03-31

使大型语言模型能够正确查询分子数据库并生成结构文件

1

Github Watches

3

Github Forks

3

Github Stars

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:

<use_mcp_tool>
<server_name>pubchem</server_name>
<tool_name>get_pubchem_data</tool_name>
<arguments>
{
  "query": "aspirin",
  "format": "JSON"
}
</arguments>
</use_mcp_tool>

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:

<use_mcp_tool>
<server_name>pubchem</server_name>
<tool_name>download_structure</tool_name>
<arguments>
{
  "cid": "2244",
  "format": "sdf"
}
</arguments>
</use_mcp_tool>

Project Structure

pubchem-mcp-server/
├── python_version/               # Python implementation
│   ├── mcp_server.py             # Main MCP server script
│   ├── setup.py                  # Package installation script
│   ├── pubchem_mcp_server/       # Core package
│   │   ├── __init__.py
│   │   ├── pubchem_api.py        # PubChem API interaction
│   │   ├── xyz_utils.py          # 3D structure and XYZ format utilities
│   │   ├── server.py             # MCP server implementation
│   │   ├── cli.py                # Command-line interface
│   │   └── async_processor.py    # Asynchronous request handling
└── LICENSE

Caching

The server uses a caching mechanism to improve performance:

  • API responses are cached in memory
  • 3D structure data is cached in ~/.pubchem-mcp/cache/

License

This project is licensed under the MIT License - see the LICENSE file for details.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • modelcontextprotocol
  • 模型上下文协议服务器

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

    Reviews

    1 (1)
    Avatar
    user_UE6bdMRV
    2025-04-15

    As a loyal user of the MCP app, I can confidently say that the Cloudflare MCP Server is a game-changer. Developed by BlakeB254, this server is incredibly reliable and secure. Its seamless integration with Cloudflare ensures top-notch performance, making it an essential tool for any serious developer. Highly recommended!