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:
You should see output indicating both FastAPI and MCP server initialization:
MCP Tools
The server exposes several MCP tools for molecular verification:
-
Query Validation
Tool:
validate_queryEndpoint:
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 dictionarytask: Task type ("molecular_generation", "property_prediction", "molecular_reaction")
Returns: Validation result with is_valid flag, errors, and validated query.
-
Reward Calculation
Tool:
compute_rewardEndpoint:
POST /get_reward_mcpDescription: 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_propertiesEndpoint:
POST /get_propertiesDescription: Computes specific properties for given SMILES strings.
Parameters:
smiles: List of SMILES stringsproperties: List of property names to compute
Returns: Dictionary mapping SMILES to property values.
-
REINVENT Training
Tool:
train_reinvent_generatorEndpoint:
POST /train_reinvent_generatorDescription: Train a REINVENT model with custom metadata for reward definition.
Parameters:
params: Training parameters including model configuration and metadata
Returns: Response including status, job_id, message, and timestamp.
-
Training Status
Tool:
get_training_statusEndpoint:
POST /get_training_status/{job_id}Description: Get the status of a REINVENT training job.
Parameters:
job_id: The job identifier returned by train_reinvent_generator
Returns: Job status information including status, timestamps, and output.
-
Molecule Visualization
Tool:
display_moleculeEndpoint:
POST /display_molecule/{smiles}Description: Generate a 2D ASCII art depiction of a molecule from a SMILES string.
Parameters:
smiles: SMILES string to visualize
Returns: ASCII art representation of the molecule.
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
noneto ensure compatibility with the MCP protocol.
See Server Configuration for performance tuning options.