Labsco
JackKuo666 logo

PubChem MCP Server

โ˜… 5

from JackKuo666

Search and access chemical compound information from the PubChem database.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

PubChem MCP Server

smithery badge

๐Ÿงช Enable AI assistants to search and access chemical compound information through a simple MCP interface.

The PubChem MCP Server provides a bridge between AI assistants and PubChem's chemical database through the Model Context Protocol (MCP). It allows AI models to search for chemical compounds and access their detailed information in a programmatic way.

๐Ÿค Contribute โ€ข ๐Ÿ“ Report Bug

โœจ Core Features

  • ๐Ÿ”Ž Compound Search: Query PubChem compounds by name, SMILES, or CID โœ…
  • ๐Ÿงช Chemical Structure: Access molecular structures and identifiers โœ…
  • ๐Ÿ“Š Property Data: Retrieve detailed chemical and physical properties โœ…
  • ๐Ÿ”ฌ Advanced Search: Combine multiple parameters for precise queries โœ…
  • ๐Ÿงฌ Molecular Visualization: Generate and display molecular structures ๐Ÿ“
  • ๐Ÿ“ˆ Property Analysis: Compare properties across multiple compounds ๐Ÿ“
  • ๐Ÿ—ƒ๏ธ Local Storage: Save frequently used compounds for faster access ๐Ÿ“
  • ๐Ÿ“ Chemistry Prompts: Specialized prompts for chemical analysis ๐Ÿ“

๐Ÿ›  MCP Tools

The PubChem MCP Server provides the following tools:

search_pubchem_by_name

Search for chemical compounds on PubChem using a compound name.

Parameters:

  • name (str): Name of the chemical compound
  • max_results (int, optional): Maximum number of results to return (default: 5)

Returns: List of dictionaries containing compound information

search_pubchem_by_smiles

Search for chemical compounds on PubChem using a SMILES string.

Parameters:

  • smiles (str): SMILES notation of the chemical compound
  • max_results (int, optional): Maximum number of results to return (default: 5)

Returns: List of dictionaries containing compound information

get_pubchem_compound_by_cid

Fetch detailed information about a chemical compound using its PubChem CID.

Parameters:

  • cid (int): PubChem Compound ID (CID)

Returns: Dictionary containing compound information

search_pubchem_advanced

Perform an advanced search for compounds on PubChem.

Parameters:

  • name (str, optional): Name of the chemical compound
  • smiles (str, optional): SMILES notation of the chemical compound
  • formula (str, optional): Molecular formula
  • cid (int, optional): PubChem Compound ID
  • max_results (int, optional): Maximum number of results to return (default: 5)

Returns: List of dictionaries containing compound information

๐Ÿ“ TODO

visualize_compound

Generate and display a 2D or 3D visualization of a chemical compound.

compare_compounds

Compare properties and structures of multiple compounds.

save_compound

Save a compound locally for faster access.

list_saved_compounds

List all saved compounds.

๐Ÿ“ Chemistry Prompts

The server will offer specialized prompts to help analyze chemical compounds:

Compound Analysis Prompt

A comprehensive workflow for analyzing chemical compounds that only requires a compound ID:

result = await call_prompt("deep-compound-analysis", {
    "compound_id": "2244"
})

This prompt will include:

  • Detailed instructions for using available tools
  • A systematic workflow for compound analysis
  • Comprehensive analysis structure covering:
    • Chemical structure and properties
    • Pharmacological properties
    • Biological activities
    • Applications and uses
    • Safety and toxicity information
    • Related compounds

๐Ÿ“ Project Structure

  • pubchem_server.py: The main MCP server implementation using FastMCP
  • pubchem_search.py: Contains example code for searching PubChem

๐Ÿ”ง Dependencies

  • Python 3.10+
  • FastMCP
  • asyncio
  • logging
  • pubchempy (for PubChem API access)
  • pandas (for data handling)

You can install the required dependencies using:

pip install mcp pubchempy pandas

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License.

โš ๏ธ Disclaimer

This tool is for research purposes only. Please respect PubChem's terms of service and use this tool responsibly.