Skip to main content
Glama
Allen Brain API MCP Server

Allen Brain API MCP Server

by MCPmed

Allen Brain API MCP Server

A comprehensive Model Context Protocol (MCP) server for querying the Allen Institute for Brain Science API. This server provides access to the Allen Brain API using the RESTful Model Access (RMA) format and high-level endpoints for various Allen Brain Institute datasets, including Cell Types, Mouse Connectivity, Ontologies, Image Downloads, Grid Data, and Neuronal Models.

Features

  • execute_rma_query: Allows sending raw, generic RMA queries for maximum flexibility. You can query models like Specimen, SectionDataSet, Structure, and filter them dynamically.

  • get_cell_specimens: A convenient tool to query cell specimens from the Cell Types Database by species (e.g., Mus musculus or Homo Sapiens).

  • get_mouse_connectivity_experiments: A high-level tool to quickly fetch projection/injection experiments from the Mouse Brain Connectivity Atlas.

  • get_atlases: Retrieve atlases available through the API.

  • get_structure_graphs: Retrieve structure graphs.

  • get_structures: Retrieve data about anatomical structures, with optional filtering by graph ID.

  • get_atlas_images: List atlas images belonging to a specified atlas.

  • get_section_images: List section images belonging to a specified section data set.

  • get_grid_data_download_url: Returns the URL to download 3-D expression grid data for a section data set.

  • get_neuronal_models: Fetch biophysically detailed neuronal model records.

Related MCP server: AIND Metadata MCP Server

Installation

This project is built using TypeScript. To install dependencies:

cd allenbrain-mcp
npm install

Build

Compile the TypeScript code:

npm run build

Running the Server

Start the server using node:

npm start

Or run in development mode with tsx watch:

npm run dev

Testing

Tests are written using Vitest. Mocked axios is used to prevent actual network calls during the test suite.

npm run test

Adding to an Agent (e.g., Gemini CLI)

To integrate this MCP server with an agent like the Gemini CLI, you need to configure your agent to recognize and execute the server.

  1. Ensure the server is built:

    cd /path/to/allenbrain-mcp
    npm run build
  2. Configure your agent: You will typically need to provide a path to the server's executable. For the Gemini CLI, this is usually done via a configuration file (e.g., tool-code-interpreter.json or similar, depending on your setup). Add an entry that points to the compiled server.

    Example configuration entry (adjust /path/to/allenbrain-mcp to your actual directory):

    {
      "mcpServers": {
        "allenbrain-api": {
          "command": "node",
          "args": ["/path/to/allenbrain-mcp/build/index.js"]
        }
      }
    }

    Once configured, your agent should be able to list and call the tools provided by this MCP server.

Disclaimer and Support

This project is a work in progress, and not all functionality has been exhaustively tested with live data. While efforts have been made to accurately reflect the Allen Brain API based on available documentation, this project is not officially linked to or endorsed by the Allen Institute for Brain Science.

Feedback, bug reports, and contributions are welcome and encouraged to improve its completeness and reliability.

Available Tools

26 tools
download_annotation_volumeB

Download a brain annotation volume in NRRD format from the Allen Common Coordinate Framework (CCF).

Inputs: ccfVersion, resolution, filePath.

download_atlas_imageB

Download a 2D atlas image as a JPEG file to a local path.

Inputs: atlasImageId (required), filePath, downsample, quality, +2 more.

download_cell_ephys_dataB

Download electrophysiology recordings for a cell specimen as an NWB file to a local path.

Inputs: specimenId (required), filePath.

download_cell_reconstructionA

Download the morphological reconstruction of a cell specimen as an SWC file to a local path.

Inputs: specimenId (required), filePath.

download_expression_grid_dataB

Download 3D expression grid data as a ZIP archive (metaimage format) containing energy, density, and/or intensity volumes.

Inputs: sectionDataSetId (required), include, filePath.

download_projection_grid_dataB

Download 3D projection grid data in NRRD format for mouse connectivity experiments.

Inputs: sectionDataSetId (required), image, resolution, filePath.

download_section_imageA

Download a 2D section image as a JPEG file to a local path. Supports downsampling, quality, and partial region extraction.

Inputs: sectionImageId (required), filePath, downsample, quality, +5 more.

download_structure_meshA

Download a 3D brain structure mesh in Wavefront OBJ format.

Inputs: structureId (required), ccfVersion, filePath.

download_svgA

Download SVG structure overlay for a section image to a local file.

Inputs: sectionImageId (required), filePath, groups.

download_well_known_fileA

Download any Allen Institute file by its WellKnownFile ID (obtain via list_well_known_files or execute_rma_query on the WellKnownFile model). Covers transcriptomics CSV matrices, NWB files, SWC reconstructions, and any other bulk download.

Inputs: wellKnownFileId (required), filePath.

execute_rma_queryA

Executes a generic RMA (RESTful Model Access) query against the Allen Brain API. Useful for querying arbitrary data models like 'Specimen', 'SectionDataSet', 'Structure', etc.

Inputs: model (required), criteria, include, only, +3 more.

get_atlasesC

Retrieve atlases available through the API (from OntologiesApi).

Inputs: numRows.

get_atlas_imagesC

List atlas images belonging to a specified atlas (from ImageDownloadApi).

Inputs: atlasId (required), numRows.

get_cell_specimensC

Retrieve cell specimens from the Allen Cell Types Database.

Inputs: species, numRows.

get_ephys_featuresB

Retrieve electrophysiology features for all cells in the Allen Cell Types Database.

Inputs: numRows.

get_ephys_sweepsB

Get electrophysiology sweep records for a specific cell specimen from the Allen Cell Types Database.

Inputs: specimenId (required), numRows.

get_grid_data_download_urlA

Returns the URL to download 3-D expression grid data for a section data set (does not download).

Inputs: sectionDataSetId (required), include.

get_morphology_featuresC

Retrieve morphology features (neuron reconstruction metadata) for all cells in the Allen Cell Types Database.

Inputs: numRows.

get_mouse_connectivity_experimentsB

Retrieve experiments from the Mouse Brain Connectivity Atlas.

Inputs: numRows.

get_neuronal_modelsB

Fetch biophysically detailed model records (from BiophysicalApi/GlifApi).

Inputs: specimenIds, numRows.

get_productsA

List all Allen Institute products (atlases, databases, and data collections). Useful for discovering product IDs needed by list_well_known_files and get_section_data_sets_by_product.

Inputs: numRows.

get_section_data_sets_by_productB

List section data sets (experiments) produced as part of one or more Allen Institute products.

Inputs: productIds (required), includeFailed, numRows.

get_section_imagesB

List section images belonging to a specified section data set (from ImageDownloadApi).

Inputs: sectionDataSetId (required), numRows.

get_structure_graphsC

Retrieve structure graphs (from OntologiesApi).

Inputs: numRows.

get_structuresC

Retrieve data about anatomical structures (from OntologiesApi).

Inputs: graphId, numRows.

list_well_known_filesA

List downloadable files (WellKnownFiles) attached to any Allen resource such as a Product, Specimen, or SectionDataSet. Use this to discover transcriptomics matrices, reference data, or other bulk downloads.

Inputs: attachableId (required), attachableType, wellKnownFileTypeName, numRows.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 26 tools

    Disambiguation5/5

    Each tool targets a distinct data type or action, with clear separation between downloading files, retrieving metadata, listing resources, and executing generic queries. No two tools have overlapping purposes, ensuring an agent can reliably select the correct tool.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern using lowercase with underscores (e.g., download_annotation_volume, get_cell_specimens). The verbs are appropriately chosen for the action (download, get, execute, list), and nouns describe the resource clearly.

    Tool Count4/5

    With 26 tools, the server covers a wide range of Allen Brain API functionality (atlases, cell types, connectivity, ephys, morphology, etc.). While the count is slightly higher than ideal, each tool serves a distinct purpose, and the scope justifies the number.

    Completeness4/5

    The tool set covers core operations for major data types (downloads, metadata queries, listings) and includes a generic query tool (execute_rma_query) to fill gaps. Minor omissions exist (e.g., no direct search for genes or expression data), but overall the surface is comprehensive.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers