Skip to main content
Glama
rnaseq-mcp
by sbarbi-gh

rnaseq-mcp

Server MCP per l'analisi di dati Bulk RNA-seq tramite agenti LLM. Permette di interrogare un dataset in linguaggio naturale. Esegue codice R e Python in un container Docker isolato, con anonimizzazione automatica dei campioni e controllo sulla privacy degli output.

Prerequisiti

  • Docker

  • Python ≥ 3.11

  • Un client MCP compatibile (es. Claude Code, Mistral Vibe o qualsiasi agente che supporti il protocollo MCP)

Related MCP server: DROMA MCP Server

Quickstart

1. Build del container

cd container
docker build -t rnaseq-executor:latest .

Nel container vengono installati pacchetti di R (DESeq2, edgeR, limma, clusterProfiler, fgsea) e le librerie di annotazione (org.Hs.eg.db, org.Mm.eg.db) per garantire funzionalita offline.

2. Installazione del server

pip install -e .

3. Configurazione del client MCP

Registra il server nel tuo client MCP con questi parametri:

Parametro

Valore

Comando

rnaseq-mcp

COUNTS_FILE

percorso assoluto a counts.csv

METADATA_FILE

percorso assoluto a metadata.csv

I file di input consistono in 2 CSV:

  • counts.csv — matrice geni × campioni (gene ID come indice di riga)

  • metadata.csv — tabella campioni × variabili (stesso indice di counts.csv)

4. Utilizzo

Una volta connesso il server, i tool disponibili sono:

Tool

Descrizione

list_data_files

Elenca i file in /data

read_table

Anteprima di un CSV

execute_r

Esegue codice R (sessione persistente)

execute_python

Esegue codice Python (namespace persistente)

get_outputs

Recupera i risultati da /output

describe_session

Stato della sessione e pacchetti disponibili

reset_session

Azzera container, stato e output

Esempio di sessione:

Analizza i dati RNA-seq in /data confrontando treated vs control,
correggi per batch e genera volcano plot e heatmap.

Viene fornito un esempio prompt di sistema in prompts/system_prompt.md.

Privacy

All'avvio, il server:

  1. Rimuove le colonne di metadati con identificatori personali (nomi, ID campione, barcode, ecc.)

  2. Rinomina i campioni con alias anonimi S1, S2, ..., SN

  3. Blocca l'esportazione di matrici per-campione (count, PCA) come CSV

Mappatura dei campioni

La corrispondenza S1 → nome_reale viene scritta su host nel file:

/tmp/rnaseq-<session_id>/host_only/sample_mapping.json

Il file non è montato nel container e non è accessibile tramite i tool MCP — il modello non può mai risalire ai nomi originali. Il formato è:

{ "S1": "nome_originale_1", "S2": "nome_originale_2", ... }

Il file viene eliminato alla chiusura del server (o alla chiamata di reset_session). Per conservarlo, copialo manualmente prima di terminare la sessione:

cp /tmp/rnaseq-*/host_only/sample_mapping.json ./sample_mapping.json

Output

I file scritti in /output dal codice R/Python sono montati su host nella directory:

/tmp/rnaseq-<session_id>/output/

Sono accessibili direttamente dal filesystem dell'host durante tutta la sessione, senza dover passare per il tool get_outputs. Quest'ultimo è utile principalmente per restituire i risultati al modello (ad es. per leggere una tabella CSV o visualizzare un plot nel contesto della conversazione).

I file vengono eliminati alla chiusura del server o alla chiamata di reset_session. Per conservarli:

cp -r /tmp/rnaseq-*/output/ ./risultati/

Pacchetti R disponibili

DESeq2, edgeR, limma, ggplot2, pheatmap, ComplexHeatmap, EnhancedVolcano, clusterProfiler, fgsea, msigdbr, org.Hs.eg.db, org.Mm.eg.db, AnnotationDbi

Licenza

MIT License — Copyright (c) 2026 Stefano Barbi

Available Tools

7 tools
describe_sessionA

Return R sessionInfo(), available Python symbols, and files already produced in /output. Useful at the start of a session to confirm what packages are available.

Inputs: no named parameters. Returns: result

execute_pythonA

Execute Python code in the isolated analysis container. The Python namespace is PERSISTENT across calls.

OUTPUT RULES (same as execute_r):

  • Write to /output ONLY aggregated results (gene/pathway level).

  • Do NOT write per-sample matrices as CSV.

  • Plots saved with matplotlib/seaborn: plt.savefig("/output/.png").

  • If the server blocks a CSV, produce an aggregated equivalent instead.

Available packages: pydeseq2, pandas, numpy, matplotlib, seaborn, scipy, statsmodels.

Inputs: code (required). Returns: result

execute_rA

Execute R code in the isolated analysis container. The R session is PERSISTENT: objects defined in earlier calls remain available.

OUTPUT RULES (enforced server-side — follow them in your code):

  • Write to /output ONLY aggregated results: DE tables (log2FC, pvalue, padj per gene), pathway scores, group-level summary statistics, model coefficients.

  • Do NOT write per-sample matrices (normalized counts, raw counts, PCA coordinates) as CSV/TSV to /output. Keep them in R memory for intermediate computation.

  • Plots (PNG) showing sample-level data are permitted — use anonymous labels (S1, S2, ...).

  • ggsave() and png() write to /output/; use descriptive names.

  • If the server blocks a CSV file, revise your code to export an aggregated version.

Available R packages: DESeq2, edgeR, limma, ggplot2, pheatmap, ComplexHeatmap, EnhancedVolcano, ggrepel, patchwork, clusterProfiler, fgsea, msigdbr, org.Hs.eg.db, org.Mm.eg.db, AnnotationDbi. No internet access — use org.Hs.eg.db instead of biomaRt for gene annotation.

Inputs: code (required). Returns: result

get_outputsA

Retrieve all files written to /output during this session. CSV files containing per-sample data are blocked and replaced with an explanatory message. Images (PNG) are returned as base64-encoded strings.

Inputs: no named parameters. Returns: result

list_data_filesA

List files available in /data (anonymized counts and metadata).

Inputs: no named parameters. Returns: result

read_tableA

Read the first n_rows of a CSV/TSV file from /data and return it as a markdown table. Useful for inspecting column names, sample aliases, and group labels before writing analysis code.

Inputs: filename (required), n_rows. Returns: result

reset_sessionA

Destroy the current Docker container and start a fresh one with the same anonymized data. Use this to clear all in-memory R/Python state and /output files.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clear, distinct purpose: environment inspection, code execution per language, output retrieval, data exploration (listing and reading), and session reset. No two tools overlap in functionality.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (e.g., describe_session, execute_python, list_data_files). The naming is predictable and easy to interpret.

    Tool Count5/5

    With 7 tools, the server covers all essential activities for RNA-seq analysis: environment setup, code execution, data exploration, output retrieval, and session management. The count is well-scoped and not excessive.

    Completeness4/5

    The tool surface provides a solid foundation for RNA-seq analysis: data listing, reading, execution in both R and Python with relevant packages, output retrieval, and reset. A minor gap is the lack of a direct quality control or standard pipeline tool, but the execution tools suffice.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      An MCP server that enables single-cell RNA sequencing analysis through natural language, supporting data processing, visualization, and analysis tasks without requiring coding knowledge.
      52
      12
      BSD 3-Clause
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language interactions with cancer pharmacogenomics data through the DROMA platform, supporting drug-omics association analysis, dataset management, molecular profile loading, and treatment response analysis across multiple research projects.
      1
      Mozilla Public 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables scRNA-Seq analysis through natural language, providing tools for data preprocessing, clustering, and biological visualization. It supports both predefined function execution and a flexible code mode powered by a Jupyter backend for automated single-cell transcriptomics workflows.
      16 PyPI
      16
      BSD 3-Clause
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides a natural language interface for single-cell RNA-Seq analysis using the decoupleR framework. It enables users to perform biological pathway inference, data clustering, and visualization through MCP-compatible AI clients.
      31 PyPI
      4
      -