home / mcp / bio mcp bwa server

Bio MCP BWA Server

Provides BWA-based genome alignment tools via MCP, including indexing and multiple alignment modes.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "bio-mcp-bio-mcp-bwa": {
      "command": "python",
      "args": [
        "-m",
        "src.server"
      ],
      "env": {
        "BIO_MCP_TIMEOUT": "3600",
        "BIO_MCP_BWA_PATH": "/usr/local/bin/bwa",
        "BIO_MCP_TEMP_DIR": "/tmp/bwa_mcp",
        "BIO_MCP_MAX_FILE_SIZE": "Until 50GB by default (e.g., 53687091200)"
      }
    }
  }
}

You can access and run the BWA sequencing aligner through an MCP server, enabling AI assistants to perform genome read alignment tasks by invoking dedicated tools like index creation and various alignment modes. This setup lets you integrate BWA functionality into automated workflows and conversational agents with clear, programmatic endpoints.

How to use

To use the BWA MCP server with your MCP client, first ensure your environment is prepared with the required prerequisites and that the server is running locally or reachable via its configured command. You will call the available tools by name to perform specific tasks such as indexing a reference genome or aligning reads. Each tool exposes a focused set of parameters that you provide as inputs, and the server returns results appropriate for downstream processing in your pipelines or analysis notebooks.

How to install

# Prerequisites
python3.9+
# Ensure BWA is installed and available in PATH
# macOS
brew install bwa

# Ubuntu/Debian
sudo apt-get install bwa

# From conda
conda install -c bioconda bwa

# Install the MCP server
git clone https://github.com/bio-mcp/bio-mcp-bwa
cd bio-mcp-bwa
pip install -e .

Configuration and security

Configure your MCP client to recognize the BWA MCP server by adding a local entry that points to the server runtime. The example below shows how to configure a server named bio-bwa to run via Python and the server module.

{
  "mcpServers": {
    "bio-bwa": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/bio-mcp-bwa"
    }
  }
}

Examples

Create a BWA index for a reference genome using the MCP server, then align reads with BWA-MEM and generate SAM outputs for paired-end data. Adapt file paths to your environment and genome references.

Available tools

bwa_index

Create a BWA index for a reference genome using the indexed FASTA file.

bwa_mem

Align reads using the BWA-MEM algorithm with options for threads, seed length, band width, and read group information.

bwa_aln

Find SA coordinates with the BWA-backtrack algorithm for a given reference and reads.

bwa_samse

Generate single-end alignments in SAM format from reads using a prebuilt SA index.

bwa_sampe

Generate paired-end alignments in SAM format from reads using prebuilt SA indexes for both mates.