Skip to content

MCP Server for Molecular Verification

The Molecular Verifier Server includes MCP (Model Context Protocol) support, enabling integration with language models and AI workflows that use the MCP standard.

Overview

The MCP server provides the same molecular verification capabilities as the REST API, but through an MCP-compatible interface. This allows seamless integration with AI systems that use MCP for tool calling and function execution.

Starting the MCP Server

To start the server with MCP support:

export DOCKING_ORACLE=autodock_gpu
export DATA_PATH=data
python mol_gen_docking/server_mcp.py

You should see output indicating both FastAPI and MCP server initialization:

INFO:     Uvicorn running on http://0.0.0.0:8000
INFO:     Application startup complete

MCP Tools

The server exposes several MCP tools for molecular verification:

  • Query Validation


    Tool: validate_query

    Endpoint: POST /validate_query/{task}

    Description: Validates a query for a specific task type (molecular generation, property prediction, or molecular reaction).

    Parameters:

    • query: MolecularVerifierServerQuery object or dictionary
    • task: Task type ("molecular_generation", "property_prediction", "molecular_reaction")

    Returns: Validation result with is_valid flag, errors, and validated query.

  • Available RDKit Properties


    Tool: get_available_rdkit_properties

    Endpoint: GET /get_available_rdkit_properties

    Description: Returns a list of all available RDKit properties that can be evaluated.

    Returns: List of property names (e.g., "QED", "logP", "SA", "CalcExactMolWt").

  • Available Docking Targets


    Tool: get_available_docking_targets

    Endpoint: GET /get_available_docking_targets

    Description: Returns available docking targets (receptors) for molecular generation.

    Returns: Dictionary mapping target descriptions to target IDs.

  • Reward Calculation


    Tool: compute_reward

    Endpoint: POST /get_reward_mcp

    Description: Computes reward scores for molecular generations based on specified properties and objectives.

    Parameters:

    • query: MolecularVerifierServerQuery containing completions and metadata

    Returns: BatchMolecularVerifierServerResponse with rewards and metadata.

  • Property Calculation


    Tool: get_properties

    Endpoint: POST /get_properties

    Description: Computes specific properties for given SMILES strings.

    Parameters:

    • smiles: List of SMILES strings
    • properties: List of property names to compute

    Returns: Dictionary mapping SMILES to property values.

Troubleshooting

For optimal performance with the MCP server, ensure the following configuration:

  • Batch Mode: The server should be configured to use batch processing mode for efficient handling of multiple requests.
  • Low Buffer Time: Set a low buffer time to minimize latency in processing requests.
  • Parsing Method: The parsing method must be set to none to ensure compatibility with the MCP protocol.

See Server Configuration for performance tuning options.