The Unofficial PubChem MCP Server provides access to the PubChem chemical database through the Model Context Protocol (MCP). It offers tools for searching and retrieving data on over 110 million chemical compounds, including molecular properties, bioassay data, and chemical informatics capabilities.
To set up the PubChem MCP Server:
# 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 can be integrated 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
When using the server, observe these 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
}
}
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.