Skip to content

Empowering spatial transcriptomics research by providing AI agents with a standardized interface to Nextflow pipelines, Viash components, and comprehensive documentation, accelerating discovery in the OpenProblems project.

License

Notifications You must be signed in to change notification settings

Rebell-Leader/SpatialAI_MCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpenProblems Spatial Transcriptomics MCP Server

A production-ready Model Context Protocol (MCP) server for OpenProblems spatial transcriptomics workflows, built with FastMCP 2.0 and designed to work seamlessly with Continue.dev in VSCode.

🎯 Purpose

This MCP server provides bioinformatics-specific tools that complement Continue.dev's built-in capabilities, focusing on:

  • Spatial transcriptomics domain expertise (data validation, method development)
  • Bioinformatics tool execution (Nextflow, Viash, Docker)
  • OpenProblems ecosystem integration (benchmarking, method validation)
  • Workflow state management (long-running pipeline tracking)

Note: This server does NOT duplicate Continue.dev's built-in file operations, terminal commands, or git functionality. Instead, it provides specialized bioinformatics capabilities that work alongside Continue.dev's existing tools.

πŸš€ Quick Start

Installation

pip install openproblems-spatial-mcp

Continue.dev Configuration

Add to your Continue.dev configuration (~/.continue/config.json):

{
  "mcpServers": {
    "openproblems-spatial": {
      "command": "openproblems-mcp-server",
      "args": [],
      "env": {
        "OPENPROBLEMS_MCP_LOG_LEVEL": "INFO"
      }
    }
  }
}

Basic Usage

  1. Check server health:

    openproblems-mcp check
  2. Start the server (usually automatic via Continue.dev):

    openproblems-mcp-server
  3. Initialize configuration:

    openproblems-mcp init

πŸ—οΈ Architecture

The system operates as invisible local infrastructure in your development environment:

graph TB
    subgraph "Development Environment"
        subgraph "IDE"
            VSCode[VSCode IDE]
            Continue[Continue.dev Extension]
            VSCode --> Continue
        end

        subgraph "MCP Server (Local Process)"
            MCP[FastMCP Server]
            Tools[Bioinformatics Tools]
            State[Workflow State]
            MCP --> Tools
            MCP --> State
        end

        subgraph "Local Tools"
            Nextflow[Nextflow]
            Viash[Viash]
            Docker[Docker]
            Git[Git]
        end

        subgraph "User Files"
            Workspace[Project Files]
            Data[Spatial Data]
            Configs[Configurations]
        end
    end

    Continue -.->|MCP Protocol| MCP
    Tools --> Nextflow
    Tools --> Viash
    Tools --> Docker
    State -.-> Workspace
    MCP -.-> Data

    style MCP fill:#e1f5fe
    style Tools fill:#f3e5f5
    style Continue fill:#e8f5e8
Loading

πŸ”§ Available Tools

Core Infrastructure

  • health_check: Check server and tool status
  • list_tools_status: List bioinformatics tool availability
  • get_server_info: Get server configuration details

Bioinformatics Execution (Planned)

  • run_nextflow_workflow: Execute Nextflow pipelines locally
  • build_viash_component: Build Viash components
  • execute_viash_component: Run Viash components
  • build_docker_image: Build Docker images

Spatial Transcriptomics (Planned)

  • validate_spatial_data: Validate SpatialData/zarr/AnnData formats
  • analyze_spatial_metadata: Extract spatial data metadata
  • setup_spatial_environment: Generate conda/pip environments
  • create_spatial_component: Generate Viash components for spatial methods

OpenProblems Integration (Planned)

  • analyze_openproblems_repo: Analyze repository structure
  • build_openproblems_method: Build methods with OpenProblems framework
  • run_openproblems_benchmark: Execute benchmarks
  • validate_openproblems_submission: Validate submissions

Workflow Management (Planned)

  • get_execution_status: Check workflow status
  • cancel_execution: Cancel running workflows
  • get_execution_history: View execution history

πŸ“Š Available Resources

  • config://server: Server configuration (JSON)
  • status://tools: Tool detection status (JSON)
  • status://health: OverON)health status (JSON)

βš™οΈ Configuration

Default Configuration

The server works out-of-the-box with sensible defaults. Optional configuration:

  • ~/.openproblems-mcp/config.yaml (user-wide)
  • .openproblems-mcp.yaml (project-specific)

Example Configuration

server:
  log_level: INFO
  max_concurrent_executions: 3
  default_timeout_seconds: 3600
  workspace_root: "."

tools:
  nextflow_executable: nextflow
  viash_executable: viash
  docker_executable: docker
  git_executable: git
  python_executable: python

Environment Variables

  • OPENPROBLEMS_MCP_WORKSPACE_ROOT: Workspace directory
  • OPENPROBLEMS_MCP_LOG_LEVEL: Logging level (DEBUG, INFO, WARNING, ERROR)
  • OPENPROBLEMS_MCP_MAX_CONCURRENT: Max concurrent executions
  • OPENPROBLEMS_MCP_TIMEOUT: Default timeout in seconds
  • OPENPROBLEMS_MCP_NEXTFLOW_EXECUTABLE: Nextflow executable path
  • OPENPROBLEMS_MCP_VIASH_EXECUTABLE: Viash executable path
  • OPENPROBLEMS_MCP_DOCKER_EXECUTABLE: Docker executable path

πŸ”„ Integration with Continue.dev

This server complements Continue.dev's built-in tools:

Continue.dev Built-ins (We DON'T duplicate)

  • File operations (read_file, create_new_file)
  • Search operations (exact_search, file_glob_search)
  • Terminal commands (run_terminal_command)
  • Git operations (view_diff)
  • Directory operations (view_subdirectory)

Our Specialized Tools (Unique value)

  • Bioinformatics tool execution and management
  • Spatial transcriptomics domain expertise
  • OpenProblems ecosystem integration
  • Long-running workflow state management
  • Domain-specific error analysis and remediation

🧬 Use Cases

Spatial Transcriptomics Method Development

Continue.dev Agent: "I need to develop a spatial clustering method"
↓
1. Agent uses Continue.dev's file tools to read existing code
2. Agent calls our validate_spatial_data to check test data
3. Agent calls our create_spatial_component to generate Viash component
4. Agent uses Continue.dev's terminal to run tests
5. Agent calls our build_openproblems_method to prepare submission

Nextflow Pipeline Development

Continue.dev Agent: "Let's optimize this Nextflow pipeline"
↓
1. Agent uses Continue.dev's file tools to read pipeline code
2. Agent calls our run_nextflow_workflow to test execution
3. Agent calls our get_execution_status to monitor progress
4. Agent uses Continue.dev's diff tools to review changes
5. Agent calls our validate_openproblems_submission to check compliance

πŸ› οΈ Development

Local Development Setup

git clone https://github.com/openproblems-bio/SpatialAI_MCP.git
cd SpatialAI_MCP

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/
ruff check src/

Project Structure

src/openproblems_mcp/
β”œβ”€β”€ __init__.py          # Package initialization
β”œβ”€β”€ main.py              # Main entry point
β”œβ”€β”€ server.py            # FastMCP server core
β”œβ”€β”€ cli.py               # CLI commands
β”œβ”€β”€ config.py            # Configuration management
β”œβ”€β”€ tool_detection.py    # Tool detection logic
└── exceptions.py        # Error handling

πŸ“‹ Requirements

System Requirements

  • Python 3.8 or higher
  • Operating System: Linux, macOS, or Windows

Optional Tools (Auto-detected)

  • Nextflow: For pipeline execution
  • Viash: For component building and execution
  • Docker: For container operations
  • Git: For repository operations
  • Python/Conda: For environment management

🚦 Current Status

βœ… Completed (Task 1)

  • βœ… Clean Python package structure
  • βœ… FastMCP-based server architecture
  • βœ… Comprehensive logging and configuration
  • βœ… Local tool detection and validation
  • βœ… Pip-installable with CLI commands
  • βœ… Health monitoring and status reporting

🚧 In Development

  • 🚧 Bioinformatics tool execution (Task 2)
  • 🚧 Spatial data validation (Task 3)
  • 🚧 OpenProblems integration (Task 4)
  • 🚧 Workflow state management (Task 5)

🀝 Why FastMCP?

FastMCP 2.0 provides:

  • Minimal boilerplate: Focus on functionality, not protocol details
  • Production-ready: Built for real-world deployment scenarios
  • High performance: Optimized for MCP protocol efficiency
  • Pythonic: Clean, intuitive API design
  • Comprehensive: Full MCP ecosystem support

This implementation is significantly cleaner and more maintainable than raw MCP protocol implementations.

πŸ“š Documentation

  • Installation Guide: See Quick Start section above
  • API Reference: Coming soon
  • Continue.dev Integration: See Integration section above
  • Troubleshooting: Use openproblems-mcp check for diagnostics

🀝 Contributing

We welcome contributions! Please:

  1. Focus on bioinformatics-specific functionality
  2. Avoid duplicating Continue.dev built-in tools
  3. Follow the FastMCP patterns established in the codebase
  4. Add tests for new functionality

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • OpenProblems Initiative: For standardizing benchmarking in spatial biology
  • FastMCP: For providing an excellent MCP framework
  • Continue.dev: For creating a powerful AI coding assistant platform

πŸ“ž Support

About

Empowering spatial transcriptomics research by providing AI agents with a standardized interface to Nextflow pipelines, Viash components, and comprehensive documentation, accelerating discovery in the OpenProblems project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published