Labsco
bio-mcp logo

Bio-MCP BLAST

โ˜… 9

from bio-mcp

Perform NCBI BLAST sequence similarity searches through natural language.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

Bio-MCP BLAST

๐Ÿ” MCP server for NCBI BLAST sequence similarity search

Enable AI assistants to perform BLAST searches through natural language. Search nucleotide and protein databases, create custom databases, and get formatted results instantly.

๐Ÿงฌ Features

  • blastn - Nucleotide-nucleotide BLAST search
  • blastp - Protein-protein BLAST search
  • makeblastdb - Create custom BLAST databases
  • Multiple output formats - JSON, XML, tabular, pairwise
  • Flexible input - File paths or raw sequences
  • Queue support - Async processing for large searches

๐Ÿ› ๏ธ Available Tools

blastn

Nucleotide-nucleotide BLAST search

Parameters:

  • query (required) - Path to FASTA file or sequence string
  • database (required) - Database name (e.g., "nt", "nr") or path
  • evalue - E-value threshold (default: 10)
  • max_hits - Maximum hits to return (default: 50)
  • output_format - Output format: "tabular", "xml", "json", "pairwise"

blastp

Protein-protein BLAST search

Parameters:

  • Same as blastn, but for protein sequences

makeblastdb

Create BLAST database from FASTA file

Parameters:

  • input_file (required) - Path to FASTA file
  • database_name (required) - Name for output database
  • dbtype (required) - "nucl" or "prot"
  • title - Database title (optional)

Async Variants (Queue Mode)

  • blastn_async - Submit nucleotide search to queue
  • blastp_async - Submit protein search to queue
  • get_job_status - Check job progress
  • get_job_result - Retrieve completed results

๐Ÿ”„ Queue System

For long-running BLAST searches, use the queue system:

Setup

# Start queue infrastructure
cd ../bio-mcp-queue
./setup-local.sh

# Start BLAST server with queue support
python -m src.main --mode queue --queue-url http://localhost:8000

Usage

# Submit async job
job_info = await blast_server.submit_job(
    job_type="blastn",
    parameters={
        "query": "large_sequences.fasta",
        "database": "nt",
        "evalue": 0.001
    }
)

# Check status
status = await blast_server.get_job_status(job_info["job_id"])

# Get results when complete
results = await blast_server.get_job_result(job_info["job_id"])

๐Ÿ“Š Output Formats

Tabular (Default)

# Fields: query_id, subject_id, percent_identity, alignment_length, ...
Query_1    gi|123456    98.5    500    7    0    1    500    1000    1499    1e-180    633

JSON

{
  "BlastOutput2": [{
    "report": {
      "results": {
        "search": {
          "query_title": "Query_1",
          "hits": [...]
        }
      }
    }
  }]
}

XML

Standard BLAST XML format for programmatic parsing.

๐Ÿงช Testing

# Run tests
pytest tests/ -v

# Test with real data
python tests/test_integration.py

# Performance testing
python tests/benchmark.py

๐Ÿ“ˆ Performance Tips

Local Optimization

  • Use SSD storage for databases
  • Increase available RAM
  • Use multiple CPU cores: export BLAST_NUM_THREADS=8

Database Selection

  • Use smaller, specific databases when possible
  • Consider pre-filtering sequences
  • Use appropriate E-value thresholds

Queue Optimization

  • Scale workers based on CPU cores
  • Use separate queues for different database sizes
  • Monitor memory usage with large databases

๐Ÿ” Security

Input Validation

  • File size limits prevent resource exhaustion
  • Path validation prevents directory traversal
  • Command injection protection

Sandboxing

  • Containers run as non-root user
  • Temporary files isolated per job
  • Network access restricted in production

๐Ÿ“š Resources

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

See CONTRIBUTING.md for detailed guidelines.

๐Ÿ“„ License

MIT License - see LICENSE file.

๐Ÿ†˜ Support


Happy BLASTing! ๐Ÿงฌ๐Ÿ”