Dianshi
MCP / Model Context Protocol

Bring Dianshi chemistry search into your AI workflow

A protected Streamable HTTP MCP endpoint lets models call substance, reaction, reference, and similarity search tools as composable research steps.

Endpoint
/api/mcp
Transport
Streamable HTTP
Authentication
Bearer SSO Token

How to use MCP tools

The MCP service is served by a Next.js API route. Enable MCP, then configure the same HTTP endpoint and Authorization header in your MCP client.

1. Configure your MCP client

Add the Dianshi endpoint in a Streamable HTTP capable MCP client and include the SSO Bearer Token.

Checking sign-in status...
{
  "mcpServers": {
    "dianshi": {
      "url": "https://dianshi.opendatalab.org.cn/api/mcp",
      "headers": {
        "Authorization": "Bearer <SSO_TOKEN>"
      }
    }
  }
}

2. Let the model call tools

After connection, the model can choose tools such as substance_search, reaction_conditions, or reference_search.

tool: substance_similarity
arguments: {
  "smiles": "CCO",
  "threshold": 0.55,
  "limit": 10
}

How to test MCP tools

Validate from low risk to real queries: auth and tool listing first, health_check next, then structure and reaction similarity tools.

Call tools/list with a valid token and confirm all 14 tools are registered.
Call health_check first to verify database connectivity and core table counts.
Test low-cost queries such as substance_search and reference_search with a small limit.
Then test RDKit-backed tools such as substance_similarity, substance_substructure, and reaction_similar_diff_bfp.
tools/list
curl -X POST https://dianshi.opendatalab.org.cn/api/mcp \
  -H 'Authorization: Bearer <SSO_TOKEN>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
tools/call
curl -X POST https://dianshi.opendatalab.org.cn/api/mcp \
  -H 'Authorization: Bearer <SSO_TOKEN>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"health_check","arguments":{}}}'

MCP capabilities

The current surface covers database health, substance search, reaction search, and reference search. Structure tools depend on the RDKit cartridge and valid SMILES input.

Substance search

Search by name, SMILES, InChI Key, synonym, similarity, or substructure.

substance_searchsubstance_get_by_idsubstance_similaritysubstance_substructure

Reaction search

Search reaction SMILES, find reactions by product, and load examples, conditions, reagents, and yields.

reaction_searchreaction_get_by_hashreaction_conditionsreaction_by_product

Reaction similarity

Search related reactions by topology, split difference bit fingerprints, or Morgan difference fingerprints.

reaction_similar_structreaction_similar_diff_bfpreaction_similar_diff_morgan

Reference search

Full-text reference search plus detail lookup with DOI, abstract preview, and relationship counts.

reference_searchreference_get_by_id

Tool matrix

Every tool returns a JSON text payload so models can keep parsing and citing results.

14 tools
Operations
health_check
Checks database connectivity and returns core table counts.
Substances
substance_search
Search substances by keyword, SMILES, InChI Key, or synonym.
substance_get_by_id
Fetch a substance by substance_id.
substance_similarity
Run Morgan fingerprint Tanimoto similarity search.
substance_substructure
Find substances containing the query structure.
Reactions
reaction_search
Search reaction groups by canonical_rxn_smiles fragment.
reaction_get_by_hash
Fetch a reaction group and example instances by reaction_hash.
reaction_conditions
Load conditions, yields, solvents, catalysts, and reagents.
reaction_by_product
Find reactions by product structure similarity.
reaction_similar_struct
Search similar reactions by structural reaction fingerprint.
reaction_similar_diff_bfp
Search transformations by difference AtomPair bit fingerprint.
reaction_similar_diff_morgan
Search transformations by Morgan difference fingerprint.
References
reference_search
Search references with PostgreSQL full-text search.
reference_get_by_id
Fetch reference details and relationship counts by reference_id.

Integration notes

Every request needs Authorization: Bearer <SSO_TOKEN>.
Each tool is counted independently.
JSON-RPC batches are checked item by item; allowed tools run normally, while exhausted tools return an isError result in the same batch.
RDKit-backed tools require valid SMILES or reaction SMILES and return MCP tool errors for invalid input.
Server-side limit clamping is applied; start debugging with small result sets of 5 to 10.