Skip to main content
Glama
lukasmki

Chemspace MCP Server

by lukasmki

chemspace-mcp

A Model Context Protocol (MCP) server that provides a wrapper for the Chemspace API, enabling AI agents to search for synthesizable building blocks and screening compounds through exact, substructure, and similarity searches.

Features

  • Exact Search: Find exact molecular matches by SMILES

  • Substructure Search: Find compounds containing a specific substructure

  • Similarity Search: Find structurally similar compounds by SMILES

  • Multiple Product Categories: Search across in-stock and make-on-demand compounds

  • Global Shipping: Specify shipping countries with ISO country codes

Related MCP server: PubChem MCP Server

Requirements

  • Python 3.13+

  • Chemspace API key

Installation

Prerequisites

Install uv:

# macOS
brew install uv

# Linux/WSL2  
curl -LsSf https://astral.sh/uv/install.sh | sh

Setup

  1. Clone the repository and navigate to the project directory

  2. Set your Chemspace API key as an environment variable:

    export CHEMSPACE_API_KEY="your-api-key-here"
  3. Install dependencies and run:

    uv run chemspace-mcp

Configuration

For use with FastAgent

Configure example/fastagent.secrets.yaml. Environment variables set here will override the ones in your shell:

anthropic:
  api_key: your-anthropic-api-key

mcp:
  servers:
    chemspace:
      env:
        CHEMSPACE_API_KEY: your-chemspace-api-key

Then run the example interface with FastAgent:

cd example
uv run --extra agent agent.py

Usage

The MCP server exposes the following tools:

search_exact

Searches for exact molecular matches by SMILES string.

Parameters:

  • smiles (string): The SMILES string to search for

  • shipToCountry (string): Two-letter ISO country code (default: "US")

  • count (integer): Maximum results per page (default: 10)

  • page (integer): Page number for pagination (default: 1)

  • categories (list): Product categories to search:

    • CSSB: In-stock building blocks

    • CSSS: In-stock screening compounds

    • CSMB: Make-on-demand building blocks

    • CSMS: Make-on-demand screening compounds

    • CSCS: Custom requests

search_substructure

Searches for compounds containing a specific substructure.

Parameters: Same as search_exact

search_similarity

Searches for structurally similar compounds.

Parameters: Same as search_exact

Project Structure

chemspace-mcp/
├── src/
│   └── chemspace_mcp/
│       ├── __init__.py          # Entry point and MCP server initialization
│       ├── tools.py             # Tool definitions for chemical searches
│       └── tokenmanager.py       # Token management for API authentication
├── example/
│   ├── agent.py                 # Example FastAgent integration
│   ├── fastagent.config.yaml    # FastAgent configuration
│   └── fastagent.secrets.yaml   # Secrets configuration (not in version control)
├── pyproject.toml               # Project metadata and dependencies
└── README.md                    # This file

Development

Dependencies

  • fastmcp>=2.13.1: Core MCP server framework

  • fast-agent-mcp>=0.2.25: FastAgent integration

License

MIT License

Support

For issues or questions, please open an issue on the project repository.

Available Tools

3 tools
search_exactC

Exact search by SMILES

ParametersJSON Schema
NameRequiredDescriptionDefault
smilesYes
shipToCountryNoThe country you want your order to be shipped to as two-letter country ISO code, e.g DE, US, FRUS
countNoMaximum number of results on a page
pageNoNumber of the page
categoriesNoA list of product categories to searchCSSB - In-stock building blocksCSSS - In-stock screening compoundsCSMB - Make-on-demand building blocksCSMS - Make-on-demand screening compoundsCSCS - Custom request

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It mentions 'exact search' which implies precision matching, but doesn't cover aspects like rate limits, authentication needs, response format, or what happens with no matches. This leaves significant gaps for a tool with 5 parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just three words, front-loading the core purpose with zero wasted language. It's appropriately sized for a simple statement of function, though this brevity contributes to gaps in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, no output schema, no annotations), the description is inadequate. It doesn't explain return values, error conditions, or how parameters interact (e.g., pagination with count/page). For a search tool with multiple configuration options, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter-specific information beyond the schema. With 80% schema description coverage (4 out of 5 parameters have descriptions), the baseline is 3. The description doesn't compensate for the 20% gap (the 'smiles' parameter lacks schema description), nor does it provide additional context like SMILES format examples or search behavior details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Exact search by SMILES' clearly states the verb ('search') and resource ('by SMILES'), indicating it performs a precise chemical structure lookup. However, it doesn't explicitly differentiate from sibling tools like 'search_similarity' or 'search_substructure' beyond the 'exact' qualifier, which is why it doesn't reach a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of sibling tools like 'search_similarity' or 'search_substructure', nor any context about specific use cases, prerequisites, or exclusions for exact searching.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_similarityC

Similarity search by SMILES

ParametersJSON Schema
NameRequiredDescriptionDefault
smilesYes
shipToCountryNoThe country you want your order to be shipped to as two-letter country ISO code, e.g DE, US, FRUS
countNoMaximum number of results on a page
pageNoNumber of the page
categoriesNoA list of product categories to searchCSSB - In-stock building blocksCSSS - In-stock screening compoundsCSMB - Make-on-demand building blocksCSMS - Make-on-demand screening compoundsCSCS - Custom request

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'search' but doesn't clarify if this is a read-only operation, what the output format might be, potential rate limits, authentication needs, or any side effects. For a search tool with 5 parameters and no annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence with no wasted words, making it easy to parse and front-loaded with the core purpose. It's appropriately sized for the tool's complexity, though it could benefit from more detail without sacrificing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, how results are structured, or provide context for parameters like 'shipToCountry' that seem unrelated to similarity search, leaving gaps in understanding the tool's full behavior and use case.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter semantics beyond the input schema, which has 80% coverage (4 out of 5 parameters have descriptions). Since schema coverage is high (>80%), the baseline score is 3, as the schema adequately documents most parameters, and the description doesn't compensate or add extra meaning for the undocumented 'smiles' parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Similarity search by SMILES' states the action (search) and resource (SMILES), but it's vague about what exactly is being searched (e.g., chemical compounds, databases) and doesn't differentiate from sibling tools like 'search_exact' or 'search_substructure', which likely perform different types of chemical searches. It provides a basic purpose but lacks specificity and distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no guidance on when to use this tool versus alternatives like 'search_exact' or 'search_substructure', nor does it mention any prerequisites or contextual cues for its application. It's a standalone statement with no usage instructions, leaving the agent to infer based on the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_substructureC

Substructure search by SMILES

ParametersJSON Schema
NameRequiredDescriptionDefault
smilesYes
shipToCountryNoThe country you want your order to be shipped to as two-letter country ISO code, e.g DE, US, FRUS
countNoMaximum number of results on a page
pageNoNumber of the page
categoriesNoA list of product categories to searchCSSB - In-stock building blocksCSSS - In-stock screening compoundsCSMB - Make-on-demand building blocksCSMS - Make-on-demand screening compoundsCSCS - Custom request

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'search' but fails to describe key traits such as whether this is a read-only operation, potential rate limits, authentication needs, or what the search returns (e.g., results format, pagination). This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single sentence 'Substructure search by SMILES', which is front-loaded and wastes no words. It efficiently communicates the core purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral traits, result handling, and differentiation from siblings, making it inadequate for the agent to fully understand and use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is high at 80%, providing good documentation for parameters like 'shipToCountry', 'count', 'page', and 'categories'. The description adds minimal value by specifying 'SMILES' as the search input, but it doesn't explain parameter interactions or usage beyond what the schema already covers, aligning with the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Substructure search by SMILES' clearly indicates the action (search) and resource (substructures), but it's vague about what exactly is being searched (e.g., chemical compounds, databases) and doesn't distinguish it from sibling tools like 'search_exact' or 'search_similarity'. It states the purpose but lacks specificity and differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search_exact' or 'search_similarity'. There's no mention of context, prerequisites, or exclusions, leaving the agent without direction on tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updates
    • First observedsearch_exact
    • First observedsearch_similarity
    • First observedsearch_substructure

TDQS

B3.4/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no ambiguity: exact search, similarity search, and substructure search are well-defined and non-overlapping operations in cheminformatics. The descriptions specify different search types, making it easy for an agent to select the correct tool based on the required search method.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with 'search_' as the prefix, followed by a descriptive term (exact, similarity, substructure). This uniformity makes the tool set predictable and easy to understand, with no deviations in naming conventions.

Tool Count5/5

With 3 tools, the server is well-scoped for its purpose of chemical search operations. Each tool earns its place by covering distinct search methods, and the count is appropriate for the domain without being too thin or heavy, allowing focused functionality.

Completeness4/5

The tool set provides comprehensive coverage for search operations in cheminformatics, including exact, similarity, and substructure searches. A minor gap exists in the lack of tools for additional chemical data operations like property retrieval or filtering, but the core search workflows are complete and functional.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Enables AI agents and applications to search, retrieve, and analyze chemical compounds, substances, and bioassays from PubChem's vast chemical information database through comprehensive tools for chemical research and discovery.
    10
    133 npm
    9
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to search and retrieve chemical compound information, structures, and physical properties from the PubChem database. It supports querying via compound names, SMILES notation, or CIDs to provide detailed molecular data for chemical analysis.
    5
    -
  • F
    license
    B
    quality
    D
    maintenance
    Provides computational chemistry tools for LLMs, enabling molecular operations like SMILES processing and geometry manipulation via a modular agent and tool system.
    9
    -