PubChem MCP Server

by jackkuo666

5 stars
125 downloads
Not rated
GitHub

About

Search and access chemical compound information from the PubChem database.

Details

Author
jackkuo666
GitHub stars
5
Downloads
125
Categories
Search, Other, Database
Tags
#research, #bioinformatics

- Compound search by name, SMILES, or CID
- Access molecular structures and identifiers
- Retrieve detailed chemical and physical properties
- Advanced search combining multiple parameters

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name PubChem MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install via Smithery (e.g., npx -y @smithery/cli@latest install @JackKuo666/pubchem-mcp-server --client claude) or manually with uv tool install pubchem-mcp-server. Start the server with python pubchem_server.py. The server provides MCP tools such as search_pubchem_by_name, search_pubchem_by_smiles, get_pubchem_compound_by_cid, and search_pubchem_advanced.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "pubchem mcp server": {
            "PubChem-MCP-Server": {
                "command": "npx",
                "args": [
                    "-y",
                    "@smithery/cli@latest",
                    "install",
                    "@JackKuo666/pubchem-mcp-server",
                    "--client",
                    "claude",
                    "--config",
                    "{}"
                ]
            }
        }
    }
}

McpServers

{
    "PubChem-MCP-Server": {
        "command": "npx",
        "args": [
            "-y",
            "@smithery/cli@latest",
            "install",
            "@JackKuo666/pubchem-mcp-server",
            "--client",
            "claude",
            "--config",
            "{}"
        ]
    }
}

πŸ§ͺ 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.

- πŸ”Ž 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 πŸ“

To install PubChem Server for Claude Desktop automatically viaSmithery:

npx -y @smithery/cli@latest install @JackKuo666/pubchem-mcp-server --client claude --config "{}"

Paste the following into Settings β†’ Cursor Settings β†’ MCP β†’ Add new server:

npx -y @smithery/cli@latest run @JackKuo666/pubchem-mcp-server --client cursor --config "{}"
npx -y @smithery/cli@latest install @JackKuo666/pubchem-mcp-server --client windsurf --config "{}"
npx -y @smithery/cli@latest install @JackKuo666/pubchem-mcp-server --client cline --config "{}"
# Clone and set up development environment git clone https://github.com/JackKuo666/PubChem-MCP-Server.git cd PubChem-MCP-Server # Create and activate virtual environment uv venv source .venv/bin/activate uv pip install -r requirements.txt

Once the server is running, you can use the provided MCP tools in your AI assistant or application. Here are some examples of how to use the tools:

result = await mcp.use_tool("search_pubchem_by_name", { "name": "aspirin", "max_results": 3 }) print(result)

Example 2: Search for compounds by SMILES notation

result = await mcp.use_tool("search_pubchem_by_smiles", { "smiles": "CC(=O)OC1=CC=CC=C1C(=O)O", # Aspirin's SMILES "max_results": 2 }) print(result)

Example 3: Get detailed information for a specific compound

result = await mcp.use_tool("get_pubchem_compound_by_cid", { "cid": 2244 # Aspirin's CID }) print(result)

Example 4: Perform an advanced search with multiple parameters

result = await mcp.use_tool("search_pubchem_advanced", { "name": "caffeine", "formula": "C8H10N4O2", "max_results": 2 }) print(result)

These examples demonstrate how to use the four main tools provided by the PubChem MCP Server. Adjust the parameters as needed for your specific use case.

The PubChem MCP Server provides the following tools:

Search for chemical compounds on PubChem using a compound name.

- 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 for chemical compounds on PubChem using a SMILES string.

- 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

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

Returns:Dictionary containing compound information

Perform an advanced search for compounds on PubChem.

- 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

Add this configuration to yourclaude_desktop_config.json:

{ "mcpServers": { "pubchem": { "command": "python", "args": ["-m", "pubchem-mcp-server"] } } }
{ "mcpServers": { "pubchem": { "command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Programs\\Python\\Python311\\python.exe", "args": [ "-m", "pubchem-mcp-server" ] } } }
{ "mcpServers": { "pubchem": { "command": "bash", "args": [ "-c", "source /home/YOUR/PATH/mcp-hub/PubChem-MCP-Server/.venv/bin/activate && python /home/YOUR/PATH/mcp-hub/PubChem-MCP-Server/pubchem_server.py" ], "env": {}, "disabled": false, "autoApprove": [] } } }

After restarting Claude Desktop, the following capabilities will be available:

You can ask Claude to search for chemical compounds using queries like:

Can you search PubChem for information about aspirin?

The search will return basic information about matching compounds including:

Once you have a CID, you can ask for more details:

Can you show me the details for compound with CID 2244?

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

Compare properties and structures of multiple compounds.

Save a compound locally for faster access.

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

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

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

- 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

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

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

You can install the required dependencies using:

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

This project is licensed under the MIT License.

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

Search global news using natural language. Webz.io News Search API returns the most relevant articles and content, with filters for source, country, language, date, sentiment, and category.

A search server for PubMed, the biomedical literature database, using a pure Node.js implementation.

Extracts basic chemical information about drugs and compounds from the PubChem API.

Access and interact with Allen Institute for Neural Dynamics (AIND) metadata directly within your IDE.

A high-performance JavaScript server for the Alliance of Genome Resources (AGR) MCP.

Access the AlphaFold Protein Structure Database for protein structure prediction and analysis.

Interface with Biomart, a biological data query tool, using the pybiomart Python package.

Agent-first rewrite of genomeoncology's BioMCP in TypeScript to provide next-gen biomedical data access for agents.

Perform complex queries on the DANDI Archive, a platform for neurophysiology data.

Interact with DROMA drug-omics association analysis databases using natural language.

A bridge to the Drug Gene Interaction Database (DGIdb) API, enabling AI clients to query drug-gene interaction data.

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.