Inspiration

Structural biology depends on interactive molecular viewers, but those viewers were designed almost entirely for humans. A researcher can see a ligand, recognize a binding pocket, select atoms, measure distances, and interpret molecular context. A browser-based AI agent usually cannot.

Most of the scientifically meaningful state in a molecular viewer lives behind a WebGL canvas and specialized internal data structures. Traditional browser automation can press buttons and read accessible text, but it cannot reliably answer questions such as:

  • Which exact residue is selected?
  • Is the displayed number using author or label numbering?
  • Which atom coordinates the metal?
  • Which interactions cross from a ligand into its environment?
  • Does a measurement actually exist in viewer state?
  • Can the result be reproduced without fragile pixel coordinates?

We built Mol* WebMCP to close that gap. Our goal is to turn Mol* from a webpage an agent can operate into a scientific instrument that researchers and agents can use together.

What it does

Mol* WebMCP adds an agent-native interface to the standard Mol* molecular viewer. Researchers can describe a scientific objective in natural language while an AI agent combines ordinary viewer interaction with structured molecular operations.

The integration enables agents to:

  • Load and inspect molecular structures.
  • Address models, chains, residues, ligands, and atoms through canonical selectors.
  • Resolve author and label residue numbering.
  • Find ligands and calculate binding-site environments.
  • Separate ligand-to-pocket contacts from interactions internal to the pocket.
  • Identify hydrogen bonds, metal coordination, aromatic interactions, and water-mediated contacts.
  • Measure distances, angles, and dihedrals.
  • Retrieve secondary structure, solvent-accessible surface area, validation data, structural connections, and other computed context.
  • Create components and molecular representations.
  • Control focus, selection, visibility, color, transparency, camera position, and rendering.
  • Read measurements and other results back from viewer state.
  • Track the provenance of agent actions and undo reversible mutations.

The human remains responsible for the scientific question and interpretation. The agent translates that intent into precise operations, returns structured evidence, and leaves the resulting scene open for human inspection.

Demo workflow

Our demonstration uses human deoxyhemoglobin, PDB entry 4HHB.

From one research request, the agent:

  1. Loads and inspects the structure.
  2. Reports its model, chains, and residue counts.
  3. Selects HEM A142 using canonical structure and residue information.
  4. Finds all residues within (5\ \text{Å}) of the heme.
  5. Separately calculates ligand–environment contacts and the pocket’s internal interaction network.
  6. Identifies His A87 NE2 as the proximal ligand coordinating the heme iron.
  7. Creates and verifies the Fe–N measurement:

$$ d(\mathrm{Fe},\mathrm{N}_{\varepsilon 2}) = 2.14\ \text{Å} $$

  1. Retrieves secondary-structure and solvent-accessibility context.
  2. Builds a focused molecular scene in which the ligand and environment are visually distinct.
  3. Confirms that the numeric measurement exists in Mol* state rather than merely reading a label from the screen.

The final result remains a live, editable Mol* workspace—not a generated image or disconnected report.

Why WebMCP

This project is a particularly strong fit for WebMCP because the difficult part is not generating text. It is connecting natural-language intent to a rich, stateful scientific application.

Browser controls remain useful for simple operations such as opening Mol* and entering a PDB identifier. WebMCP becomes essential when the task requires exact object identity, domain calculations, reliable composition of multiple operations, or numeric verification.

Before WebMCP, an agent could attempt to drive Mol* through clicks, screenshots, DOM inspection, and pixel coordinates. That approach was fragile because:

  • Molecular objects rendered in WebGL do not naturally expose semantic DOM elements.
  • Visually similar residues can have different chain or numbering identities.
  • Scientific calculations cannot be reconstructed reliably from pixels.
  • Multi-step selections are vulnerable to small UI and camera changes.
  • A visible label does not prove that a measurement or selection exists in application state.
  • Returning a polished result requires coordinating selections, representations, colors, and camera state.

WebMCP gives the agent typed tools and structured results grounded in Mol*’s actual molecular model. The agent can therefore operate at the same semantic level as the researcher: structures, residues, atoms, contacts, measurements, and representations.

How we built it

We extended vanilla Mol* with a WebMCP integration layer that registers structured tools through document.modelContext.registerTool(...).

The implementation includes:

  • A canonical selector language for structures, chains, residue ranges, atoms, spatial surroundings, unions, intersections, and subtraction.
  • Tool schemas that validate agent inputs before they reach Mol*.
  • Structured outputs containing canonical residue and atom identities.
  • Read-only tools for inspection and scientific analysis.
  • Mutation tools for selection, focus, visualization, measurements, and camera control.
  • Explicit separation between ligand-crossing contacts and interactions internal to a selected region.
  • Result pagination for large molecular datasets.
  • Provenance tracking and reversible viewer mutations.
  • Numeric readback from Mol* state so the agent can verify its own work.

This design preserves Mol* as the source of truth. WebMCP does not reproduce molecular logic in the language model; it exposes Mol*’s existing capabilities through a precise, agent-accessible contract.

Challenges we faced

Designing selectors agents can use safely

Molecular identity is more complicated than “chain A, residue 10.” Structures may contain author and label chain identifiers, insertion codes, multiple models, assemblies, ligands, waters, and repeated numbering. We needed selectors that were expressive without being ambiguous.

Returning useful scientific results

Raw Mol* data can be extremely large. We had to return enough detail for scientific verification while keeping results manageable for an agent. Canonical identities, summaries, ranges, and expandable paginated results became essential.

Separating similar-looking operations

“Find contacts around this ligand” can mean several different analyses. Ligand-to-environment interactions and interactions internal to the surrounding pocket answer different scientific questions, so we exposed them as distinct operations rather than blending their results.

Keeping the human in the loop

An agent should not leave the researcher with only a textual conclusion. It must also construct a clear scene, expose what it changed, and leave Mol* in a state the researcher can inspect, adjust, or undo.

Recovering from numbering and selection errors

Agents sometimes begin with incomplete selectors or the wrong numbering convention. The integration returns actionable errors and provides selector guidance, canonical identifiers, and loaded-structure references so the agent can recover rather than silently selecting the wrong object.

What we learned

WebMCP is most powerful when it complements the interface instead of replacing it.

Humans remain better at forming hypotheses, recognizing meaningful visual patterns, and deciding what deserves investigation. Agents are valuable for exact selection, repetitive analysis, structured calculation, verification, and composing many viewer operations without losing context.

We also learned that scientific agents need more than actions. They need readback, provenance, and recoverability. A trustworthy workflow must let the agent confirm what changed and let the researcher inspect or reverse those changes.

Potential impact

Mol* is used across structural biology, medicinal chemistry, protein science, education, and drug discovery. Making its scientific capabilities available to agents could help:

  • Researchers explore unfamiliar structures faster.
  • Medicinal chemists compare ligand environments with less manual setup.
  • Students ask questions directly against a live molecular model.
  • Collaborators create reproducible views from shared natural-language instructions.
  • Scientists with motor or visual accessibility needs operate complex molecular tools more easily.
  • Automated workflows prepare analyses while preserving a human-verifiable viewer state.

The larger idea extends beyond Mol*. Scientific web applications can become shared workspaces where humans contribute judgment and agents contribute precision—without hiding the underlying evidence.

What’s next

We want to extend the project with:

  • Reusable, shareable analysis workflows.
  • Multi-structure comparison and mutation analysis.
  • Stronger provenance exports for publications and notebooks.
  • Additional density, trajectory, validation, and annotation tools.
  • Domain-specific safety and confirmation policies.
  • Benchmark tasks for measuring the accuracy of agent-driven molecular analysis.

Mol* WebMCP demonstrates a future in which a scientist can ask a biological question, watch an agent carry out the analysis, verify every result in the original scientific application, and continue the investigation from the exact state the agent created.

Built With

Share this project:

Updates

Submission history