Skip to main content

MCP server for AIND metadata

Project description

AIND Metadata access MCP server

License Code Style semantic-release: angular Interrogate Coverage Python

Server Overview

The AIND metadata MCP allows users to access and communicate with the metadata within their preferred IDE. This server consists of tools that allows an LLM agent to access records in DocDB, as well as provide the user context with how the AIND Data Schema is structured. It also consists of resources to give the model additional context on how to structure responses using the aind-data-access API, as well as, how the schema is structured. Note that due to the nature of MCP servers, users will have to explicitly ask the agent to use the available resources for additional context.

Setting up your desktop for installing MCP servers

  1. Downloading UV to your desktop ( Unsure about the necessity of this step but it definitely helps having the package configured locally)
  • on Mac Terminal
brew install uv

# Or, alternatively:
curl -LsSf https://astral.sh/uv/install.sh | sh
  • on Windows Powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

In order to ensure that the MCP server runs in your preferred client, you will have to download the aind-metadata-mcp package to your console. However, note that the installation is quite large. If space is an issue, please set UV_CACHE_DIR and UV_TOOL_DIR to locations that have capacity before proceeding with the next step.

  1. Simpler version of install Run uv tool install aind-metadata-mcp on your terminal and proceed below to configuring your MCP clients. The uvx command should ideally take 3 minutes to start up without errors.
  2. If the above step didn't work:

Create virtual environment with python 3.11 in IDE

# Instructions for Conda
conda create -n <my_env> python=3.11
conda activate <my_env>

# Instructions for virtual environment
py -3.11 -m venv .venv
# Windows startup
.venv\Scripts\Activate.ps1 
# Mac/ Linux startup
source .venv/bin/activate 

Run the following commands in your IDE terminal. The uvx command should ideally take 3 minutes to start up without errors.

pip install uv
uvx aind-metadata-mcp

If all goes well, and you see the following notice - Starting MCP server 'aind_data_access' with transport 'stdio'-, you should be good for the set up in your client of choice!

Instructions for use in MCP clients

JSON Config files to add MCP servers in clients should be structured like this

{
    "mcpServers": {

    }
}

Insert the following lines into the mcpServers dictionary

"aind_data_access": {
    "command": "uvx",
    "args": ["aind-metadata-mcp"]
}

Note that after configuring the JSON files, it will take a few minutes for the serve to populate in the client.

Claude Desktop App

  • Click the three lines at the top left of the screen.
  • File > Settings > Developer > Edit config

Cline in VSCode

  • Ensure that Cline is downloaded to VScode
  • Click the three stacked rectangles at the top right of the Cline window
  • Installed > Configure MCP Servers
  • Close and reopen VSCode

Github Copilot in VSCode

  • Command palette (ctr shift p)
  • Search for MCP: Add server
  • Select Manual Install / stdio
  • When prompted for a command, input uvx aind-data-access
  • Name your server
  • Close and reopen VSCode
  • In Copilot chat -> Select agent mode -> Click the three stacked rectangles to configure tools
  • In order to enable the agent to reply with context of the AIND API, you'll have to manually add the .txt files (under resources) in this repository

Code Ocean

  • Generate a Code Ocean api token called "CO_TOKEN" with read/write permissions for the capsule and read permission for the datasets. Attatch CO_TOKEN as an env variable in the capsule of your choice
  • Open the postinstall script in the environment of your choice and insert the following lines:
# Step 1: Download and extract code-server
mkdir -p /.code-server
curl -L "https://github.com/coder/code-server/releases/download/v4.100.3/code-server-4.100.3-linux-amd64.tar.gz" -o /.code-server/code-server.tar.gz

cd /.code-server
tar -xvf code-server.tar.gz
rm code-server.tar.gz

# Step 2: Link binary to /usr/bin
ln -sf /.code-server/code-server-4.100.3-linux-amd64/bin/code-server /usr/bin/code-server

# Step 3: Install extensions
mkdir -p /.vscode/extensions

extensions=(
    "REditorSupport.R"
    "continue.continue"
    "ms-python.python"
    "ms-toolsai.jupyter"
    "reageyao.bioSyntax"
    "saoudrizwan.claude-dev"
)

for ext in "${extensions[@]}"; do
    code-server --extensions-dir="/.vscode/extensions" --install-extension "$ext"
done

# install mcp 
uv tool install --force "git+https://github.com/AllenNeuralDynamics/aind-metadata-mcp.git@test[co]"
  • In the VS Code server, open Cline and attach the following to the json file:
{
  "mcpServers": {
    "aind_data_access":{
  
      "command": "uvx",
      "args":["aind-metadata-mcp[co]"],
       "env": {
        "CO_TOKEN": "<CO_TOKEN>",
        "CO_CAPSULE_ID": "<CAPSULE ID>" // can be found by running `env | grep -i capsule` in the terminal
      }
    }
  
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aind_metadata_mcp-0.4.2.tar.gz (162.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aind_metadata_mcp-0.4.2-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file aind_metadata_mcp-0.4.2.tar.gz.

File metadata

  • Download URL: aind_metadata_mcp-0.4.2.tar.gz
  • Upload date:
  • Size: 162.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aind_metadata_mcp-0.4.2.tar.gz
Algorithm Hash digest
SHA256 82ca93f535152ca62d74f4d2db126ff04924304cfc9c6d1cdf5d223161e6edb5
MD5 ba2076026d8c01df60dcee653f161550
BLAKE2b-256 2e6b3d2e221abc5d1ba79990e2c9185f4c15a01274dd84297cd26c12ec494dd5

See more details on using hashes here.

File details

Details for the file aind_metadata_mcp-0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for aind_metadata_mcp-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9da5da67078ab48d30f315303e50296e60d5fb25291fbd1de1c2feeef55fd4c1
MD5 5aeaddd81539a7e8fd23f8bd54a970db
BLAKE2b-256 3443e1f99d116d38d261fb3bbed935d0d7a5d4c84c32946d6a65a9c7b32d15b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page