The PubChem MCP Server provides a powerful interface to access the vast PubChem chemical database containing over 110 million chemical compounds. Through the Model Context Protocol (MCP), this server enables comprehensive search, retrieval, and analysis of chemical data, properties, bioassay information, and more.
To set up the PubChem MCP Server on your system:
# Clone or create the server directory
cd pubchem-server
# Install dependencies
npm install
# Build the server
npm run build
# Run the server
npm start
Access PubChem data through URI patterns:
pubchem://compound/{cid}
- Complete compound datapubchem://structure/{cid}
- 2D/3D structure informationpubchem://properties/{cid}
- Molecular propertiespubchem://bioassay/{aid}
- Bioassay datapubchem://similarity/{smiles}
- Similarity search resultspubchem://safety/{cid}
- Safety and toxicity data// Search for compounds by name
{
"tool": "search_compounds",
"arguments": {
"query": "aspirin",
"max_records": 10
}
}
// Get detailed compound information
{
"tool": "get_compound_info",
"arguments": {
"cid": 2244
}
}
// Find similar compounds
{
"tool": "search_similar_compounds",
"arguments": {
"smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
"threshold": 85,
"max_records": 50
}
}
// Analyze molecular properties
{
"tool": "get_compound_properties",
"arguments": {
"cid": 2244,
"properties": ["MolecularWeight", "XLogP", "TPSA"]
}
}
// Get bioassay information
{
"tool": "get_assay_info",
"arguments": {
"aid": 1159607
}
}
// Search compounds by target
{
"tool": "search_by_target",
"arguments": {
"target": "cyclooxygenase",
"max_records": 100
}
}
// Get safety classifications
{
"tool": "get_safety_data",
"arguments": {
"cid": 2244
}
}
// Process multiple compounds
{
"tool": "batch_compound_lookup",
"arguments": {
"cids": [2244, 5090, 3672],
"operation": "property"
}
}
This PubChem server integrates with other chemical/biological databases:
1. Target Discovery: UniProt → STRING → AlphaFold
2. Chemical Discovery: PubChem ← → ChEMBL
3. Complete Workflow: Protein → Structure → Interactions → Small Molecules → Bioactivity
Be aware of PubChem API guidelines:
// 1. Search for anti-inflammatory compounds
{
"tool": "search_compounds",
"arguments": {
"query": "anti-inflammatory",
"max_records": 100
}
}
// 2. Analyze drug-likeness
{
"tool": "assess_drug_likeness",
"arguments": {
"cid": 2244
}
}
// 3. Check safety profile
{
"tool": "get_safety_data",
"arguments": {
"cid": 2244
}
}
// 4. Find bioactivity data
{
"tool": "search_by_target",
"arguments": {
"target": "COX-2",
"activity_type": "IC50"
}
}
// 1. Find similar compounds
{
"tool": "search_similar_compounds",
"arguments": {
"smiles": "your_query_smiles",
"threshold": 90
}
}
// 2. Compare molecular properties
{
"tool": "batch_compound_lookup",
"arguments": {
"cids": [1234, 5678, 9012],
"operation": "property"
}
}
// 3. Analyze structural features
{
"tool": "analyze_stereochemistry",
"arguments": {
"cid": 1234
}
}
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "pubchem" '{"command":"npx","args":["-y","augmented-nature-pubchem-mcp-server"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"pubchem": {
"command": "npx",
"args": [
"-y",
"augmented-nature-pubchem-mcp-server"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"pubchem": {
"command": "npx",
"args": [
"-y",
"augmented-nature-pubchem-mcp-server"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect