Skip to main content
Glama
Flame MCP Server

Flame MCP Server

Official
by phi-grib

Flame MCP Server

MCP (Model Context Protocol) server for the Flame QSAR predictive modeling framework. Enables LLM agents to programmatically build, manage, and use QSAR models through a standardized tool interface.

Architecture

┌───────────┐     ┌──────────────┐     ┌──────────────────┐     ┌──────────────┐
│ LLM Agent │────▶│  MCP Client  │────▶│  flame-mcp       │────▶│ Flame API    │
│           │     │ (WebSocket)  │     │  (MCP Server)    │     │ (Django REST)│
└───────────┘     └──────────────┘     └──────────────────┘     └──────────────┘
                                              Port 8004              Port 8000

The server acts as a thin MCP proxy to a running Flame REST API instance. It receives MCP JSON-RPC requests over WebSocket (or HTTP POST) and translates them into HTTP calls to the Flame API.

Related MCP server: tooluniverse

Prerequisites

  • Conda/Mamba — Miniforge3 recommended

  • Git — to clone the Flame repositories

  • Flame repositories (same parent directory):

Installation

1. Install Conda/Mamba (if not already installed)

curl -L -o /tmp/miniforge.sh \
  https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash /tmp/miniforge.sh -b -p $HOME/miniforge3
export PATH="$HOME/miniforge3/bin:$PATH"

2. Create the Flame conda environment

mamba create -n flame -y -c conda-forge python=3.10 \
  rdkit scikit-learn pandas numpy matplotlib \
  django=3.2 djangorestframework=3.14 django-cors-headers=3.14 \
  xgboost lightgbm imbalanced-learn

3. Install the Flame platform and dependencies

# Activate the environment
mamba activate flame

# Install flame core (from the sibling flame/ directory)
pip install -e ../flame/

# Install additional Flame dependencies
pip install psycopg2-binary djangorestframework-yaml \
  standardiser@https://github.com/phi-grib/standardiser/archive/master.zip \
  nonconformist@https://github.com/josecarlosgomezt/nonconformist/archive/master.zip

# Configure the Flame repository path
flame -c config -d $HOME/flame_repo

4. Start the Flame API (Django) server

The Flame API must be running before starting the MCP server.

mamba activate flame
cd ../flame_API/flame_api

# First-time setup: run migrations
python manage.py migrate

# Start on port 8001 (or any free port)
python manage.py runserver 127.0.0.1:8001

Note: The default port 8000 may conflict with other MCP servers (e.g., CompTox). Use a different port and configure FLAME_MCP_FLAME_API_BASE_URL accordingly.

5. Start the Flame MCP server

# Option A: Using the start script
cp .env.example .env
# Edit .env — set FLAME_MCP_FLAME_API_BASE_URL=http://127.0.0.1:8001/api/v1
./start_mcp.sh

# Option B: Manual start
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

FLAME_MCP_FLAME_API_BASE_URL=http://127.0.0.1:8001/api/v1 \
  uvicorn flame_mcp.transport.websocket:app --host 127.0.0.1 --port 8004

6. Verify the full stack

# MCP server liveness
curl http://127.0.0.1:8004/healthz
# {"status":"ok","service":"flame-mcp"}

# End-to-end readiness (checks Flame API connectivity)
curl http://127.0.0.1:8004/readyz
# {"status":"ready","flame_api":"reachable","detail":"I am alive"}

Available Tools (63)

Model Management (20 tools)

Tool

Description

list_models

List all models in the repository

get_model_info

Get model summary information

create_model

Create a new model endpoint

delete_model

Remove a model entirely

publish_model

Publish dev version as a new numbered version

get_model_version_info

Get info about a specific model version

delete_model_version

Delete a specific version

get_model_parameters

Get modeling parameters (algorithm, descriptors)

get_model_documentation

Get OECD-QMRF documentation

update_model_documentation

Update documentation fields

update_model_labels

Update model labels/annotations

get_model_validation

Get quality/validation metrics

get_training_series

Download training series SDF

export_model

Start model export (.tgz)

check_export_status

Check if export completed

refresh_model

Rebuild all versions

check_refresh_status

Check refresh status

get_build_status

Check build operation status

parameters_to_yaml

Convert parameters to YAML

yaml_to_parameters

Apply YAML delta to parameters

Prediction (6 tools)

Tool

Description

predict_smiles

Predict properties for a SMILES

predict_smiles_list

Predict for multiple SMILES

predict_sdf

Predict using SDFile

list_predictions

List stored predictions

get_prediction_result

Get prediction results (poll)

delete_prediction

Delete a prediction

Profiling (7 tools)

Tool

Description

profile_smiles

Run multiple models on a SMILES

profile_smiles_list

Profile multiple compounds

profile_sdf

Profile using SDFile

list_profiles

List stored profiles

get_profile_result

Get profile result for a model

get_profile_summary

Get heatmap summary

delete_profile

Delete a profile

Chemical Space (9 tools)

Tool

Description

list_spaces

List chemical spaces

get_space_info

Get space information

create_space

Create a new space

delete_space

Delete a space

publish_space

Publish a space version

get_space_version_info

Get space version info

delete_space_version

Delete a space version

get_space_parameters

Get space parameters

build_space

Build a space from compounds

Search (5 tools)

Tool

Description

search_similar_smiles

Search by SMILES similarity

search_similar_smarts

Search by SMARTS substructure

search_sdf

Search using SDFile

get_search_result

Get search results (poll)

get_search_result_toxhub

Get results for ToxHub

Build (1 tool)

Tool

Description

build_model

Train a model from SDFile

Collections (3 tools)

Tool

Description

list_collections

List endpoint collections

update_collection

Create/update a collection

delete_collection

Delete a collection

Baskets (3 tools)

Tool

Description

list_baskets

List compound baskets

get_basket_item

Get a basket item

manage_basket_item

Create/update a basket item

Verification (5 tools)

Tool

Description

get_model_verification

Get verification info

create_model_verification

Create verification entry

delete_model_verification

Delete verification

generate_verification_report

Generate a report

sign_verification_report

Sign a report

Configuration (2 tools)

Tool

Description

get_flame_configuration

Get Flame config

set_flame_configuration

Set repository path

Health (2 tools)

Tool

Description

check_flame_alive

Check Flame API liveness

check_flame_ready

Check Flame API readiness

Configuration

Configuration is via environment variables or .env file. See .env.example for all options.

Key settings:

  • FLAME_MCP_FLAME_API_BASE_URL — Flame API URL (default: http://127.0.0.1:8000/api/v1)

  • FLAME_MCP_MCP_PORT — MCP server port (default: 8004)

  • FLAME_MCP_ALLOWED_ORIGINS / FLAME_MCP_ALLOWED_HOSTS — extra browser origins / Host values to accept (JSON arrays; loopback is always accepted)

Security

The server has no authentication and proxies to a Flame API that can delete and overwrite models. Run it on 127.0.0.1 only (the default), or behind an authenticating reverse proxy.

  • Requests carrying a browser Origin header are rejected (HTTP 403) unless the origin is a loopback address or listed in FLAME_MCP_ALLOWED_ORIGINS; the Host header is checked against loopback names plus FLAME_MCP_ALLOWED_HOSTS. This prevents web pages and DNS-rebinding attacks from driving the server through the user's browser. No wildcard CORS policy is set.

  • Model, space, prediction, profile, collection and other object names are validated ([A-Za-z0-9][A-Za-z0-9_.-]{0,127}, no ..) and percent-encoded before being placed in Flame API paths, so a crafted name cannot reach a different endpoint.

  • Tools carry MCP readOnlyHint / destructiveHint annotations so clients can ask for confirmation before deleting, rebuilding or overwriting.

Endpoints

Endpoint

Protocol

Description

/mcp

HTTP POST

MCP JSON-RPC over HTTP (one JSON response per request)

/mcp

HTTP GET

Discovery probe (server info, protocol versions)

/mcp/ws

WebSocket

MCP JSON-RPC over WebSocket

/healthz

HTTP GET

Liveness probe

/readyz

HTTP GET

Readiness probe (checks the Flame API)

IDE Integration

Add to your Agent's MCP configuration file:

HTTP (e.g. config.yaml):

mcp_servers:
  flame:
    url: http://127.0.0.1:8004/mcp
    timeout: 900

WebSocket clients:

{
  "flame": {
    "url": "ws://127.0.0.1:8004/mcp/ws"
  }
}

Once configured, the client can use all 63 Flame tools. Example end-to-end workflow:

1. create_model("my_model")           → Create a new endpoint
2. build_model("my_model", sdf)       → Train with an SDF file
3. predict_smiles("my_model", 0, smi) → Predict a SMILES
4. get_prediction_result(pred_id)     → Retrieve results

Agent skills

The reusable workflows live in skills/. They are separate from the MCP server implementation and can be used by an agent only when installed/discovered; an MCP connection alone does not install them.

Skill

Scope

flame-model-audit

Inventory, documentation, validation and model suitability (read-only)

flame-prediction

Version-pinned predictions, result retrieval and interpretation

flame-model-development

Curated training and development-version validation (writes require authorization)

flame-model-release

Approved publication, read-back and archive verification (writes require authorization)

flame-chemical-space

Similarity and profiling for exploration, not a safety conclusion

The Agent can load them from this checkout without copying by adding the absolute path to this repository's skills/ directory to its skills.external_dirs setting. Installed local skills of the same name take precedence. The safer-chemical-substitution skill remains a separate assessment workflow: it may use flame-prediction for a defensible evidence gap if installed, but predictions are not required and never override measured or regulatory evidence.

Development

# Install with dev dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Start in development mode
uvicorn flame_mcp.transport.websocket:app --host 127.0.0.1 --port 8004 --reload

Troubleshooting

Problem

Solution

readyz returns degraded

Flame API (Django) is not running or wrong URL configured

ModuleNotFoundError: standardiser

Install: pip install standardiser@https://github.com/phi-grib/standardiser/archive/master.zip

ModuleNotFoundError: xgboost

Install: mamba install -n flame -c conda-forge xgboost lightgbm

Port conflict on 8000

Use a different port for Django and set FLAME_MCP_FLAME_API_BASE_URL

Build fails silently

Check Django server terminal output for Python tracebacks

Session not found (IDE)

Restart the MCP server — WebSocket session expired

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • 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
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI scientists to access over 1000 machine learning models, datasets, APIs, and scientific packages for data analysis, knowledge retrieval, and experimental design from any large language model.
      13,321 PyPI
      1,812
      Apache 2.0
    • A
      license
      C
      quality
      F
      maintenance
      Enables LLM agents to draw and edit ChemDraw reaction schemes, parse ELN exports and LCMS/NMR data, and generate publication-ready CDXML files through grounded chemistry tools.
      35
      3
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables querying scientific entity data — compound records and properties, bioactivity and mechanisms, protein entries and ID mappings, PDB structures, and PubMed metadata — directly from official PubChem, ChEMBL, UniProt, RCSB PDB, and PubMed APIs through 12 tools. Requires no API keys, so agents can retrieve live chemical, protein, structural, and citation records without credentials or quotas.
      31
      2,052 PyPI
      MIT