Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/Dockerfile +40 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/app/__pycache__/abundancebin_shim_server.cpython-311.pyc +0 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/app/abundancebin_server.py +136 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/app/abundancebin_shim_server.py +55 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/app/requirements.txt +1 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/docker-compose.yml +22 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/environment.yaml +10 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/requirements.txt +2 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/Dockerfile +40 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/app/__pycache__/anarci_shim_server.cpython-311.pyc +0 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/app/anarci_server.py +191 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/app/anarci_shim_server.py +55 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/app/requirements.txt +1 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/docker-compose.yml +22 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/environment.yaml +10 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/requirements.txt +2 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/Dockerfile +40 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/app/__pycache__/ariba_shim_server.cpython-311.pyc +0 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/app/ariba_server.py +509 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/app/ariba_shim_server.py +55 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/app/requirements.txt +1 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/docker-compose.yml +22 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/environment.yaml +10 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/requirements.txt +2 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/Dockerfile +40 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/app/__pycache__/arvados-python-client_shim_server.cpython-311.pyc +0 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/app/arvados-python-client_server.py +306 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/app/arvados-python-client_shim_server.py +55 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/app/requirements.txt +1 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/docker-compose.yml +22 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/environment.yaml +10 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/requirements.txt +2 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/Dockerfile +40 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/app/__pycache__/bcbio-gff_shim_server.cpython-311.pyc +0 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/app/bcbio-gff_server.py +200 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/app/bcbio-gff_shim_server.py +55 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/app/requirements.txt +1 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/docker-compose.yml +22 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/environment.yaml +10 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/requirements.txt +2 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/Dockerfile +40 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/app/__pycache__/bioconductor-alabaster.sfe_shim_server.cpython-311.pyc +0 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/app/bioconductor-alabaster.sfe_server.py +221 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/app/bioconductor-alabaster.sfe_shim_server.py +55 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/app/requirements.txt +1 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/docker-compose.yml +22 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/environment.yaml +10 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/requirements.txt +2 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-annotationdbi/Dockerfile +40 -0
- Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-annotationdbi/app/__pycache__/bioconductor-annotationdbi_shim_server.cpython-311.pyc +0 -0
Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Install Miniconda
|
| 8 |
+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh
|
| 9 |
+
|
| 10 |
+
# Add conda to PATH
|
| 11 |
+
ENV PATH="/opt/conda/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Install abundancebin via conda (e.g., from bioconda)
|
| 14 |
+
RUN conda install -c bioconda abundancebin -y && conda clean -a
|
| 15 |
+
|
| 16 |
+
# Install Python dependencies
|
| 17 |
+
RUN pip install uv
|
| 18 |
+
RUN uv pip install --system fastmcp
|
| 19 |
+
|
| 20 |
+
# Create app directory
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
|
| 23 |
+
# Copy your MCP server
|
| 24 |
+
COPY app/abundancebin_server.py /app/
|
| 25 |
+
|
| 26 |
+
# Create workspace and output directories
|
| 27 |
+
RUN mkdir -p /app/workspace /app/output
|
| 28 |
+
|
| 29 |
+
# Make sure the server script is executable
|
| 30 |
+
RUN chmod +x /app/abundancebin_server.py
|
| 31 |
+
|
| 32 |
+
# Expose port for MCP over HTTP (optional)
|
| 33 |
+
EXPOSE 8000
|
| 34 |
+
|
| 35 |
+
# Health check
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)"
|
| 37 |
+
|
| 38 |
+
# Default command runs the MCP server via stdio
|
| 39 |
+
CMD ["python", "/app/abundancebin_server.py"]
|
| 40 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/app/__pycache__/abundancebin_shim_server.cpython-311.pyc
ADDED
|
Binary file (3.59 kB). View file
|
|
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/app/abundancebin_server.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import logging
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
from typing import Optional, List
|
| 5 |
+
|
| 6 |
+
# Assume @mcp.tool() is defined in the execution environment.
|
| 7 |
+
# No import is needed for the final code.
|
| 8 |
+
|
| 9 |
+
# Set up logging
|
| 10 |
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
| 11 |
+
logger = logging.getLogger(__name__)
|
| 12 |
+
|
| 13 |
+
from mcp.server.fastmcp import FastMCP
|
| 14 |
+
|
| 15 |
+
SERVER_NAME = 'local_abundancebin'
|
| 16 |
+
mcp = FastMCP(SERVER_NAME)
|
| 17 |
+
|
| 18 |
+
@mcp.tool()
|
| 19 |
+
def abundancebin(
|
| 20 |
+
input_file: Path,
|
| 21 |
+
kmer_len: int = 20,
|
| 22 |
+
output: Optional[Path] = None,
|
| 23 |
+
exclude: Optional[int] = None,
|
| 24 |
+
exclude_max: Optional[int] = None,
|
| 25 |
+
output_fasta: bool = False,
|
| 26 |
+
bin_num: Optional[int] = None,
|
| 27 |
+
recursive_classification: bool = False,
|
| 28 |
+
):
|
| 29 |
+
"""
|
| 30 |
+
Performs abundance-based binning on a given input FASTA/FASTQ file.
|
| 31 |
+
|
| 32 |
+
This tool uses k-mer frequency to classify sequences into bins. It can either
|
| 33 |
+
classify into a specified number of bins or use a recursive classification approach.
|
| 34 |
+
|
| 35 |
+
Args:
|
| 36 |
+
input_file: Path to the input FASTA/FASTQ file.
|
| 37 |
+
kmer_len: The length of the k-mer to use for composition analysis (default: 20).
|
| 38 |
+
output: Path to the output log file. If not provided, defaults to '<input_file>.log'.
|
| 39 |
+
exclude: Exclude contigs with coverage lower than this count.
|
| 40 |
+
exclude_max: Exclude contigs with coverage higher than this count.
|
| 41 |
+
output_fasta: If True, output binned sequences into separate FASTA files.
|
| 42 |
+
bin_num: The specific number of bins to classify sequences into.
|
| 43 |
+
recursive_classification: If True, undergo recursive classification instead of specifying a bin number.
|
| 44 |
+
This is mutually exclusive with 'bin_num'.
|
| 45 |
+
|
| 46 |
+
Returns:
|
| 47 |
+
A dictionary containing the execution details and paths to output files.
|
| 48 |
+
"""
|
| 49 |
+
# 1. Input Validation
|
| 50 |
+
if not input_file.is_file():
|
| 51 |
+
raise FileNotFoundError(f"Input file not found: {input_file}")
|
| 52 |
+
|
| 53 |
+
if bin_num is not None and recursive_classification:
|
| 54 |
+
raise ValueError("Parameters 'bin_num' and 'recursive_classification' are mutually exclusive. Please provide only one.")
|
| 55 |
+
|
| 56 |
+
if kmer_len <= 0:
|
| 57 |
+
raise ValueError("kmer_len must be a positive integer.")
|
| 58 |
+
|
| 59 |
+
# 2. Command Construction
|
| 60 |
+
# Determine the output file path based on the tool's default behavior
|
| 61 |
+
if output:
|
| 62 |
+
output_path = output
|
| 63 |
+
else:
|
| 64 |
+
output_path = input_file.with_suffix(".log")
|
| 65 |
+
|
| 66 |
+
# Ensure the output directory exists
|
| 67 |
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
| 68 |
+
|
| 69 |
+
cmd = [
|
| 70 |
+
"abundancebin",
|
| 71 |
+
"-input", str(input_file),
|
| 72 |
+
"-kmer_len", str(kmer_len),
|
| 73 |
+
"-output", str(output_path)
|
| 74 |
+
]
|
| 75 |
+
|
| 76 |
+
if exclude is not None:
|
| 77 |
+
cmd.extend(["-exclude", str(exclude)])
|
| 78 |
+
|
| 79 |
+
if exclude_max is not None:
|
| 80 |
+
cmd.extend(["-exclude_max", str(exclude_max)])
|
| 81 |
+
|
| 82 |
+
if output_fasta:
|
| 83 |
+
cmd.append("-OUTPUT_FASTA")
|
| 84 |
+
|
| 85 |
+
if bin_num is not None:
|
| 86 |
+
cmd.extend(["-bin_num", str(bin_num)])
|
| 87 |
+
|
| 88 |
+
if recursive_classification:
|
| 89 |
+
cmd.append("-RECURSIVE_CLASSIFICATION")
|
| 90 |
+
|
| 91 |
+
command_executed = " ".join(cmd)
|
| 92 |
+
logger.info(f"Executing command: {command_executed}")
|
| 93 |
+
|
| 94 |
+
# 3. Subprocess Execution and Error Handling
|
| 95 |
+
try:
|
| 96 |
+
result = subprocess.run(
|
| 97 |
+
cmd,
|
| 98 |
+
capture_output=True,
|
| 99 |
+
text=True,
|
| 100 |
+
check=True
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
# The tool might generate more files if -OUTPUT_FASTA is used.
|
| 104 |
+
# For simplicity, we return the main log file. The user can infer others.
|
| 105 |
+
output_files = [str(output_path)] if output_path.exists() else []
|
| 106 |
+
|
| 107 |
+
# 4. Structured Result Return (Success)
|
| 108 |
+
return {
|
| 109 |
+
"command_executed": command_executed,
|
| 110 |
+
"stdout": result.stdout,
|
| 111 |
+
"stderr": result.stderr,
|
| 112 |
+
"output_files": output_files
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
except FileNotFoundError:
|
| 116 |
+
error_message = "abundancebin command not found. Please ensure the tool is installed and in your system's PATH."
|
| 117 |
+
logger.error(error_message)
|
| 118 |
+
# Re-raising is often better to signal a fatal environment error.
|
| 119 |
+
raise RuntimeError(error_message) from None
|
| 120 |
+
|
| 121 |
+
except subprocess.CalledProcessError as e:
|
| 122 |
+
logger.error(f"abundancebin failed with exit code {e.returncode}")
|
| 123 |
+
logger.error(f"Stderr: {e.stderr}")
|
| 124 |
+
logger.error(f"Stdout: {e.stdout}")
|
| 125 |
+
|
| 126 |
+
# 4. Structured Result Return (Failure)
|
| 127 |
+
return {
|
| 128 |
+
"command_executed": command_executed,
|
| 129 |
+
"stdout": e.stdout,
|
| 130 |
+
"stderr": e.stderr,
|
| 131 |
+
"return_code": e.returncode,
|
| 132 |
+
"output_files": []
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
if __name__ == "__main__":
|
| 136 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/app/abundancebin_shim_server.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import ast
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
from mcp.server.fastmcp import FastMCP
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_help_txt/mcp_abundancebin/app/abundancebin_server.py')
|
| 11 |
+
LOCAL_SERVER = Path(__file__).with_name(SOURCE_SERVER.name)
|
| 12 |
+
SERVER_NAME = 'biosci_abundancebin'
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class _ShimMCP:
|
| 16 |
+
@staticmethod
|
| 17 |
+
def tool(*args, **kwargs):
|
| 18 |
+
if args and callable(args[0]) and len(args) == 1 and not kwargs:
|
| 19 |
+
return args[0]
|
| 20 |
+
def _decorator(fn):
|
| 21 |
+
return fn
|
| 22 |
+
return _decorator
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _resolve_source_server():
|
| 26 |
+
if LOCAL_SERVER.exists() and LOCAL_SERVER.name != Path(__file__).name:
|
| 27 |
+
return LOCAL_SERVER
|
| 28 |
+
return SOURCE_SERVER
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def _load_functions():
|
| 32 |
+
source_server = _resolve_source_server()
|
| 33 |
+
code = source_server.read_text(encoding="utf-8")
|
| 34 |
+
tree = ast.parse(code, filename=str(source_server))
|
| 35 |
+
function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")]
|
| 36 |
+
namespace = {
|
| 37 |
+
"__name__": "__mcp_source__",
|
| 38 |
+
"mcp": _ShimMCP(),
|
| 39 |
+
}
|
| 40 |
+
exec(compile(code, str(source_server), "exec"), namespace, namespace)
|
| 41 |
+
loaded = []
|
| 42 |
+
for name in function_names:
|
| 43 |
+
fn = namespace.get(name)
|
| 44 |
+
if callable(fn):
|
| 45 |
+
loaded.append(fn)
|
| 46 |
+
return loaded
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
mcp = FastMCP(SERVER_NAME)
|
| 50 |
+
for _fn in _load_functions():
|
| 51 |
+
mcp.tool()(_fn)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/app/requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/docker-compose.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
mcp-abundancebin:
|
| 5 |
+
build: .
|
| 6 |
+
image: mcp-abundancebin:latest
|
| 7 |
+
container_name: mcp-abundancebin
|
| 8 |
+
ports:
|
| 9 |
+
- "8000:8000"
|
| 10 |
+
environment:
|
| 11 |
+
- MCP_SERVER_NAME=abundancebin
|
| 12 |
+
volumes:
|
| 13 |
+
- ./workspace:/app/workspace
|
| 14 |
+
- ./output:/app/output
|
| 15 |
+
restart: unless-stopped
|
| 16 |
+
healthcheck:
|
| 17 |
+
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
|
| 18 |
+
interval: 30s
|
| 19 |
+
timeout: 10s
|
| 20 |
+
retries: 3
|
| 21 |
+
start_period: 5s
|
| 22 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/environment.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
name: mcp-tool
|
| 3 |
+
channels:
|
| 4 |
+
- bioconda
|
| 5 |
+
- conda-forge
|
| 6 |
+
- defaults
|
| 7 |
+
dependencies:
|
| 8 |
+
- abundancebin
|
| 9 |
+
- python=3.10
|
| 10 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_abundancebin/requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastmcp
|
| 2 |
+
mcp
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Install Miniconda
|
| 8 |
+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh
|
| 9 |
+
|
| 10 |
+
# Add conda to PATH
|
| 11 |
+
ENV PATH="/opt/conda/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Install anarci via conda (e.g., from bioconda)
|
| 14 |
+
RUN conda install -c bioconda anarci -y && conda clean -a
|
| 15 |
+
|
| 16 |
+
# Install Python dependencies
|
| 17 |
+
RUN pip install uv
|
| 18 |
+
RUN uv pip install --system fastmcp
|
| 19 |
+
|
| 20 |
+
# Create app directory
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
|
| 23 |
+
# Copy your MCP server
|
| 24 |
+
COPY app/anarci_server.py /app/
|
| 25 |
+
|
| 26 |
+
# Create workspace and output directories
|
| 27 |
+
RUN mkdir -p /app/workspace /app/output
|
| 28 |
+
|
| 29 |
+
# Make sure the server script is executable
|
| 30 |
+
RUN chmod +x /app/anarci_server.py
|
| 31 |
+
|
| 32 |
+
# Expose port for MCP over HTTP (optional)
|
| 33 |
+
EXPOSE 8000
|
| 34 |
+
|
| 35 |
+
# Health check
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)"
|
| 37 |
+
|
| 38 |
+
# Default command runs the MCP server via stdio
|
| 39 |
+
CMD ["python", "/app/anarci_server.py"]
|
| 40 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/app/__pycache__/anarci_shim_server.cpython-311.pyc
ADDED
|
Binary file (3.56 kB). View file
|
|
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/app/anarci_server.py
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import subprocess
|
| 3 |
+
from typing import Optional, List, Union
|
| 4 |
+
|
| 5 |
+
from mcp.server.fastmcp import FastMCP
|
| 6 |
+
|
| 7 |
+
SERVER_NAME = 'local_anarci'
|
| 8 |
+
mcp = FastMCP(SERVER_NAME)
|
| 9 |
+
|
| 10 |
+
@mcp.tool()
|
| 11 |
+
def run_anarci(
|
| 12 |
+
sequence: Optional[str] = None,
|
| 13 |
+
input_file: Optional[str] = None,
|
| 14 |
+
output_file: Optional[str] = None,
|
| 15 |
+
scheme: str = "imgt",
|
| 16 |
+
restrict: Optional[str] = None,
|
| 17 |
+
species: Optional[str] = None,
|
| 18 |
+
csv: bool = False,
|
| 19 |
+
ncpu: int = 1,
|
| 20 |
+
bit_score_threshold: float = 80.0,
|
| 21 |
+
assign_germline: bool = False,
|
| 22 |
+
name: Optional[str] = None,
|
| 23 |
+
verbose: bool = False
|
| 24 |
+
):
|
| 25 |
+
"""
|
| 26 |
+
ANARCI: Antibody Numbering and Antigen Receptor ClassIfication.
|
| 27 |
+
Numbers amino-acid sequences of antibody and T-cell receptor variable domains.
|
| 28 |
+
|
| 29 |
+
Args:
|
| 30 |
+
sequence: A single amino acid sequence to number.
|
| 31 |
+
input_file: Path to a FASTA file containing sequences to number.
|
| 32 |
+
output_file: Path to the output file. If not provided, results are printed to stdout.
|
| 33 |
+
scheme: Numbering scheme to use. Options: 'imgt', 'kabat', 'chothia', 'martin', 'aho'. (Default: 'imgt')
|
| 34 |
+
restrict: Restrict numbering to specific domain types. Options: 'ig' (immunoglobulins), 'tr' (T-cell receptors).
|
| 35 |
+
species: Restrict germline search to specific species (e.g., 'human', 'mouse', 'rat', 'rabbit', 'rhesus', 'pig', 'alpaca').
|
| 36 |
+
csv: If True, output results in CSV format (horizontal). If False, uses plain text (vertical).
|
| 37 |
+
ncpu: Number of CPUs to use for parallel processing. (Default: 1)
|
| 38 |
+
bit_score_threshold: HMMER bit score threshold for domain identification. (Default: 80.0)
|
| 39 |
+
assign_germline: If True, assign germline species and gene information.
|
| 40 |
+
name: Name to assign to the single sequence (used with 'sequence' parameter).
|
| 41 |
+
verbose: If True, produce verbose output.
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
# Input validation
|
| 45 |
+
if not sequence and not input_file:
|
| 46 |
+
raise ValueError("Either 'sequence' or 'input_file' must be provided.")
|
| 47 |
+
|
| 48 |
+
if sequence and input_file:
|
| 49 |
+
raise ValueError("Provide either 'sequence' or 'input_file', not both.")
|
| 50 |
+
|
| 51 |
+
valid_schemes = ["imgt", "kabat", "chothia", "martin", "aho"]
|
| 52 |
+
if scheme.lower() not in valid_schemes:
|
| 53 |
+
raise ValueError(f"Invalid scheme '{scheme}'. Must be one of {valid_schemes}")
|
| 54 |
+
|
| 55 |
+
if restrict and restrict.lower() not in ["ig", "tr"]:
|
| 56 |
+
raise ValueError("Restrict must be either 'ig' or 'tr'.")
|
| 57 |
+
|
| 58 |
+
# Build command
|
| 59 |
+
# The CLI tool is typically named 'ANARCI' (uppercase)
|
| 60 |
+
cmd = ["ANARCI"]
|
| 61 |
+
|
| 62 |
+
if sequence:
|
| 63 |
+
cmd.extend(["--sequence", sequence])
|
| 64 |
+
if name:
|
| 65 |
+
cmd.extend(["--name", name])
|
| 66 |
+
|
| 67 |
+
if input_file:
|
| 68 |
+
input_path = Path(input_file)
|
| 69 |
+
if not input_path.exists():
|
| 70 |
+
raise FileNotFoundError(f"Input file not found: {input_file}")
|
| 71 |
+
cmd.extend(["--input", str(input_path)])
|
| 72 |
+
|
| 73 |
+
if output_file:
|
| 74 |
+
cmd.extend(["--outfile", output_file])
|
| 75 |
+
|
| 76 |
+
cmd.extend(["--scheme", scheme.lower()])
|
| 77 |
+
|
| 78 |
+
if restrict:
|
| 79 |
+
cmd.extend(["--restrict", restrict.lower()])
|
| 80 |
+
|
| 81 |
+
if species:
|
| 82 |
+
cmd.extend(["--species", species.lower()])
|
| 83 |
+
|
| 84 |
+
if csv:
|
| 85 |
+
cmd.append("--csv")
|
| 86 |
+
|
| 87 |
+
if assign_germline:
|
| 88 |
+
cmd.append("--assign_germline")
|
| 89 |
+
|
| 90 |
+
if verbose:
|
| 91 |
+
cmd.append("--verbose")
|
| 92 |
+
|
| 93 |
+
cmd.extend(["--ncpu", str(ncpu)])
|
| 94 |
+
cmd.extend(["--bit_score_threshold", str(bit_score_threshold)])
|
| 95 |
+
|
| 96 |
+
try:
|
| 97 |
+
# Execute the tool
|
| 98 |
+
result = subprocess.run(
|
| 99 |
+
cmd,
|
| 100 |
+
capture_output=True,
|
| 101 |
+
text=True,
|
| 102 |
+
check=True
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
output_files = []
|
| 106 |
+
if output_file:
|
| 107 |
+
# ANARCI often appends suffixes depending on the format
|
| 108 |
+
# e.g., .csv or .txt
|
| 109 |
+
actual_output = Path(output_file)
|
| 110 |
+
if actual_output.exists():
|
| 111 |
+
output_files.append(str(actual_output))
|
| 112 |
+
else:
|
| 113 |
+
# Check for common suffixes if the exact file isn't found
|
| 114 |
+
for suffix in [".csv", ".txt"]:
|
| 115 |
+
p = Path(f"{output_file}{suffix}")
|
| 116 |
+
if p.exists():
|
| 117 |
+
output_files.append(str(p))
|
| 118 |
+
|
| 119 |
+
return {
|
| 120 |
+
"command_executed": " ".join(cmd),
|
| 121 |
+
"stdout": result.stdout,
|
| 122 |
+
"stderr": result.stderr,
|
| 123 |
+
"output_files": output_files
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
except subprocess.CalledProcessError as e:
|
| 127 |
+
return {
|
| 128 |
+
"command_executed": " ".join(cmd),
|
| 129 |
+
"stdout": e.stdout,
|
| 130 |
+
"stderr": e.stderr,
|
| 131 |
+
"error": f"ANARCI failed with return code {e.returncode}"
|
| 132 |
+
}
|
| 133 |
+
except Exception as e:
|
| 134 |
+
return {
|
| 135 |
+
"command_executed": " ".join(cmd),
|
| 136 |
+
"error": str(e)
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
@mcp.tool()
|
| 140 |
+
def list_anarci_species():
|
| 141 |
+
"""
|
| 142 |
+
Returns a list of species supported by ANARCI for germline alignment.
|
| 143 |
+
Note: This is an informational tool based on ANARCI's standard database.
|
| 144 |
+
"""
|
| 145 |
+
# Standard species supported by ANARCI
|
| 146 |
+
species_list = [
|
| 147 |
+
"human", "mouse", "rat", "rabbit", "rhesus", "pig", "alpaca",
|
| 148 |
+
"dog", "chicken", "cow", "horse", "monkey", "macaque"
|
| 149 |
+
]
|
| 150 |
+
|
| 151 |
+
return {
|
| 152 |
+
"supported_species": species_list,
|
| 153 |
+
"note": "Availability may depend on the specific ANARCI version and installed HMM databases."
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
@mcp.tool()
|
| 157 |
+
def get_anarci_version():
|
| 158 |
+
"""
|
| 159 |
+
Retrieves the version information for the installed ANARCI tool.
|
| 160 |
+
"""
|
| 161 |
+
try:
|
| 162 |
+
# ANARCI doesn't always have a simple --version flag in older versions,
|
| 163 |
+
# but we can try to run it to see the help header or use pip/conda info.
|
| 164 |
+
# Most modern versions support --version.
|
| 165 |
+
result = subprocess.run(
|
| 166 |
+
["ANARCI", "--version"],
|
| 167 |
+
capture_output=True,
|
| 168 |
+
text=True,
|
| 169 |
+
check=False
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
# If --version fails, try to get it from the help output
|
| 173 |
+
if result.returncode != 0:
|
| 174 |
+
result = subprocess.run(
|
| 175 |
+
["ANARCI", "--help"],
|
| 176 |
+
capture_output=True,
|
| 177 |
+
text=True,
|
| 178 |
+
check=False
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
return {
|
| 182 |
+
"stdout": result.stdout,
|
| 183 |
+
"stderr": result.stderr
|
| 184 |
+
}
|
| 185 |
+
except Exception as e:
|
| 186 |
+
return {
|
| 187 |
+
"error": f"Could not determine ANARCI version: {str(e)}"
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
if __name__ == "__main__":
|
| 191 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/app/anarci_shim_server.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import ast
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
from mcp.server.fastmcp import FastMCP
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_anarci/app/anarci_server.py')
|
| 11 |
+
LOCAL_SERVER = Path(__file__).with_name(SOURCE_SERVER.name)
|
| 12 |
+
SERVER_NAME = 'biosci_anarci'
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class _ShimMCP:
|
| 16 |
+
@staticmethod
|
| 17 |
+
def tool(*args, **kwargs):
|
| 18 |
+
if args and callable(args[0]) and len(args) == 1 and not kwargs:
|
| 19 |
+
return args[0]
|
| 20 |
+
def _decorator(fn):
|
| 21 |
+
return fn
|
| 22 |
+
return _decorator
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _resolve_source_server():
|
| 26 |
+
if LOCAL_SERVER.exists() and LOCAL_SERVER.name != Path(__file__).name:
|
| 27 |
+
return LOCAL_SERVER
|
| 28 |
+
return SOURCE_SERVER
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def _load_functions():
|
| 32 |
+
source_server = _resolve_source_server()
|
| 33 |
+
code = source_server.read_text(encoding="utf-8")
|
| 34 |
+
tree = ast.parse(code, filename=str(source_server))
|
| 35 |
+
function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")]
|
| 36 |
+
namespace = {
|
| 37 |
+
"__name__": "__mcp_source__",
|
| 38 |
+
"mcp": _ShimMCP(),
|
| 39 |
+
}
|
| 40 |
+
exec(compile(code, str(source_server), "exec"), namespace, namespace)
|
| 41 |
+
loaded = []
|
| 42 |
+
for name in function_names:
|
| 43 |
+
fn = namespace.get(name)
|
| 44 |
+
if callable(fn):
|
| 45 |
+
loaded.append(fn)
|
| 46 |
+
return loaded
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
mcp = FastMCP(SERVER_NAME)
|
| 50 |
+
for _fn in _load_functions():
|
| 51 |
+
mcp.tool()(_fn)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/app/requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/docker-compose.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
mcp-anarci:
|
| 5 |
+
build: .
|
| 6 |
+
image: mcp-anarci:latest
|
| 7 |
+
container_name: mcp-anarci
|
| 8 |
+
ports:
|
| 9 |
+
- "8000:8000"
|
| 10 |
+
environment:
|
| 11 |
+
- MCP_SERVER_NAME=anarci
|
| 12 |
+
volumes:
|
| 13 |
+
- ./workspace:/app/workspace
|
| 14 |
+
- ./output:/app/output
|
| 15 |
+
restart: unless-stopped
|
| 16 |
+
healthcheck:
|
| 17 |
+
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
|
| 18 |
+
interval: 30s
|
| 19 |
+
timeout: 10s
|
| 20 |
+
retries: 3
|
| 21 |
+
start_period: 5s
|
| 22 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/environment.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
name: mcp-tool
|
| 3 |
+
channels:
|
| 4 |
+
- bioconda
|
| 5 |
+
- conda-forge
|
| 6 |
+
- defaults
|
| 7 |
+
dependencies:
|
| 8 |
+
- anarci
|
| 9 |
+
- python=3.10
|
| 10 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_anarci/requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastmcp
|
| 2 |
+
mcp
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Install Miniconda
|
| 8 |
+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh
|
| 9 |
+
|
| 10 |
+
# Add conda to PATH
|
| 11 |
+
ENV PATH="/opt/conda/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Install ariba via conda (e.g., from bioconda)
|
| 14 |
+
RUN conda install -c bioconda ariba -y && conda clean -a
|
| 15 |
+
|
| 16 |
+
# Install Python dependencies
|
| 17 |
+
RUN pip install uv
|
| 18 |
+
RUN uv pip install --system fastmcp
|
| 19 |
+
|
| 20 |
+
# Create app directory
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
|
| 23 |
+
# Copy your MCP server
|
| 24 |
+
COPY app/ariba_server.py /app/
|
| 25 |
+
|
| 26 |
+
# Create workspace and output directories
|
| 27 |
+
RUN mkdir -p /app/workspace /app/output
|
| 28 |
+
|
| 29 |
+
# Make sure the server script is executable
|
| 30 |
+
RUN chmod +x /app/ariba_server.py
|
| 31 |
+
|
| 32 |
+
# Expose port for MCP over HTTP (optional)
|
| 33 |
+
EXPOSE 8000
|
| 34 |
+
|
| 35 |
+
# Health check
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)"
|
| 37 |
+
|
| 38 |
+
# Default command runs the MCP server via stdio
|
| 39 |
+
CMD ["python", "/app/ariba_server.py"]
|
| 40 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/app/__pycache__/ariba_shim_server.cpython-311.pyc
ADDED
|
Binary file (3.56 kB). View file
|
|
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/app/ariba_server.py
ADDED
|
@@ -0,0 +1,509 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import tempfile
|
| 3 |
+
import os
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from typing import Optional, List, Literal
|
| 6 |
+
|
| 7 |
+
# MCP decorator is not needed for the final code, as per instructions.
|
| 8 |
+
# Assuming it's provided by the MCP framework.
|
| 9 |
+
# from mcp import tool as mcp_tool
|
| 10 |
+
# For linting purposes, we can create a dummy decorator.
|
| 11 |
+
class mcp:
|
| 12 |
+
def tool(func):
|
| 13 |
+
return func
|
| 14 |
+
|
| 15 |
+
@mcp.tool
|
| 16 |
+
def pubmlstget(
|
| 17 |
+
pubmlst_db: str,
|
| 18 |
+
outdir: Path,
|
| 19 |
+
force: bool = False,
|
| 20 |
+
noverify: bool = False,
|
| 21 |
+
):
|
| 22 |
+
"""
|
| 23 |
+
Download data from a pubmlst database.
|
| 24 |
+
|
| 25 |
+
Args:
|
| 26 |
+
pubmlst_db: Name of the pubmlst database to download.
|
| 27 |
+
outdir: Output directory to save the downloaded data.
|
| 28 |
+
force: Overwrite existing files if they exist.
|
| 29 |
+
noverify: Do not verify the SSL certificate.
|
| 30 |
+
"""
|
| 31 |
+
# Input validation
|
| 32 |
+
if not pubmlst_db:
|
| 33 |
+
raise ValueError("pubmlst_db must be provided.")
|
| 34 |
+
|
| 35 |
+
try:
|
| 36 |
+
outdir.mkdir(parents=True, exist_ok=True)
|
| 37 |
+
except Exception as e:
|
| 38 |
+
raise IOError(f"Could not create output directory {outdir}: {e}")
|
| 39 |
+
|
| 40 |
+
# Command construction
|
| 41 |
+
cmd = ["ariba", "pubmlstget"]
|
| 42 |
+
if force:
|
| 43 |
+
cmd.append("--force")
|
| 44 |
+
if noverify:
|
| 45 |
+
cmd.append("--noverify")
|
| 46 |
+
cmd.extend([pubmlst_db, str(outdir)])
|
| 47 |
+
|
| 48 |
+
# Subprocess execution
|
| 49 |
+
try:
|
| 50 |
+
result = subprocess.run(
|
| 51 |
+
cmd,
|
| 52 |
+
check=True,
|
| 53 |
+
capture_output=True,
|
| 54 |
+
text=True,
|
| 55 |
+
)
|
| 56 |
+
output_files = [str(p) for p in outdir.rglob("*") if p.is_file()]
|
| 57 |
+
return {
|
| 58 |
+
"command_executed": " ".join(cmd),
|
| 59 |
+
"stdout": result.stdout,
|
| 60 |
+
"stderr": result.stderr,
|
| 61 |
+
"output_files": output_files,
|
| 62 |
+
}
|
| 63 |
+
except FileNotFoundError:
|
| 64 |
+
raise RuntimeError("ariba command not found. Please ensure it is in your PATH.")
|
| 65 |
+
except subprocess.CalledProcessError as e:
|
| 66 |
+
return {
|
| 67 |
+
"command_executed": " ".join(cmd),
|
| 68 |
+
"stdout": e.stdout,
|
| 69 |
+
"stderr": e.stderr,
|
| 70 |
+
"error": "ARIBA pubmlstget failed",
|
| 71 |
+
"return_code": e.returncode,
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
@mcp.tool
|
| 75 |
+
def getref(
|
| 76 |
+
ref_name: Literal[
|
| 77 |
+
"argannot", "card", "megares", "plasmidfinder", "resfinder",
|
| 78 |
+
"srst2_argannot", "vfdb_core", "vfdb_full", "virfinder"
|
| 79 |
+
],
|
| 80 |
+
outdir: Path,
|
| 81 |
+
force: bool = False,
|
| 82 |
+
metadata_only: bool = False,
|
| 83 |
+
):
|
| 84 |
+
"""
|
| 85 |
+
Download reference data from NCBI/RefSeq or other sources.
|
| 86 |
+
|
| 87 |
+
Args:
|
| 88 |
+
ref_name: Name of reference data to download.
|
| 89 |
+
outdir: Output directory to save the reference data.
|
| 90 |
+
force: Overwrite existing files if they exist.
|
| 91 |
+
metadata_only: Only download metadata, not the sequences.
|
| 92 |
+
"""
|
| 93 |
+
# Input validation
|
| 94 |
+
try:
|
| 95 |
+
outdir.mkdir(parents=True, exist_ok=True)
|
| 96 |
+
except Exception as e:
|
| 97 |
+
raise IOError(f"Could not create output directory {outdir}: {e}")
|
| 98 |
+
|
| 99 |
+
# Command construction
|
| 100 |
+
cmd = ["ariba", "getref"]
|
| 101 |
+
if force:
|
| 102 |
+
cmd.append("--force")
|
| 103 |
+
if metadata_only:
|
| 104 |
+
cmd.append("--metadata_only")
|
| 105 |
+
cmd.extend([ref_name, str(outdir)])
|
| 106 |
+
|
| 107 |
+
# Subprocess execution
|
| 108 |
+
try:
|
| 109 |
+
result = subprocess.run(
|
| 110 |
+
cmd,
|
| 111 |
+
check=True,
|
| 112 |
+
capture_output=True,
|
| 113 |
+
text=True,
|
| 114 |
+
)
|
| 115 |
+
output_files = [str(p) for p in outdir.rglob("*") if p.is_file()]
|
| 116 |
+
return {
|
| 117 |
+
"command_executed": " ".join(cmd),
|
| 118 |
+
"stdout": result.stdout,
|
| 119 |
+
"stderr": result.stderr,
|
| 120 |
+
"output_files": output_files,
|
| 121 |
+
}
|
| 122 |
+
except FileNotFoundError:
|
| 123 |
+
raise RuntimeError("ariba command not found. Please ensure it is in your PATH.")
|
| 124 |
+
except subprocess.CalledProcessError as e:
|
| 125 |
+
return {
|
| 126 |
+
"command_executed": " ".join(cmd),
|
| 127 |
+
"stdout": e.stdout,
|
| 128 |
+
"stderr": e.stderr,
|
| 129 |
+
"error": "ARIBA getref failed",
|
| 130 |
+
"return_code": e.returncode,
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
@mcp.tool
|
| 134 |
+
def prepareref(
|
| 135 |
+
fasta_in: Path,
|
| 136 |
+
metadata_in: Path,
|
| 137 |
+
outdir: Path,
|
| 138 |
+
min_length: int = 1,
|
| 139 |
+
max_length: int = 10000,
|
| 140 |
+
max_n: int = 5,
|
| 141 |
+
no_cdhit: bool = False,
|
| 142 |
+
cdhit_clusters: Optional[Path] = None,
|
| 143 |
+
cdhit_threads: int = 1,
|
| 144 |
+
cdhit_mem: int = 400,
|
| 145 |
+
force: bool = False,
|
| 146 |
+
tmp_dir: Optional[Path] = None,
|
| 147 |
+
verbose: bool = False,
|
| 148 |
+
debug: bool = False,
|
| 149 |
+
):
|
| 150 |
+
"""
|
| 151 |
+
Prepare reference data for use with ARIBA.
|
| 152 |
+
|
| 153 |
+
Args:
|
| 154 |
+
fasta_in: Input FASTA file of sequences.
|
| 155 |
+
metadata_in: Input TSV file of metadata.
|
| 156 |
+
outdir: Output directory for prepared reference.
|
| 157 |
+
min_length: Minimum sequence length.
|
| 158 |
+
max_length: Maximum sequence length.
|
| 159 |
+
max_n: Maximum number of Ns allowed in a sequence.
|
| 160 |
+
no_cdhit: Do not run cd-hit.
|
| 161 |
+
cdhit_clusters: File of cd-hit clusters. Implies --no_cdhit.
|
| 162 |
+
cdhit_threads: Threads to use for cd-hit.
|
| 163 |
+
cdhit_mem: Memory for cd-hit in MB.
|
| 164 |
+
force: Overwrite existing files.
|
| 165 |
+
tmp_dir: Use this directory for temporary files.
|
| 166 |
+
verbose: Print STDOUT and STDERR from external programs.
|
| 167 |
+
debug: Print debugging messages.
|
| 168 |
+
"""
|
| 169 |
+
# Input validation
|
| 170 |
+
if not fasta_in.is_file():
|
| 171 |
+
raise FileNotFoundError(f"Input FASTA file not found: {fasta_in}")
|
| 172 |
+
if not metadata_in.is_file():
|
| 173 |
+
raise FileNotFoundError(f"Input metadata file not found: {metadata_in}")
|
| 174 |
+
if cdhit_clusters and not cdhit_clusters.is_file():
|
| 175 |
+
raise FileNotFoundError(f"cd-hit clusters file not found: {cdhit_clusters}")
|
| 176 |
+
if min_length <= 0:
|
| 177 |
+
raise ValueError("min_length must be a positive integer.")
|
| 178 |
+
if cdhit_threads <= 0:
|
| 179 |
+
raise ValueError("cdhit_threads must be a positive integer.")
|
| 180 |
+
|
| 181 |
+
try:
|
| 182 |
+
outdir.mkdir(parents=True, exist_ok=True)
|
| 183 |
+
except Exception as e:
|
| 184 |
+
raise IOError(f"Could not create output directory {outdir}: {e}")
|
| 185 |
+
|
| 186 |
+
# Command construction
|
| 187 |
+
cmd = ["ariba", "prepareref",
|
| 188 |
+
"--fasta_in", str(fasta_in),
|
| 189 |
+
"--metadata_in", str(metadata_in),
|
| 190 |
+
"--outdir", str(outdir),
|
| 191 |
+
"--min_length", str(min_length),
|
| 192 |
+
"--max_length", str(max_length),
|
| 193 |
+
"--max_N", str(max_n),
|
| 194 |
+
"--cdhit_threads", str(cdhit_threads),
|
| 195 |
+
"--cdhit_mem", str(cdhit_mem)]
|
| 196 |
+
|
| 197 |
+
if no_cdhit:
|
| 198 |
+
cmd.append("--no_cdhit")
|
| 199 |
+
if cdhit_clusters:
|
| 200 |
+
cmd.extend(["--cdhit_clusters", str(cdhit_clusters)])
|
| 201 |
+
if force:
|
| 202 |
+
cmd.append("--force")
|
| 203 |
+
if tmp_dir:
|
| 204 |
+
cmd.extend(["--tmp_dir", str(tmp_dir)])
|
| 205 |
+
if verbose:
|
| 206 |
+
cmd.append("--verbose")
|
| 207 |
+
if debug:
|
| 208 |
+
cmd.append("--debug")
|
| 209 |
+
|
| 210 |
+
# Subprocess execution
|
| 211 |
+
try:
|
| 212 |
+
result = subprocess.run(
|
| 213 |
+
cmd,
|
| 214 |
+
check=True,
|
| 215 |
+
capture_output=True,
|
| 216 |
+
text=True,
|
| 217 |
+
)
|
| 218 |
+
output_files = [str(p) for p in outdir.rglob("*") if p.is_file()]
|
| 219 |
+
return {
|
| 220 |
+
"command_executed": " ".join(cmd),
|
| 221 |
+
"stdout": result.stdout,
|
| 222 |
+
"stderr": result.stderr,
|
| 223 |
+
"output_files": output_files,
|
| 224 |
+
}
|
| 225 |
+
except FileNotFoundError:
|
| 226 |
+
raise RuntimeError("ariba command not found. Please ensure it is in your PATH.")
|
| 227 |
+
except subprocess.CalledProcessError as e:
|
| 228 |
+
return {
|
| 229 |
+
"command_executed": " ".join(cmd),
|
| 230 |
+
"stdout": e.stdout,
|
| 231 |
+
"stderr": e.stderr,
|
| 232 |
+
"error": "ARIBA prepareref failed",
|
| 233 |
+
"return_code": e.returncode,
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
@mcp.tool
|
| 237 |
+
def run(
|
| 238 |
+
ref_dir: Path,
|
| 239 |
+
reads1: Path,
|
| 240 |
+
reads2: Path,
|
| 241 |
+
outdir: Path,
|
| 242 |
+
assembly_cov: int = 10,
|
| 243 |
+
gene_cov_cutoff: float = 0.95,
|
| 244 |
+
gene_nt_extend: int = 10,
|
| 245 |
+
local_th: float = 0.9,
|
| 246 |
+
min_gene_cov: int = 1,
|
| 247 |
+
assembled_threshold: float = 0.95,
|
| 248 |
+
nucmer_min_id: int = 90,
|
| 249 |
+
nucmer_min_len: int = 50,
|
| 250 |
+
nucmer_breaklen: int = 10,
|
| 251 |
+
nucmer_max_gap: int = 20,
|
| 252 |
+
assembler: Literal["fermilite", "spades"] = "fermilite",
|
| 253 |
+
spades_options: str = "--careful",
|
| 254 |
+
threads: int = 1,
|
| 255 |
+
force: bool = False,
|
| 256 |
+
tmp_dir: Optional[Path] = None,
|
| 257 |
+
verbose: bool = False,
|
| 258 |
+
debug: bool = False,
|
| 259 |
+
noclean: bool = False,
|
| 260 |
+
unique_map_only: bool = False,
|
| 261 |
+
other_ref_fasta: Optional[Path] = None,
|
| 262 |
+
filestem: Optional[str] = None,
|
| 263 |
+
):
|
| 264 |
+
"""
|
| 265 |
+
Run the main ARIBA pipeline to identify genes from paired sequencing reads.
|
| 266 |
+
|
| 267 |
+
Args:
|
| 268 |
+
ref_dir: Reference directory, created by 'prepareref'.
|
| 269 |
+
reads1: First paired-end reads file.
|
| 270 |
+
reads2: Second paired-end reads file.
|
| 271 |
+
outdir: Output directory for results.
|
| 272 |
+
assembly_cov: Minimum coverage of internal contig flank.
|
| 273 |
+
gene_cov_cutoff: Minimum proportion of gene length covered by reads.
|
| 274 |
+
gene_nt_extend: Max nucleotides to extend assembly past gene ends.
|
| 275 |
+
local_th: Minimum proportion of bases in local assembly identical to reference.
|
| 276 |
+
min_gene_cov: Minimum read coverage depth on any base of a gene.
|
| 277 |
+
assembled_threshold: Minimum proportion of bases in a gene covered by local assembly.
|
| 278 |
+
nucmer_min_id: nucmer --minid option.
|
| 279 |
+
nucmer_min_len: nucmer --mincluster option.
|
| 280 |
+
nucmer_breaklen: nucmer --breaklen option.
|
| 281 |
+
nucmer_max_gap: nucmer --maxgap option.
|
| 282 |
+
assembler: Assembler to use.
|
| 283 |
+
spades_options: Options to pass to spades.
|
| 284 |
+
threads: Number of threads to use.
|
| 285 |
+
force: Overwrite existing output files.
|
| 286 |
+
tmp_dir: Use this directory for temporary files.
|
| 287 |
+
verbose: Print STDOUT and STDERR from external programs.
|
| 288 |
+
debug: Print debugging messages.
|
| 289 |
+
noclean: Do not clean up intermediate files.
|
| 290 |
+
unique_map_only: Only use uniquely mapping reads.
|
| 291 |
+
other_ref_fasta: FASTA file of other reference sequences (e.g., host genome).
|
| 292 |
+
filestem: Filestem to use for output files.
|
| 293 |
+
"""
|
| 294 |
+
# Input validation
|
| 295 |
+
if not ref_dir.is_dir():
|
| 296 |
+
raise FileNotFoundError(f"Reference directory not found: {ref_dir}")
|
| 297 |
+
if not reads1.is_file():
|
| 298 |
+
raise FileNotFoundError(f"Reads file 1 not found: {reads1}")
|
| 299 |
+
if not reads2.is_file():
|
| 300 |
+
raise FileNotFoundError(f"Reads file 2 not found: {reads2}")
|
| 301 |
+
if other_ref_fasta and not other_ref_fasta.is_file():
|
| 302 |
+
raise FileNotFoundError(f"Other reference FASTA not found: {other_ref_fasta}")
|
| 303 |
+
if threads <= 0:
|
| 304 |
+
raise ValueError("threads must be a positive integer.")
|
| 305 |
+
|
| 306 |
+
try:
|
| 307 |
+
outdir.mkdir(parents=True, exist_ok=True)
|
| 308 |
+
except Exception as e:
|
| 309 |
+
raise IOError(f"Could not create output directory {outdir}: {e}")
|
| 310 |
+
|
| 311 |
+
# Command construction
|
| 312 |
+
cmd = ["ariba", "run",
|
| 313 |
+
"--assembly_cov", str(assembly_cov),
|
| 314 |
+
"--gene_cov_cutoff", str(gene_cov_cutoff),
|
| 315 |
+
"--gene_nt_extend", str(gene_nt_extend),
|
| 316 |
+
"--local_th", str(local_th),
|
| 317 |
+
"--min_gene_cov", str(min_gene_cov),
|
| 318 |
+
"--assembled_threshold", str(assembled_threshold),
|
| 319 |
+
"--nucmer_min_id", str(nucmer_min_id),
|
| 320 |
+
"--nucmer_min_len", str(nucmer_min_len),
|
| 321 |
+
"--nucmer_breaklen", str(nucmer_breaklen),
|
| 322 |
+
"--nucmer_max_gap", str(nucmer_max_gap),
|
| 323 |
+
"--assembler", assembler,
|
| 324 |
+
"--spades_options", spades_options,
|
| 325 |
+
"--threads", str(threads)]
|
| 326 |
+
|
| 327 |
+
if force: cmd.append("--force")
|
| 328 |
+
if verbose: cmd.append("--verbose")
|
| 329 |
+
if debug: cmd.append("--debug")
|
| 330 |
+
if noclean: cmd.append("--noclean")
|
| 331 |
+
if unique_map_only: cmd.append("--unique_map_only")
|
| 332 |
+
if tmp_dir: cmd.extend(["--tmp_dir", str(tmp_dir)])
|
| 333 |
+
if other_ref_fasta: cmd.extend(["--other_ref_fasta", str(other_ref_fasta)])
|
| 334 |
+
if filestem: cmd.extend(["--filestem", filestem])
|
| 335 |
+
|
| 336 |
+
cmd.extend([str(ref_dir), str(reads1), str(reads2), str(outdir)])
|
| 337 |
+
|
| 338 |
+
# Subprocess execution
|
| 339 |
+
try:
|
| 340 |
+
result = subprocess.run(
|
| 341 |
+
cmd,
|
| 342 |
+
check=True,
|
| 343 |
+
capture_output=True,
|
| 344 |
+
text=True,
|
| 345 |
+
)
|
| 346 |
+
output_files = [str(p) for p in outdir.rglob("*") if p.is_file()]
|
| 347 |
+
return {
|
| 348 |
+
"command_executed": " ".join(cmd),
|
| 349 |
+
"stdout": result.stdout,
|
| 350 |
+
"stderr": result.stderr,
|
| 351 |
+
"output_files": output_files,
|
| 352 |
+
}
|
| 353 |
+
except FileNotFoundError:
|
| 354 |
+
raise RuntimeError("ariba command not found. Please ensure it is in your PATH.")
|
| 355 |
+
except subprocess.CalledProcessError as e:
|
| 356 |
+
return {
|
| 357 |
+
"command_executed": " ".join(cmd),
|
| 358 |
+
"stdout": e.stdout,
|
| 359 |
+
"stderr": e.stderr,
|
| 360 |
+
"error": "ARIBA run failed",
|
| 361 |
+
"return_code": e.returncode,
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
@mcp.tool
|
| 365 |
+
def summary(
|
| 366 |
+
out_prefix: Path,
|
| 367 |
+
in_dirs: List[Path],
|
| 368 |
+
preset: Literal["all", "assembled", "flags", "variants"] = "all",
|
| 369 |
+
cluster_cols: Optional[str] = None,
|
| 370 |
+
col_sep: str = ".",
|
| 371 |
+
row_sep: str = ".",
|
| 372 |
+
force: bool = False,
|
| 373 |
+
verbose: bool = False,
|
| 374 |
+
debug: bool = False,
|
| 375 |
+
):
|
| 376 |
+
"""
|
| 377 |
+
Summarise multiple ARIBA reports into a single file.
|
| 378 |
+
|
| 379 |
+
Args:
|
| 380 |
+
out_prefix: Output file prefix.
|
| 381 |
+
in_dirs: List of directories containing ARIBA results.
|
| 382 |
+
preset: Output preset.
|
| 383 |
+
cluster_cols: Columns to use for clustering.
|
| 384 |
+
col_sep: Separator between column names in output file.
|
| 385 |
+
row_sep: Separator between sample name and cluster name in output file.
|
| 386 |
+
force: Overwrite existing files.
|
| 387 |
+
verbose: Print STDOUT and STDERR from external programs.
|
| 388 |
+
debug: Print debugging messages.
|
| 389 |
+
"""
|
| 390 |
+
# Input validation
|
| 391 |
+
if not in_dirs:
|
| 392 |
+
raise ValueError("At least one input directory must be provided in in_dirs.")
|
| 393 |
+
for d in in_dirs:
|
| 394 |
+
if not d.is_dir():
|
| 395 |
+
raise FileNotFoundError(f"Input directory not found: {d}")
|
| 396 |
+
report_path = d / "report.tsv"
|
| 397 |
+
if not report_path.is_file():
|
| 398 |
+
raise FileNotFoundError(f"Expected report file not found in {d}: {report_path}")
|
| 399 |
+
|
| 400 |
+
try:
|
| 401 |
+
out_prefix.parent.mkdir(parents=True, exist_ok=True)
|
| 402 |
+
except Exception as e:
|
| 403 |
+
raise IOError(f"Could not create output directory {out_prefix.parent}: {e}")
|
| 404 |
+
|
| 405 |
+
# Command construction
|
| 406 |
+
cmd = ["ariba", "summary",
|
| 407 |
+
"--preset", preset,
|
| 408 |
+
"--col_sep", col_sep,
|
| 409 |
+
"--row_sep", row_sep]
|
| 410 |
+
|
| 411 |
+
if cluster_cols:
|
| 412 |
+
cmd.extend(["--cluster_cols", cluster_cols])
|
| 413 |
+
if force:
|
| 414 |
+
cmd.append("--force")
|
| 415 |
+
if verbose:
|
| 416 |
+
cmd.append("--verbose")
|
| 417 |
+
if debug:
|
| 418 |
+
cmd.append("--debug")
|
| 419 |
+
|
| 420 |
+
cmd.append(str(out_prefix))
|
| 421 |
+
cmd.extend([str(d) for d in in_dirs])
|
| 422 |
+
|
| 423 |
+
# Subprocess execution
|
| 424 |
+
try:
|
| 425 |
+
result = subprocess.run(
|
| 426 |
+
cmd,
|
| 427 |
+
check=True,
|
| 428 |
+
capture_output=True,
|
| 429 |
+
text=True,
|
| 430 |
+
)
|
| 431 |
+
output_files = [str(p) for p in out_prefix.parent.glob(f"{out_prefix.name}*")]
|
| 432 |
+
return {
|
| 433 |
+
"command_executed": " ".join(cmd),
|
| 434 |
+
"stdout": result.stdout,
|
| 435 |
+
"stderr": result.stderr,
|
| 436 |
+
"output_files": output_files,
|
| 437 |
+
}
|
| 438 |
+
except FileNotFoundError:
|
| 439 |
+
raise RuntimeError("ariba command not found. Please ensure it is in your PATH.")
|
| 440 |
+
except subprocess.CalledProcessError as e:
|
| 441 |
+
return {
|
| 442 |
+
"command_executed": " ".join(cmd),
|
| 443 |
+
"stdout": e.stdout,
|
| 444 |
+
"stderr": e.stderr,
|
| 445 |
+
"error": "ARIBA summary failed",
|
| 446 |
+
"return_code": e.returncode,
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
@mcp.tool
|
| 450 |
+
def version():
|
| 451 |
+
"""
|
| 452 |
+
Print the ARIBA version number and exit.
|
| 453 |
+
"""
|
| 454 |
+
cmd = ["ariba", "version"]
|
| 455 |
+
try:
|
| 456 |
+
result = subprocess.run(
|
| 457 |
+
cmd,
|
| 458 |
+
check=True,
|
| 459 |
+
capture_output=True,
|
| 460 |
+
text=True,
|
| 461 |
+
)
|
| 462 |
+
return {
|
| 463 |
+
"command_executed": " ".join(cmd),
|
| 464 |
+
"stdout": result.stdout,
|
| 465 |
+
"stderr": result.stderr,
|
| 466 |
+
"version": result.stdout.strip(),
|
| 467 |
+
}
|
| 468 |
+
except FileNotFoundError:
|
| 469 |
+
raise RuntimeError("ariba command not found. Please ensure it is in your PATH.")
|
| 470 |
+
except subprocess.CalledProcessError as e:
|
| 471 |
+
return {
|
| 472 |
+
"command_executed": " ".join(cmd),
|
| 473 |
+
"stdout": e.stdout,
|
| 474 |
+
"stderr": e.stderr,
|
| 475 |
+
"error": "ARIBA version command failed",
|
| 476 |
+
"return_code": e.returncode,
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
@mcp.tool
|
| 480 |
+
def test():
|
| 481 |
+
"""
|
| 482 |
+
Run the ARIBA test suite to verify installation and functionality.
|
| 483 |
+
"""
|
| 484 |
+
cmd = ["ariba", "test"]
|
| 485 |
+
try:
|
| 486 |
+
# The test command can be long-running and produce a lot of output.
|
| 487 |
+
# We capture it as usual.
|
| 488 |
+
result = subprocess.run(
|
| 489 |
+
cmd,
|
| 490 |
+
check=True,
|
| 491 |
+
capture_output=True,
|
| 492 |
+
text=True,
|
| 493 |
+
)
|
| 494 |
+
return {
|
| 495 |
+
"command_executed": " ".join(cmd),
|
| 496 |
+
"stdout": result.stdout,
|
| 497 |
+
"stderr": result.stderr,
|
| 498 |
+
"test_passed": "OK" in result.stderr,
|
| 499 |
+
}
|
| 500 |
+
except FileNotFoundError:
|
| 501 |
+
raise RuntimeError("ariba command not found. Please ensure it is in your PATH.")
|
| 502 |
+
except subprocess.CalledProcessError as e:
|
| 503 |
+
return {
|
| 504 |
+
"command_executed": " ".join(cmd),
|
| 505 |
+
"stdout": e.stdout,
|
| 506 |
+
"stderr": e.stderr,
|
| 507 |
+
"error": "ARIBA test suite failed",
|
| 508 |
+
"return_code": e.returncode,
|
| 509 |
+
}
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/app/ariba_shim_server.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import ast
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
from mcp.server.fastmcp import FastMCP
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ariba/app/ariba_server.py')
|
| 11 |
+
LOCAL_SERVER = Path(__file__).with_name(SOURCE_SERVER.name)
|
| 12 |
+
SERVER_NAME = 'biosci_ariba'
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class _ShimMCP:
|
| 16 |
+
@staticmethod
|
| 17 |
+
def tool(*args, **kwargs):
|
| 18 |
+
if args and callable(args[0]) and len(args) == 1 and not kwargs:
|
| 19 |
+
return args[0]
|
| 20 |
+
def _decorator(fn):
|
| 21 |
+
return fn
|
| 22 |
+
return _decorator
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _resolve_source_server():
|
| 26 |
+
if LOCAL_SERVER.exists() and LOCAL_SERVER.name != Path(__file__).name:
|
| 27 |
+
return LOCAL_SERVER
|
| 28 |
+
return SOURCE_SERVER
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def _load_functions():
|
| 32 |
+
source_server = _resolve_source_server()
|
| 33 |
+
code = source_server.read_text(encoding="utf-8")
|
| 34 |
+
tree = ast.parse(code, filename=str(source_server))
|
| 35 |
+
function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")]
|
| 36 |
+
namespace = {
|
| 37 |
+
"__name__": "__mcp_source__",
|
| 38 |
+
"mcp": _ShimMCP(),
|
| 39 |
+
}
|
| 40 |
+
exec(compile(code, str(source_server), "exec"), namespace, namespace)
|
| 41 |
+
loaded = []
|
| 42 |
+
for name in function_names:
|
| 43 |
+
fn = namespace.get(name)
|
| 44 |
+
if callable(fn):
|
| 45 |
+
loaded.append(fn)
|
| 46 |
+
return loaded
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
mcp = FastMCP(SERVER_NAME)
|
| 50 |
+
for _fn in _load_functions():
|
| 51 |
+
mcp.tool()(_fn)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/app/requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/docker-compose.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
mcp-ariba:
|
| 5 |
+
build: .
|
| 6 |
+
image: mcp-ariba:latest
|
| 7 |
+
container_name: mcp-ariba
|
| 8 |
+
ports:
|
| 9 |
+
- "8000:8000"
|
| 10 |
+
environment:
|
| 11 |
+
- MCP_SERVER_NAME=ariba
|
| 12 |
+
volumes:
|
| 13 |
+
- ./workspace:/app/workspace
|
| 14 |
+
- ./output:/app/output
|
| 15 |
+
restart: unless-stopped
|
| 16 |
+
healthcheck:
|
| 17 |
+
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
|
| 18 |
+
interval: 30s
|
| 19 |
+
timeout: 10s
|
| 20 |
+
retries: 3
|
| 21 |
+
start_period: 5s
|
| 22 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/environment.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
name: mcp-tool
|
| 3 |
+
channels:
|
| 4 |
+
- bioconda
|
| 5 |
+
- conda-forge
|
| 6 |
+
- defaults
|
| 7 |
+
dependencies:
|
| 8 |
+
- ariba
|
| 9 |
+
- python=3.10
|
| 10 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_ariba/requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastmcp
|
| 2 |
+
mcp
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Install Miniconda
|
| 8 |
+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh
|
| 9 |
+
|
| 10 |
+
# Add conda to PATH
|
| 11 |
+
ENV PATH="/opt/conda/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Install arvados-python-client via conda (e.g., from bioconda)
|
| 14 |
+
RUN conda install -c bioconda arvados-python-client -y && conda clean -a
|
| 15 |
+
|
| 16 |
+
# Install Python dependencies
|
| 17 |
+
RUN pip install uv
|
| 18 |
+
RUN uv pip install --system fastmcp
|
| 19 |
+
|
| 20 |
+
# Create app directory
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
|
| 23 |
+
# Copy your MCP server
|
| 24 |
+
COPY app/arvados-python-client_server.py /app/
|
| 25 |
+
|
| 26 |
+
# Create workspace and output directories
|
| 27 |
+
RUN mkdir -p /app/workspace /app/output
|
| 28 |
+
|
| 29 |
+
# Make sure the server script is executable
|
| 30 |
+
RUN chmod +x /app/arvados-python-client_server.py
|
| 31 |
+
|
| 32 |
+
# Expose port for MCP over HTTP (optional)
|
| 33 |
+
EXPOSE 8000
|
| 34 |
+
|
| 35 |
+
# Health check
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)"
|
| 37 |
+
|
| 38 |
+
# Default command runs the MCP server via stdio
|
| 39 |
+
CMD ["python", "/app/arvados-python-client_server.py"]
|
| 40 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/app/__pycache__/arvados-python-client_shim_server.cpython-311.pyc
ADDED
|
Binary file (3.64 kB). View file
|
|
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/app/arvados-python-client_server.py
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import tempfile
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
from typing import List, Optional
|
| 5 |
+
|
| 6 |
+
# MCP-standardized error handling
|
| 7 |
+
class MCPError(Exception):
|
| 8 |
+
def __init__(self, message, stderr):
|
| 9 |
+
self.message = message
|
| 10 |
+
self.stderr = stderr
|
| 11 |
+
super().__init__(self.message)
|
| 12 |
+
|
| 13 |
+
def _run_command(cmd: List[str]):
|
| 14 |
+
"""Helper function to run a command and handle exceptions."""
|
| 15 |
+
try:
|
| 16 |
+
command_str = " ".join(cmd)
|
| 17 |
+
result = subprocess.run(
|
| 18 |
+
cmd,
|
| 19 |
+
capture_output=True,
|
| 20 |
+
text=True,
|
| 21 |
+
check=True,
|
| 22 |
+
)
|
| 23 |
+
return {
|
| 24 |
+
"command_executed": command_str,
|
| 25 |
+
"stdout": result.stdout,
|
| 26 |
+
"stderr": result.stderr,
|
| 27 |
+
}
|
| 28 |
+
except FileNotFoundError:
|
| 29 |
+
raise MCPError(f"Command '{cmd[0]}' not found. Is arvados-python-client installed and in the PATH?", "")
|
| 30 |
+
except subprocess.CalledProcessError as e:
|
| 31 |
+
raise MCPError(f"Command '{' '.join(cmd)}' failed with exit code {e.returncode}", e.stderr)
|
| 32 |
+
|
| 33 |
+
from mcp.server.fastmcp import FastMCP
|
| 34 |
+
|
| 35 |
+
SERVER_NAME = 'local_arvados_python_client'
|
| 36 |
+
mcp = FastMCP(SERVER_NAME)
|
| 37 |
+
|
| 38 |
+
@mcp.tool()
|
| 39 |
+
def arv_get(
|
| 40 |
+
object_locator: str,
|
| 41 |
+
destination_path: Optional[Path] = None,
|
| 42 |
+
filename: Optional[str] = None,
|
| 43 |
+
force: bool = False,
|
| 44 |
+
recursive: bool = False,
|
| 45 |
+
progress: bool = False,
|
| 46 |
+
) -> dict:
|
| 47 |
+
"""
|
| 48 |
+
Downloads an object from Arvados Keep to a local path or standard output.
|
| 49 |
+
|
| 50 |
+
Args:
|
| 51 |
+
object_locator: The UUID or portable data hash (PDH) of the object to download.
|
| 52 |
+
destination_path: Local path to save the object. If a directory, the original filename is used. If not provided, content is written to stdout.
|
| 53 |
+
filename: The name of the file to get from a collection.
|
| 54 |
+
force: Overwrite existing files if they exist.
|
| 55 |
+
recursive: Recursively download collections.
|
| 56 |
+
progress: Show a progress bar during download.
|
| 57 |
+
|
| 58 |
+
Returns:
|
| 59 |
+
A dictionary containing the command executed, stdout, stderr, and a list of output files.
|
| 60 |
+
"""
|
| 61 |
+
cmd = ["arv-get"]
|
| 62 |
+
|
| 63 |
+
if force:
|
| 64 |
+
cmd.append("--force")
|
| 65 |
+
if recursive:
|
| 66 |
+
cmd.append("--recursive")
|
| 67 |
+
if progress:
|
| 68 |
+
cmd.append("--progress")
|
| 69 |
+
if filename:
|
| 70 |
+
cmd.extend(["--filename", filename])
|
| 71 |
+
|
| 72 |
+
cmd.append(object_locator)
|
| 73 |
+
|
| 74 |
+
output_files = []
|
| 75 |
+
if destination_path:
|
| 76 |
+
# Ensure parent directory exists if a full path is given
|
| 77 |
+
if destination_path.parent and not destination_path.parent.is_dir():
|
| 78 |
+
destination_path.parent.mkdir(parents=True, exist_ok=True)
|
| 79 |
+
cmd.append(str(destination_path))
|
| 80 |
+
output_files.append(str(destination_path))
|
| 81 |
+
|
| 82 |
+
try:
|
| 83 |
+
result = _run_command(cmd)
|
| 84 |
+
result["output_files"] = output_files
|
| 85 |
+
return result
|
| 86 |
+
except MCPError as e:
|
| 87 |
+
return {
|
| 88 |
+
"command_executed": " ".join(cmd),
|
| 89 |
+
"stdout": "",
|
| 90 |
+
"stderr": e.stderr,
|
| 91 |
+
"error": e.message,
|
| 92 |
+
"output_files": [],
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
@mcp.tool()
|
| 96 |
+
def arv_put(
|
| 97 |
+
paths: List[Path],
|
| 98 |
+
name: Optional[str] = None,
|
| 99 |
+
owner: Optional[str] = None,
|
| 100 |
+
portable_data_hash: bool = False,
|
| 101 |
+
storage_class: Optional[str] = None,
|
| 102 |
+
num_retries: int = 5,
|
| 103 |
+
progress: bool = False,
|
| 104 |
+
) -> dict:
|
| 105 |
+
"""
|
| 106 |
+
Uploads local files or directories to Arvados Keep.
|
| 107 |
+
|
| 108 |
+
Args:
|
| 109 |
+
paths: One or more local file or directory paths to upload.
|
| 110 |
+
name: Set the name of the new collection.
|
| 111 |
+
owner: Set the owner project UUID for the new collection.
|
| 112 |
+
portable_data_hash: Use portable data hash to identify the collection.
|
| 113 |
+
storage_class: The storage class for the data (e.g., 'default', 'trash').
|
| 114 |
+
num_retries: Number of times to retry a failed API call.
|
| 115 |
+
progress: Show a progress bar during upload.
|
| 116 |
+
|
| 117 |
+
Returns:
|
| 118 |
+
A dictionary containing the command executed, stdout, and stderr.
|
| 119 |
+
"""
|
| 120 |
+
if not paths:
|
| 121 |
+
raise ValueError("At least one path must be provided for upload.")
|
| 122 |
+
|
| 123 |
+
for p in paths:
|
| 124 |
+
if not p.exists():
|
| 125 |
+
raise FileNotFoundError(f"Input path does not exist: {p}")
|
| 126 |
+
|
| 127 |
+
cmd = ["arv-put"]
|
| 128 |
+
|
| 129 |
+
if name:
|
| 130 |
+
cmd.extend(["--name", name])
|
| 131 |
+
if owner:
|
| 132 |
+
cmd.extend(["--owner", owner])
|
| 133 |
+
if portable_data_hash:
|
| 134 |
+
cmd.append("--portable-data-hash")
|
| 135 |
+
if storage_class:
|
| 136 |
+
cmd.extend(["--storage-class", storage_class])
|
| 137 |
+
if progress:
|
| 138 |
+
cmd.append("--progress")
|
| 139 |
+
|
| 140 |
+
# num_retries is a standard arvados client option
|
| 141 |
+
cmd.extend(["--num-retries", str(num_retries)])
|
| 142 |
+
|
| 143 |
+
cmd.extend([str(p) for p in paths])
|
| 144 |
+
|
| 145 |
+
try:
|
| 146 |
+
result = _run_command(cmd)
|
| 147 |
+
result["output_files"] = []
|
| 148 |
+
return result
|
| 149 |
+
except MCPError as e:
|
| 150 |
+
return {
|
| 151 |
+
"command_executed": " ".join(cmd),
|
| 152 |
+
"stdout": "",
|
| 153 |
+
"stderr": e.stderr,
|
| 154 |
+
"error": e.message,
|
| 155 |
+
"output_files": [],
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
@mcp.tool()
|
| 159 |
+
def arv_ls(
|
| 160 |
+
object_locator: str,
|
| 161 |
+
path: Optional[str] = None,
|
| 162 |
+
long_format: bool = False,
|
| 163 |
+
recursive: bool = False,
|
| 164 |
+
human_readable: bool = False,
|
| 165 |
+
) -> dict:
|
| 166 |
+
"""
|
| 167 |
+
Lists the contents of a collection in Arvados Keep.
|
| 168 |
+
|
| 169 |
+
Args:
|
| 170 |
+
object_locator: The UUID or portable data hash (PDH) of the collection to list.
|
| 171 |
+
path: A path within the collection to list.
|
| 172 |
+
long_format: Use a long listing format (similar to ls -l).
|
| 173 |
+
recursive: List subdirectories recursively.
|
| 174 |
+
human_readable: With long_format, print sizes in human-readable format (e.g., 1K, 234M, 2G).
|
| 175 |
+
|
| 176 |
+
Returns:
|
| 177 |
+
A dictionary containing the command executed, stdout (the listing), and stderr.
|
| 178 |
+
"""
|
| 179 |
+
cmd = ["arv-ls"]
|
| 180 |
+
|
| 181 |
+
if long_format:
|
| 182 |
+
cmd.append("-l")
|
| 183 |
+
if recursive:
|
| 184 |
+
cmd.append("-R")
|
| 185 |
+
if human_readable:
|
| 186 |
+
cmd.append("-h")
|
| 187 |
+
|
| 188 |
+
cmd.append(object_locator)
|
| 189 |
+
if path:
|
| 190 |
+
cmd.append(path)
|
| 191 |
+
|
| 192 |
+
try:
|
| 193 |
+
result = _run_command(cmd)
|
| 194 |
+
result["output_files"] = []
|
| 195 |
+
return result
|
| 196 |
+
except MCPError as e:
|
| 197 |
+
return {
|
| 198 |
+
"command_executed": " ".join(cmd),
|
| 199 |
+
"stdout": "",
|
| 200 |
+
"stderr": e.stderr,
|
| 201 |
+
"error": e.message,
|
| 202 |
+
"output_files": [],
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
@mcp.tool()
|
| 206 |
+
def arv_copy(
|
| 207 |
+
src_locators: List[str],
|
| 208 |
+
dest_project_uuid: str,
|
| 209 |
+
name: Optional[str] = None,
|
| 210 |
+
num_retries: int = 5,
|
| 211 |
+
) -> dict:
|
| 212 |
+
"""
|
| 213 |
+
Copies one or more objects to a destination project in Arvados.
|
| 214 |
+
|
| 215 |
+
Args:
|
| 216 |
+
src_locators: A list of source object UUIDs or portable data hashes (PDHs).
|
| 217 |
+
dest_project_uuid: The UUID of the destination project.
|
| 218 |
+
name: New name for the object(s). If copying multiple objects, this is ignored.
|
| 219 |
+
num_retries: Number of times to retry a failed API call.
|
| 220 |
+
|
| 221 |
+
Returns:
|
| 222 |
+
A dictionary containing the command executed, stdout, and stderr.
|
| 223 |
+
"""
|
| 224 |
+
if not src_locators:
|
| 225 |
+
raise ValueError("At least one source locator must be provided.")
|
| 226 |
+
if not dest_project_uuid:
|
| 227 |
+
raise ValueError("A destination project UUID must be provided.")
|
| 228 |
+
|
| 229 |
+
cmd = ["arv-copy"]
|
| 230 |
+
|
| 231 |
+
if name and len(src_locators) == 1:
|
| 232 |
+
cmd.extend(["--name", name])
|
| 233 |
+
|
| 234 |
+
cmd.extend(["--num-retries", str(num_retries)])
|
| 235 |
+
|
| 236 |
+
cmd.extend(src_locators)
|
| 237 |
+
cmd.append(dest_project_uuid)
|
| 238 |
+
|
| 239 |
+
try:
|
| 240 |
+
result = _run_command(cmd)
|
| 241 |
+
result["output_files"] = []
|
| 242 |
+
return result
|
| 243 |
+
except MCPError as e:
|
| 244 |
+
return {
|
| 245 |
+
"command_executed": " ".join(cmd),
|
| 246 |
+
"stdout": "",
|
| 247 |
+
"stderr": e.stderr,
|
| 248 |
+
"error": e.message,
|
| 249 |
+
"output_files": [],
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
@mcp.tool()
|
| 253 |
+
def arv_tag(
|
| 254 |
+
locator: str,
|
| 255 |
+
tags_to_add: Optional[List[str]] = None,
|
| 256 |
+
keys_to_remove: Optional[List[str]] = None,
|
| 257 |
+
list_tags: bool = False,
|
| 258 |
+
num_retries: int = 5,
|
| 259 |
+
) -> dict:
|
| 260 |
+
"""
|
| 261 |
+
Manipulates tags on an Arvados object. It can list, add, or remove tags.
|
| 262 |
+
|
| 263 |
+
Args:
|
| 264 |
+
locator: The UUID or portable data hash (PDH) of the object to tag.
|
| 265 |
+
tags_to_add: A list of tags to add, in 'key' or 'key=value' format.
|
| 266 |
+
keys_to_remove: A list of tag keys to remove.
|
| 267 |
+
list_tags: If True, lists the existing tags on the object.
|
| 268 |
+
num_retries: Number of times to retry a failed API call.
|
| 269 |
+
|
| 270 |
+
Returns:
|
| 271 |
+
A dictionary containing the command executed, stdout, and stderr.
|
| 272 |
+
"""
|
| 273 |
+
cmd = ["arv-tag"]
|
| 274 |
+
|
| 275 |
+
cmd.extend(["--num-retries", str(num_retries)])
|
| 276 |
+
|
| 277 |
+
if list_tags:
|
| 278 |
+
cmd.append("--list")
|
| 279 |
+
|
| 280 |
+
cmd.append(locator)
|
| 281 |
+
|
| 282 |
+
if tags_to_add:
|
| 283 |
+
for tag in tags_to_add:
|
| 284 |
+
if "=" not in tag and " " in tag:
|
| 285 |
+
raise ValueError(f"Invalid tag format: '{tag}'. Use 'key=value' or 'key'.")
|
| 286 |
+
cmd.extend(tags_to_add)
|
| 287 |
+
|
| 288 |
+
if keys_to_remove:
|
| 289 |
+
for key in keys_to_remove:
|
| 290 |
+
cmd.extend(["--remove", key])
|
| 291 |
+
|
| 292 |
+
try:
|
| 293 |
+
result = _run_command(cmd)
|
| 294 |
+
result["output_files"] = []
|
| 295 |
+
return result
|
| 296 |
+
except MCPError as e:
|
| 297 |
+
return {
|
| 298 |
+
"command_executed": " ".join(cmd),
|
| 299 |
+
"stdout": "",
|
| 300 |
+
"stderr": e.stderr,
|
| 301 |
+
"error": e.message,
|
| 302 |
+
"output_files": [],
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
if __name__ == "__main__":
|
| 306 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/app/arvados-python-client_shim_server.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import ast
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
from mcp.server.fastmcp import FastMCP
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_arvados-python-client/app/arvados-python-client_server.py')
|
| 11 |
+
LOCAL_SERVER = Path(__file__).with_name(SOURCE_SERVER.name)
|
| 12 |
+
SERVER_NAME = 'biosci_arvados_python_client'
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class _ShimMCP:
|
| 16 |
+
@staticmethod
|
| 17 |
+
def tool(*args, **kwargs):
|
| 18 |
+
if args and callable(args[0]) and len(args) == 1 and not kwargs:
|
| 19 |
+
return args[0]
|
| 20 |
+
def _decorator(fn):
|
| 21 |
+
return fn
|
| 22 |
+
return _decorator
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _resolve_source_server():
|
| 26 |
+
if LOCAL_SERVER.exists() and LOCAL_SERVER.name != Path(__file__).name:
|
| 27 |
+
return LOCAL_SERVER
|
| 28 |
+
return SOURCE_SERVER
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def _load_functions():
|
| 32 |
+
source_server = _resolve_source_server()
|
| 33 |
+
code = source_server.read_text(encoding="utf-8")
|
| 34 |
+
tree = ast.parse(code, filename=str(source_server))
|
| 35 |
+
function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")]
|
| 36 |
+
namespace = {
|
| 37 |
+
"__name__": "__mcp_source__",
|
| 38 |
+
"mcp": _ShimMCP(),
|
| 39 |
+
}
|
| 40 |
+
exec(compile(code, str(source_server), "exec"), namespace, namespace)
|
| 41 |
+
loaded = []
|
| 42 |
+
for name in function_names:
|
| 43 |
+
fn = namespace.get(name)
|
| 44 |
+
if callable(fn):
|
| 45 |
+
loaded.append(fn)
|
| 46 |
+
return loaded
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
mcp = FastMCP(SERVER_NAME)
|
| 50 |
+
for _fn in _load_functions():
|
| 51 |
+
mcp.tool()(_fn)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/app/requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/docker-compose.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
mcp-arvados-python-client:
|
| 5 |
+
build: .
|
| 6 |
+
image: mcp-arvados-python-client:latest
|
| 7 |
+
container_name: mcp-arvados-python-client
|
| 8 |
+
ports:
|
| 9 |
+
- "8000:8000"
|
| 10 |
+
environment:
|
| 11 |
+
- MCP_SERVER_NAME=arvados-python-client
|
| 12 |
+
volumes:
|
| 13 |
+
- ./workspace:/app/workspace
|
| 14 |
+
- ./output:/app/output
|
| 15 |
+
restart: unless-stopped
|
| 16 |
+
healthcheck:
|
| 17 |
+
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
|
| 18 |
+
interval: 30s
|
| 19 |
+
timeout: 10s
|
| 20 |
+
retries: 3
|
| 21 |
+
start_period: 5s
|
| 22 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/environment.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
name: mcp-tool
|
| 3 |
+
channels:
|
| 4 |
+
- bioconda
|
| 5 |
+
- conda-forge
|
| 6 |
+
- defaults
|
| 7 |
+
dependencies:
|
| 8 |
+
- arvados-python-client
|
| 9 |
+
- python=3.10
|
| 10 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_arvados-python-client/requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastmcp
|
| 2 |
+
mcp
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Install Miniconda
|
| 8 |
+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh
|
| 9 |
+
|
| 10 |
+
# Add conda to PATH
|
| 11 |
+
ENV PATH="/opt/conda/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Install bcbio-gff via conda (e.g., from bioconda)
|
| 14 |
+
RUN conda install -c bioconda bcbio-gff -y && conda clean -a
|
| 15 |
+
|
| 16 |
+
# Install Python dependencies
|
| 17 |
+
RUN pip install uv
|
| 18 |
+
RUN uv pip install --system fastmcp
|
| 19 |
+
|
| 20 |
+
# Create app directory
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
|
| 23 |
+
# Copy your MCP server
|
| 24 |
+
COPY app/bcbio-gff_server.py /app/
|
| 25 |
+
|
| 26 |
+
# Create workspace and output directories
|
| 27 |
+
RUN mkdir -p /app/workspace /app/output
|
| 28 |
+
|
| 29 |
+
# Make sure the server script is executable
|
| 30 |
+
RUN chmod +x /app/bcbio-gff_server.py
|
| 31 |
+
|
| 32 |
+
# Expose port for MCP over HTTP (optional)
|
| 33 |
+
EXPOSE 8000
|
| 34 |
+
|
| 35 |
+
# Health check
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)"
|
| 37 |
+
|
| 38 |
+
# Default command runs the MCP server via stdio
|
| 39 |
+
CMD ["python", "/app/bcbio-gff_server.py"]
|
| 40 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/app/__pycache__/bcbio-gff_shim_server.cpython-311.pyc
ADDED
|
Binary file (3.58 kB). View file
|
|
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/app/bcbio-gff_server.py
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import tempfile
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
from typing import List, Dict
|
| 5 |
+
|
| 6 |
+
# Note: The 'bcbio-gff' package is primarily a Python library. It also
|
| 7 |
+
# installs several command-line utility scripts. The documentation provided
|
| 8 |
+
# did not include the '--help' output for these scripts. The following MCP
|
| 9 |
+
# tools are based on inferred, common-sense arguments for these utilities.
|
| 10 |
+
# The actual command-line interface may differ.
|
| 11 |
+
|
| 12 |
+
from mcp.server.fastmcp import FastMCP
|
| 13 |
+
|
| 14 |
+
SERVER_NAME = 'local_bcbio_gff'
|
| 15 |
+
mcp = FastMCP(SERVER_NAME)
|
| 16 |
+
|
| 17 |
+
@mcp.tool()
|
| 18 |
+
def gff_to_bed(
|
| 19 |
+
gff_file: Path
|
| 20 |
+
) -> Dict:
|
| 21 |
+
"""
|
| 22 |
+
Converts a GFF file to a BED file using `gff_to_bed.py`.
|
| 23 |
+
|
| 24 |
+
This tool assumes the script takes a single GFF file as input and prints
|
| 25 |
+
the resulting BED formatted data to standard output.
|
| 26 |
+
"""
|
| 27 |
+
if not gff_file.is_file():
|
| 28 |
+
raise FileNotFoundError(f"Input GFF file not found: {gff_file}")
|
| 29 |
+
|
| 30 |
+
cmd = ["gff_to_bed.py", str(gff_file)]
|
| 31 |
+
|
| 32 |
+
try:
|
| 33 |
+
result = subprocess.run(
|
| 34 |
+
cmd,
|
| 35 |
+
capture_output=True,
|
| 36 |
+
text=True,
|
| 37 |
+
check=True
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
with tempfile.NamedTemporaryFile(
|
| 41 |
+
mode="w", delete=False, suffix=".bed", prefix="output_"
|
| 42 |
+
) as tmp_out:
|
| 43 |
+
tmp_out.write(result.stdout)
|
| 44 |
+
output_path = tmp_out.name
|
| 45 |
+
|
| 46 |
+
return {
|
| 47 |
+
"command_executed": " ".join(cmd),
|
| 48 |
+
"stdout": result.stdout,
|
| 49 |
+
"stderr": result.stderr,
|
| 50 |
+
"output_files": [output_path]
|
| 51 |
+
}
|
| 52 |
+
except FileNotFoundError:
|
| 53 |
+
raise RuntimeError("gff_to_bed.py not found. Ensure bcbio-gff scripts are in your PATH.")
|
| 54 |
+
except subprocess.CalledProcessError as e:
|
| 55 |
+
return {
|
| 56 |
+
"command_executed": " ".join(e.cmd),
|
| 57 |
+
"stdout": e.stdout,
|
| 58 |
+
"stderr": e.stderr,
|
| 59 |
+
"output_files": [],
|
| 60 |
+
"error": "Tool execution failed."
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
@mcp.tool()
|
| 64 |
+
def gff_filter_by_attribute(
|
| 65 |
+
gff_file: Path,
|
| 66 |
+
attribute_key: str,
|
| 67 |
+
attribute_value: str
|
| 68 |
+
) -> Dict:
|
| 69 |
+
"""
|
| 70 |
+
Filters a GFF file by a given attribute key-value pair using `gff_filter_by_attribute.py`.
|
| 71 |
+
|
| 72 |
+
This tool assumes the script takes an attribute key, an attribute value, and an
|
| 73 |
+
input GFF file as arguments, and prints the filtered GFF to standard output.
|
| 74 |
+
"""
|
| 75 |
+
if not gff_file.is_file():
|
| 76 |
+
raise FileNotFoundError(f"Input GFF file not found: {gff_file}")
|
| 77 |
+
|
| 78 |
+
cmd = ["gff_filter_by_attribute.py", attribute_key, attribute_value, str(gff_file)]
|
| 79 |
+
|
| 80 |
+
try:
|
| 81 |
+
result = subprocess.run(
|
| 82 |
+
cmd,
|
| 83 |
+
capture_output=True,
|
| 84 |
+
text=True,
|
| 85 |
+
check=True
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
with tempfile.NamedTemporaryFile(
|
| 89 |
+
mode="w", delete=False, suffix=".gff", prefix="filtered_"
|
| 90 |
+
) as tmp_out:
|
| 91 |
+
tmp_out.write(result.stdout)
|
| 92 |
+
output_path = tmp_out.name
|
| 93 |
+
|
| 94 |
+
return {
|
| 95 |
+
"command_executed": " ".join(cmd),
|
| 96 |
+
"stdout": result.stdout,
|
| 97 |
+
"stderr": result.stderr,
|
| 98 |
+
"output_files": [output_path]
|
| 99 |
+
}
|
| 100 |
+
except FileNotFoundError:
|
| 101 |
+
raise RuntimeError("gff_filter_by_attribute.py not found. Ensure bcbio-gff scripts are in your PATH.")
|
| 102 |
+
except subprocess.CalledProcessError as e:
|
| 103 |
+
return {
|
| 104 |
+
"command_executed": " ".join(e.cmd),
|
| 105 |
+
"stdout": e.stdout,
|
| 106 |
+
"stderr": e.stderr,
|
| 107 |
+
"output_files": [],
|
| 108 |
+
"error": "Tool execution failed."
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
@mcp.tool()
|
| 112 |
+
def gff_filter_by_type(
|
| 113 |
+
gff_file: Path,
|
| 114 |
+
feature_type: str
|
| 115 |
+
) -> Dict:
|
| 116 |
+
"""
|
| 117 |
+
Filters a GFF file by a feature type (e.g., 'gene', 'mRNA') using `gff_filter_by_type.py`.
|
| 118 |
+
|
| 119 |
+
This tool assumes the script takes an input GFF file and a feature type as
|
| 120 |
+
arguments, and prints the filtered GFF to standard output.
|
| 121 |
+
"""
|
| 122 |
+
if not gff_file.is_file():
|
| 123 |
+
raise FileNotFoundError(f"Input GFF file not found: {gff_file}")
|
| 124 |
+
|
| 125 |
+
cmd = ["gff_filter_by_type.py", str(gff_file), feature_type]
|
| 126 |
+
|
| 127 |
+
try:
|
| 128 |
+
result = subprocess.run(
|
| 129 |
+
cmd,
|
| 130 |
+
capture_output=True,
|
| 131 |
+
text=True,
|
| 132 |
+
check=True
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
with tempfile.NamedTemporaryFile(
|
| 136 |
+
mode="w", delete=False, suffix=".gff", prefix="filtered_type_"
|
| 137 |
+
) as tmp_out:
|
| 138 |
+
tmp_out.write(result.stdout)
|
| 139 |
+
output_path = tmp_out.name
|
| 140 |
+
|
| 141 |
+
return {
|
| 142 |
+
"command_executed": " ".join(cmd),
|
| 143 |
+
"stdout": result.stdout,
|
| 144 |
+
"stderr": result.stderr,
|
| 145 |
+
"output_files": [output_path]
|
| 146 |
+
}
|
| 147 |
+
except FileNotFoundError:
|
| 148 |
+
raise RuntimeError("gff_filter_by_type.py not found. Ensure bcbio-gff scripts are in your PATH.")
|
| 149 |
+
except subprocess.CalledProcessError as e:
|
| 150 |
+
return {
|
| 151 |
+
"command_executed": " ".join(e.cmd),
|
| 152 |
+
"stdout": e.stdout,
|
| 153 |
+
"stderr": e.stderr,
|
| 154 |
+
"output_files": [],
|
| 155 |
+
"error": "Tool execution failed."
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
@mcp.tool()
|
| 159 |
+
def gff_stats(
|
| 160 |
+
gff_file: Path
|
| 161 |
+
) -> Dict:
|
| 162 |
+
"""
|
| 163 |
+
Calculates statistics on features in a GFF file using `gff_stats.py`.
|
| 164 |
+
|
| 165 |
+
This tool assumes the script takes a single GFF file as input and prints
|
| 166 |
+
statistics to standard output.
|
| 167 |
+
"""
|
| 168 |
+
if not gff_file.is_file():
|
| 169 |
+
raise FileNotFoundError(f"Input GFF file not found: {gff_file}")
|
| 170 |
+
|
| 171 |
+
cmd = ["gff_stats.py", str(gff_file)]
|
| 172 |
+
|
| 173 |
+
try:
|
| 174 |
+
result = subprocess.run(
|
| 175 |
+
cmd,
|
| 176 |
+
capture_output=True,
|
| 177 |
+
text=True,
|
| 178 |
+
check=True
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
# The output is statistics text, not a structured file, so we return it directly.
|
| 182 |
+
return {
|
| 183 |
+
"command_executed": " ".join(cmd),
|
| 184 |
+
"stdout": result.stdout,
|
| 185 |
+
"stderr": result.stderr,
|
| 186 |
+
"output_files": []
|
| 187 |
+
}
|
| 188 |
+
except FileNotFoundError:
|
| 189 |
+
raise RuntimeError("gff_stats.py not found. Ensure bcbio-gff scripts are in your PATH.")
|
| 190 |
+
except subprocess.CalledProcessError as e:
|
| 191 |
+
return {
|
| 192 |
+
"command_executed": " ".join(e.cmd),
|
| 193 |
+
"stdout": e.stdout,
|
| 194 |
+
"stderr": e.stderr,
|
| 195 |
+
"output_files": [],
|
| 196 |
+
"error": "Tool execution failed."
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
if __name__ == "__main__":
|
| 200 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/app/bcbio-gff_shim_server.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import ast
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
from mcp.server.fastmcp import FastMCP
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bcbio-gff/app/bcbio-gff_server.py')
|
| 11 |
+
LOCAL_SERVER = Path(__file__).with_name(SOURCE_SERVER.name)
|
| 12 |
+
SERVER_NAME = 'biosci_bcbio_gff'
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class _ShimMCP:
|
| 16 |
+
@staticmethod
|
| 17 |
+
def tool(*args, **kwargs):
|
| 18 |
+
if args and callable(args[0]) and len(args) == 1 and not kwargs:
|
| 19 |
+
return args[0]
|
| 20 |
+
def _decorator(fn):
|
| 21 |
+
return fn
|
| 22 |
+
return _decorator
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _resolve_source_server():
|
| 26 |
+
if LOCAL_SERVER.exists() and LOCAL_SERVER.name != Path(__file__).name:
|
| 27 |
+
return LOCAL_SERVER
|
| 28 |
+
return SOURCE_SERVER
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def _load_functions():
|
| 32 |
+
source_server = _resolve_source_server()
|
| 33 |
+
code = source_server.read_text(encoding="utf-8")
|
| 34 |
+
tree = ast.parse(code, filename=str(source_server))
|
| 35 |
+
function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")]
|
| 36 |
+
namespace = {
|
| 37 |
+
"__name__": "__mcp_source__",
|
| 38 |
+
"mcp": _ShimMCP(),
|
| 39 |
+
}
|
| 40 |
+
exec(compile(code, str(source_server), "exec"), namespace, namespace)
|
| 41 |
+
loaded = []
|
| 42 |
+
for name in function_names:
|
| 43 |
+
fn = namespace.get(name)
|
| 44 |
+
if callable(fn):
|
| 45 |
+
loaded.append(fn)
|
| 46 |
+
return loaded
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
mcp = FastMCP(SERVER_NAME)
|
| 50 |
+
for _fn in _load_functions():
|
| 51 |
+
mcp.tool()(_fn)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/app/requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/docker-compose.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
mcp-bcbio-gff:
|
| 5 |
+
build: .
|
| 6 |
+
image: mcp-bcbio-gff:latest
|
| 7 |
+
container_name: mcp-bcbio-gff
|
| 8 |
+
ports:
|
| 9 |
+
- "8000:8000"
|
| 10 |
+
environment:
|
| 11 |
+
- MCP_SERVER_NAME=bcbio-gff
|
| 12 |
+
volumes:
|
| 13 |
+
- ./workspace:/app/workspace
|
| 14 |
+
- ./output:/app/output
|
| 15 |
+
restart: unless-stopped
|
| 16 |
+
healthcheck:
|
| 17 |
+
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
|
| 18 |
+
interval: 30s
|
| 19 |
+
timeout: 10s
|
| 20 |
+
retries: 3
|
| 21 |
+
start_period: 5s
|
| 22 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/environment.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
name: mcp-tool
|
| 3 |
+
channels:
|
| 4 |
+
- bioconda
|
| 5 |
+
- conda-forge
|
| 6 |
+
- defaults
|
| 7 |
+
dependencies:
|
| 8 |
+
- bcbio-gff
|
| 9 |
+
- python=3.10
|
| 10 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bcbio-gff/requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastmcp
|
| 2 |
+
mcp
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Install Miniconda
|
| 8 |
+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh
|
| 9 |
+
|
| 10 |
+
# Add conda to PATH
|
| 11 |
+
ENV PATH="/opt/conda/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Install bioconductor-alabaster.sfe via conda (e.g., from bioconda)
|
| 14 |
+
RUN conda install -c bioconda bioconductor-alabaster.sfe -y && conda clean -a
|
| 15 |
+
|
| 16 |
+
# Install Python dependencies
|
| 17 |
+
RUN pip install uv
|
| 18 |
+
RUN uv pip install --system fastmcp
|
| 19 |
+
|
| 20 |
+
# Create app directory
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
|
| 23 |
+
# Copy your MCP server
|
| 24 |
+
COPY app/bioconductor-alabaster.sfe_server.py /app/
|
| 25 |
+
|
| 26 |
+
# Create workspace and output directories
|
| 27 |
+
RUN mkdir -p /app/workspace /app/output
|
| 28 |
+
|
| 29 |
+
# Make sure the server script is executable
|
| 30 |
+
RUN chmod +x /app/bioconductor-alabaster.sfe_server.py
|
| 31 |
+
|
| 32 |
+
# Expose port for MCP over HTTP (optional)
|
| 33 |
+
EXPOSE 8000
|
| 34 |
+
|
| 35 |
+
# Health check
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)"
|
| 37 |
+
|
| 38 |
+
# Default command runs the MCP server via stdio
|
| 39 |
+
CMD ["python", "/app/bioconductor-alabaster.sfe_server.py"]
|
| 40 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/app/__pycache__/bioconductor-alabaster.sfe_shim_server.cpython-311.pyc
ADDED
|
Binary file (3.66 kB). View file
|
|
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/app/bioconductor-alabaster.sfe_server.py
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import logging
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
from typing import Dict, Any, Optional
|
| 5 |
+
|
| 6 |
+
# It is assumed that the mcp decorator is available in the execution environment.
|
| 7 |
+
# from mcp import tool
|
| 8 |
+
|
| 9 |
+
# Mock decorator for local testing, not to be included in the final deliverable
|
| 10 |
+
# if 'mcp' not in globals():
|
| 11 |
+
# class mcp:
|
| 12 |
+
# @staticmethod
|
| 13 |
+
# def tool():
|
| 14 |
+
# def decorator(func):
|
| 15 |
+
# return func
|
| 16 |
+
# return decorator
|
| 17 |
+
|
| 18 |
+
logger = logging.getLogger(__name__)
|
| 19 |
+
|
| 20 |
+
from mcp.server.fastmcp import FastMCP
|
| 21 |
+
|
| 22 |
+
SERVER_NAME = 'local_bioconductor_alabaster_sfe'
|
| 23 |
+
mcp = FastMCP(SERVER_NAME)
|
| 24 |
+
|
| 25 |
+
@mcp.tool()
|
| 26 |
+
def stage_sfe_object(
|
| 27 |
+
input_rds: Path,
|
| 28 |
+
output_dir: Path,
|
| 29 |
+
path: str = "sfe",
|
| 30 |
+
) -> Dict[str, Any]:
|
| 31 |
+
"""
|
| 32 |
+
Stages a SpatialFeatureExperiment (SFE) object from an RDS file into the alabaster format.
|
| 33 |
+
|
| 34 |
+
This tool wraps the 'stageObject' function from the R package 'alabaster.sfe'.
|
| 35 |
+
It reads an SFE object from a specified RDS file and saves it into a structured
|
| 36 |
+
directory according to the alabaster specification. This serves as the primary
|
| 37 |
+
"save" or "serialize" function for SFE objects in the alabaster framework.
|
| 38 |
+
|
| 39 |
+
Args:
|
| 40 |
+
input_rds: Path to the input RDS file containing the SpatialFeatureExperiment object.
|
| 41 |
+
output_dir: Path to the directory where the staged object assets will be stored.
|
| 42 |
+
path: The relative path within 'output_dir' to save the object. Defaults to "sfe".
|
| 43 |
+
|
| 44 |
+
Returns:
|
| 45 |
+
A dictionary containing the execution details and the path to the main output metadata file.
|
| 46 |
+
"""
|
| 47 |
+
# 1. Input Validation
|
| 48 |
+
if not input_rds.is_file():
|
| 49 |
+
raise FileNotFoundError(f"Input RDS file not found at: {input_rds}")
|
| 50 |
+
|
| 51 |
+
if not path:
|
| 52 |
+
raise ValueError("'path' cannot be an empty string.")
|
| 53 |
+
|
| 54 |
+
try:
|
| 55 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 56 |
+
except OSError as e:
|
| 57 |
+
raise OSError(f"Failed to create output directory {output_dir}: {e}")
|
| 58 |
+
|
| 59 |
+
# 2. R script construction
|
| 60 |
+
r_script_content = f"""
|
| 61 |
+
suppressPackageStartupMessages(library(alabaster.sfe))
|
| 62 |
+
suppressPackageStartupMessages(library(SpatialFeatureExperiment))
|
| 63 |
+
|
| 64 |
+
tryCatch({{
|
| 65 |
+
sfe_object <- readRDS('{input_rds.resolve()}')
|
| 66 |
+
info <- alabaster.base::stageObject(sfe_object, dir = '{output_dir.resolve()}', path = '{path}')
|
| 67 |
+
cat(file.path('{output_dir.resolve()}', info$path, "object.json"))
|
| 68 |
+
}}, error = function(e) {{
|
| 69 |
+
message("Error during R script execution: ", e$message)
|
| 70 |
+
quit(status = 1)
|
| 71 |
+
}})
|
| 72 |
+
"""
|
| 73 |
+
|
| 74 |
+
# 3. Subprocess Execution
|
| 75 |
+
cmd = ["Rscript", "-e", r_script_content]
|
| 76 |
+
command_executed = " ".join(map(str, cmd))
|
| 77 |
+
logger.info(f"Executing command: {command_executed}")
|
| 78 |
+
|
| 79 |
+
try:
|
| 80 |
+
process = subprocess.run(
|
| 81 |
+
cmd,
|
| 82 |
+
check=True,
|
| 83 |
+
capture_output=True,
|
| 84 |
+
text=True,
|
| 85 |
+
encoding='utf-8'
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
stdout = process.stdout.strip()
|
| 89 |
+
stderr = process.stderr.strip()
|
| 90 |
+
|
| 91 |
+
main_output_file = Path(stdout)
|
| 92 |
+
if not main_output_file.is_file():
|
| 93 |
+
raise FileNotFoundError(
|
| 94 |
+
f"Expected output file not created: {main_output_file}. R stderr: {stderr}"
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"command_executed": command_executed,
|
| 99 |
+
"stdout": stdout,
|
| 100 |
+
"stderr": stderr,
|
| 101 |
+
"output_files": {
|
| 102 |
+
"staged_object_json": str(main_output_file)
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
except FileNotFoundError:
|
| 107 |
+
error_msg = "Error: 'Rscript' command not found. Please ensure R is installed and in your system's PATH."
|
| 108 |
+
logger.error(error_msg)
|
| 109 |
+
raise RuntimeError(error_msg) from None
|
| 110 |
+
except subprocess.CalledProcessError as e:
|
| 111 |
+
logger.error(f"Command failed with exit code {e.returncode}")
|
| 112 |
+
logger.error(f"STDOUT: {e.stdout}")
|
| 113 |
+
logger.error(f"STDERR: {e.stderr}")
|
| 114 |
+
raise RuntimeError(
|
| 115 |
+
f"R script execution failed with exit code {e.returncode}.\n"
|
| 116 |
+
f"STDOUT: {e.stdout}\n"
|
| 117 |
+
f"STDERR: {e.stderr}"
|
| 118 |
+
) from e
|
| 119 |
+
|
| 120 |
+
@mcp.tool()
|
| 121 |
+
def load_sfe_object(
|
| 122 |
+
staged_dir: Path,
|
| 123 |
+
output_rds: Path,
|
| 124 |
+
path: str = "",
|
| 125 |
+
) -> Dict[str, Any]:
|
| 126 |
+
"""
|
| 127 |
+
Loads a SpatialFeatureExperiment (SFE) object from the alabaster format into an RDS file.
|
| 128 |
+
|
| 129 |
+
This tool wraps the 'loadObject' function from the R package 'alabaster.base'.
|
| 130 |
+
It reads an SFE object from a staged directory, reconstructs it in memory, and
|
| 131 |
+
saves the complete object as a single RDS file. This is the "load" or "deserialize"
|
| 132 |
+
counterpart to the staging function.
|
| 133 |
+
|
| 134 |
+
Args:
|
| 135 |
+
staged_dir: Path to the directory containing the staged object assets.
|
| 136 |
+
output_rds: Path for the output RDS file where the loaded SFE object will be saved.
|
| 137 |
+
path: The relative path within 'staged_dir' where the object's 'object.json' is located.
|
| 138 |
+
If empty, it's assumed to be at the root of 'staged_dir'.
|
| 139 |
+
|
| 140 |
+
Returns:
|
| 141 |
+
A dictionary containing the execution details and the path to the output RDS file.
|
| 142 |
+
"""
|
| 143 |
+
# 1. Input Validation
|
| 144 |
+
if not staged_dir.is_dir():
|
| 145 |
+
raise NotADirectoryError(f"Staged asset directory not found at: {staged_dir}")
|
| 146 |
+
|
| 147 |
+
metadata_json_path = staged_dir.joinpath(path, "object.json")
|
| 148 |
+
if not metadata_json_path.is_file():
|
| 149 |
+
raise FileNotFoundError(f"Metadata file 'object.json' not found at: {metadata_json_path}")
|
| 150 |
+
|
| 151 |
+
try:
|
| 152 |
+
output_rds.parent.mkdir(parents=True, exist_ok=True)
|
| 153 |
+
except OSError as e:
|
| 154 |
+
raise OSError(f"Failed to create output directory {output_rds.parent}: {e}")
|
| 155 |
+
|
| 156 |
+
# 2. R script construction
|
| 157 |
+
r_script_content = f"""
|
| 158 |
+
suppressPackageStartupMessages(library(alabaster.sfe))
|
| 159 |
+
suppressPackageStartupMessages(library(SpatialFeatureExperiment))
|
| 160 |
+
|
| 161 |
+
tryCatch({{
|
| 162 |
+
sfe_object <- alabaster.base::loadObject(
|
| 163 |
+
'{metadata_json_path.resolve()}',
|
| 164 |
+
project = '{staged_dir.resolve()}'
|
| 165 |
+
)
|
| 166 |
+
saveRDS(sfe_object, file = '{output_rds.resolve()}')
|
| 167 |
+
cat('{output_rds.resolve()}')
|
| 168 |
+
}}, error = function(e) {{
|
| 169 |
+
message("Error during R script execution: ", e$message)
|
| 170 |
+
quit(status = 1)
|
| 171 |
+
}})
|
| 172 |
+
"""
|
| 173 |
+
|
| 174 |
+
# 3. Subprocess Execution
|
| 175 |
+
cmd = ["Rscript", "-e", r_script_content]
|
| 176 |
+
command_executed = " ".join(map(str, cmd))
|
| 177 |
+
logger.info(f"Executing command: {command_executed}")
|
| 178 |
+
|
| 179 |
+
try:
|
| 180 |
+
process = subprocess.run(
|
| 181 |
+
cmd,
|
| 182 |
+
check=True,
|
| 183 |
+
capture_output=True,
|
| 184 |
+
text=True,
|
| 185 |
+
encoding='utf-8'
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
stdout = process.stdout.strip()
|
| 189 |
+
stderr = process.stderr.strip()
|
| 190 |
+
|
| 191 |
+
output_file = Path(stdout)
|
| 192 |
+
if not output_file.is_file() or output_file != output_rds.resolve():
|
| 193 |
+
raise FileNotFoundError(
|
| 194 |
+
f"Expected output RDS file not created at {output_rds}. R stderr: {stderr}"
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
return {
|
| 198 |
+
"command_executed": command_executed,
|
| 199 |
+
"stdout": stdout,
|
| 200 |
+
"stderr": stderr,
|
| 201 |
+
"output_files": {
|
| 202 |
+
"output_rds": str(output_file)
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
except FileNotFoundError:
|
| 207 |
+
error_msg = "Error: 'Rscript' command not found. Please ensure R is installed and in your system's PATH."
|
| 208 |
+
logger.error(error_msg)
|
| 209 |
+
raise RuntimeError(error_msg) from None
|
| 210 |
+
except subprocess.CalledProcessError as e:
|
| 211 |
+
logger.error(f"Command failed with exit code {e.returncode}")
|
| 212 |
+
logger.error(f"STDOUT: {e.stdout}")
|
| 213 |
+
logger.error(f"STDERR: {e.stderr}")
|
| 214 |
+
raise RuntimeError(
|
| 215 |
+
f"R script execution failed with exit code {e.returncode}.\n"
|
| 216 |
+
f"STDOUT: {e.stdout}\n"
|
| 217 |
+
f"STDERR: {e.stderr}"
|
| 218 |
+
) from e
|
| 219 |
+
|
| 220 |
+
if __name__ == "__main__":
|
| 221 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/app/bioconductor-alabaster.sfe_shim_server.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import ast
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
from mcp.server.fastmcp import FastMCP
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-alabaster.sfe/app/bioconductor-alabaster.sfe_server.py')
|
| 11 |
+
LOCAL_SERVER = Path(__file__).with_name(SOURCE_SERVER.name)
|
| 12 |
+
SERVER_NAME = 'biosci_bioconductor_alabaster_sfe'
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class _ShimMCP:
|
| 16 |
+
@staticmethod
|
| 17 |
+
def tool(*args, **kwargs):
|
| 18 |
+
if args and callable(args[0]) and len(args) == 1 and not kwargs:
|
| 19 |
+
return args[0]
|
| 20 |
+
def _decorator(fn):
|
| 21 |
+
return fn
|
| 22 |
+
return _decorator
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _resolve_source_server():
|
| 26 |
+
if LOCAL_SERVER.exists() and LOCAL_SERVER.name != Path(__file__).name:
|
| 27 |
+
return LOCAL_SERVER
|
| 28 |
+
return SOURCE_SERVER
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def _load_functions():
|
| 32 |
+
source_server = _resolve_source_server()
|
| 33 |
+
code = source_server.read_text(encoding="utf-8")
|
| 34 |
+
tree = ast.parse(code, filename=str(source_server))
|
| 35 |
+
function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")]
|
| 36 |
+
namespace = {
|
| 37 |
+
"__name__": "__mcp_source__",
|
| 38 |
+
"mcp": _ShimMCP(),
|
| 39 |
+
}
|
| 40 |
+
exec(compile(code, str(source_server), "exec"), namespace, namespace)
|
| 41 |
+
loaded = []
|
| 42 |
+
for name in function_names:
|
| 43 |
+
fn = namespace.get(name)
|
| 44 |
+
if callable(fn):
|
| 45 |
+
loaded.append(fn)
|
| 46 |
+
return loaded
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
mcp = FastMCP(SERVER_NAME)
|
| 50 |
+
for _fn in _load_functions():
|
| 51 |
+
mcp.tool()(_fn)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if __name__ == "__main__":
|
| 55 |
+
mcp.run(transport="stdio")
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/app/requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/docker-compose.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
mcp-bioconductor-alabaster.sfe:
|
| 5 |
+
build: .
|
| 6 |
+
image: mcp-bioconductor-alabaster.sfe:latest
|
| 7 |
+
container_name: mcp-bioconductor-alabaster.sfe
|
| 8 |
+
ports:
|
| 9 |
+
- "8000:8000"
|
| 10 |
+
environment:
|
| 11 |
+
- MCP_SERVER_NAME=bioconductor-alabaster.sfe
|
| 12 |
+
volumes:
|
| 13 |
+
- ./workspace:/app/workspace
|
| 14 |
+
- ./output:/app/output
|
| 15 |
+
restart: unless-stopped
|
| 16 |
+
healthcheck:
|
| 17 |
+
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
|
| 18 |
+
interval: 30s
|
| 19 |
+
timeout: 10s
|
| 20 |
+
retries: 3
|
| 21 |
+
start_period: 5s
|
| 22 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/environment.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
name: mcp-tool
|
| 3 |
+
channels:
|
| 4 |
+
- bioconda
|
| 5 |
+
- conda-forge
|
| 6 |
+
- defaults
|
| 7 |
+
dependencies:
|
| 8 |
+
- bioconductor-alabaster.sfe
|
| 9 |
+
- python=3.10
|
| 10 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-alabaster.sfe/requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastmcp
|
| 2 |
+
mcp
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-annotationdbi/Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Install Miniconda
|
| 8 |
+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh
|
| 9 |
+
|
| 10 |
+
# Add conda to PATH
|
| 11 |
+
ENV PATH="/opt/conda/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Install bioconductor-annotationdbi via conda (e.g., from bioconda)
|
| 14 |
+
RUN conda install -c bioconda bioconductor-annotationdbi -y && conda clean -a
|
| 15 |
+
|
| 16 |
+
# Install Python dependencies
|
| 17 |
+
RUN pip install uv
|
| 18 |
+
RUN uv pip install --system fastmcp
|
| 19 |
+
|
| 20 |
+
# Create app directory
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
|
| 23 |
+
# Copy your MCP server
|
| 24 |
+
COPY bioconductor-annotationdbi_server.py /app/
|
| 25 |
+
|
| 26 |
+
# Create workspace and output directories
|
| 27 |
+
RUN mkdir -p /app/workspace /app/output
|
| 28 |
+
|
| 29 |
+
# Make sure the server script is executable
|
| 30 |
+
RUN chmod +x /app/bioconductor-annotationdbi_server.py
|
| 31 |
+
|
| 32 |
+
# Expose port for MCP over HTTP (optional)
|
| 33 |
+
EXPOSE 8000
|
| 34 |
+
|
| 35 |
+
# Health check
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)"
|
| 37 |
+
|
| 38 |
+
# Default command runs the MCP server via stdio
|
| 39 |
+
CMD ["python", "/app/bioconductor-annotationdbi_server.py"]
|
| 40 |
+
|
Biomanus/biomni_web/backend/data/mcp_generated/mcp_bioconductor-annotationdbi/app/__pycache__/bioconductor-annotationdbi_shim_server.cpython-311.pyc
ADDED
|
Binary file (3.66 kB). View file
|
|
|