Mass Spectrometry Data (mzML, Bruker TDF, vendor conversion)

v0.1.1
io.github.K-Dense-AI/labmcp-ms-data Checked 17 hours ago Published 2 months ago

MCP server for LC-MS data in mzML/mzMLb and Bruker timsTOF files; vendor formats via msconvert.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_connection_info Get Connection Info

Report which instrument is connected (identity, address, simulated or real), whether the server is read-only, and the active safety limits. Call this first.

get_command_log Get Command Log

Return the most recent raw commands sent to / replies received from the instrument (newest last). Useful for debugging and for recording what was done.

ParameterTypeDescription
limitinteger

reconnect Reconnect

Close and re-open the connection to the instrument (e.g. after it was power cycled or a cable was re-plugged).

list_runs List Runs

Find mass-spectrometry runs in the data folder and detect each one's vendor and format (mzML/mzML.gz/mzMLb, Bruker .d TDF or BAF, Agilent .d, Thermo .raw, Waters .raw folder, SCIEX .wiff/.wiff2, Shimadzu .lcd, mzXML). `readable_directly=false` means the run must be converted with convert_to_mzml before it can be analysed.

ParameterTypeDescription
max_resultsinteger
recursivebooleanAlso search subfolders (up to 6 levels)
subfolderstringFolder to search, relative to the data folder

get_run_info Get Run Info

Describe one run: instrument vendor/model/serial (when the file records them), acquisition date, software, number of spectra per MS level, retention-time and m/z ranges, polarity, centroid/profile, and whether ion-mobility data is present. The first call on a large file indexes it (can take a while); later calls are instant.

ParameterTypeDescription
pathRun path relative to the data folder (from list_runs); may be omitted if there is one run

get_tic Get Tic

Total ion chromatogram (sum of all intensities per spectrum vs retention time) for one MS level, downsampled to `max_points` (keeping the maximum in each bin so peaks survive). Returns the apex, median and area; `save_path` writes every point to CSV.

ParameterTypeDescription
max_pointsintegerMaximum points returned (downsampled, max per bin)
ms_levelintegerMS level to use (1 = survey scans)
overwritebooleanAllow replacing an existing save_path file
pathRun path relative to the data folder (from list_runs); may be omitted if there is one run
rt_end_minOnly use spectra at or before this RT (min)
rt_start_minOnly use spectra at or after this RT (min)
save_pathOptional new .csv file inside the data folder for the full-resolution data

get_bpc Get Bpc

Base peak chromatogram (intensity of the most intense peak per spectrum, with its m/z) vs retention time, downsampled to `max_points`. Cleaner than the TIC for spotting eluting compounds; the base-peak m/z tells you which ion dominates each part of the run.

ParameterTypeDescription
max_pointsintegerMaximum points returned (downsampled, max per bin)
ms_levelintegerMS level to use (1 = survey scans)
overwritebooleanAllow replacing an existing save_path file
pathRun path relative to the data folder (from list_runs); may be omitted if there is one run
rt_end_minOnly use spectra at or before this RT (min)
rt_start_minOnly use spectra at or after this RT (min)
save_pathOptional new .csv file inside the data folder for the full-resolution data

extract_ion_chromatogram Extract Ion Chromatogram

Extracted ion chromatogram (XIC/EIC) for one or more m/z values: the summed intensity within ± tolerance (ppm or Da) in every MS1 spectrum (or another `ms_level`). For each target returns the apex RT and intensity, the apex peak's boundaries, area (intensity x min, no baseline subtraction) and FWHM, plus a downsampled trace. Reads every spectrum in the RT window, so restrict `rt_start_min`/`rt_end_min` on long runs.

ParameterTypeDescription
mz *arrayTarget m/z value(s)
max_pointsintegerMaximum points returned (downsampled, max per bin)
ms_levelintegerMS level to use (1 = survey scans)
overwritebooleanAllow replacing an existing save_path file
pathRun path relative to the data folder (from list_runs); may be omitted if there is one run
rt_end_minOnly use spectra at or before this RT (min)
rt_start_minOnly use spectra at or after this RT (min)
save_pathOptional new .csv file inside the data folder for the full-resolution data
tolerancenumberm/z tolerance (± this value)
tolerance_unitstringTolerance unit: ppm or da

get_spectrum Get Spectrum

Read one spectrum, chosen by `index`, `scan_number`, `native_id` or nearest `rt_min` (give exactly one). Returns MS level, RT, polarity, centroid/profile, precursor m/z and charge for MS2, a summary (peak count, TIC, base peak, m/z range) and the `top_n` most intense peaks; `save_path` writes the full peak list to CSV. For profile spectra the top peaks are local maxima of the profile.

ParameterTypeDescription
index0-based spectrum index in the file
ms_levelWith rt_min: MS level to pick (default 1)
mz_maxOnly consider peaks below this m/z
mz_minOnly consider peaks above this m/z
native_idExact native spectrum id
overwritebooleanAllow replacing an existing save_path file
pathRun path relative to the data folder (from list_runs); may be omitted if there is one run
rt_minPick the spectrum nearest this RT (min)
save_pathOptional new .csv file inside the data folder for the full-resolution data
scan_numberNative scan number (e.g. Thermo scan=N)
top_nintegerNumber of most intense peaks to return

find_ms2_scans Find Ms2 Scans

Find the MS2 (MSn) spectra whose precursor m/z is within ± tolerance of `precursor_mz`, optionally within an RT window and for one charge state. Returns index, scan number, RT, precursor m/z, error in ppm, charge and intensity; open any hit with get_spectrum.

ParameterTypeDescription
precursor_mz *numberPrecursor m/z to look for
chargeOnly this precursor charge
max_resultsinteger
pathRun path relative to the data folder (from list_runs); may be omitted if there is one run
rt_end_minOnly use spectra at or before this RT (min)
rt_start_minOnly use spectra at or after this RT (min)
tolerancenumberm/z tolerance (± this value)
tolerance_unitstringTolerance unit: ppm or da

summarise_run Summarise Run

Quick QC of a run: MS1/MS2 counts, TIC stability (CV, spray dropouts), where the signal elutes, cycle time, MS2 scans per cycle, median injection times and how often MS2 hit the maximum injection time, and precursor charge states. Returns plain-language warnings.

ParameterTypeDescription
pathRun path relative to the data folder (from list_runs); may be omitted if there is one run

convert_to_mzml Convert To Mzml

Convert a vendor file (Thermo .raw, Waters .raw, Agilent .d, SCIEX .wiff, Shimadzu .lcd, Bruker .d) to mzML with the converter the user installed (ThermoRawFileParser, ProteoWizard msconvert, or msconvert in Docker; chosen with --option converter=...). Writes a new file in the data folder. Can take minutes; fails with install instructions if no converter is set up.

ParameterTypeDescription
path *stringVendor file or folder (from list_runs), relative to the data folder
dry_runbooleanOnly show the command that would be run
gzipbooleanWrite .mzML.gz
output_folderFolder for the .mzML, inside the data folder (default: next to the input)
overwritebooleanReplace an existing output file
peak_pickingbooleanCentroid with the vendor algorithm during conversion
timeout_snumberGive up after this many seconds