Skip to main content
Glama
MCPmed

Allen Brain API MCP Server

by MCPmed
README.md
# 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.

## Installation

This project is built using TypeScript. To install dependencies:

```bash
cd allenbrain-mcp
npm install
```

## Build

Compile the TypeScript code:

```bash
npm run build
```

## Running the Server

Start the server using `node`:

```bash
npm start
```

Or run in development mode with `tsx` watch:

```bash
npm run dev
```

## Testing

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

```bash
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**:
    ```bash
    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):
    ```json
    {
      "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.

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 issues