SpatialAI_MCP / README.md
avaliev's picture
Update README.md
66dc274 verified

A newer version of the Gradio SDK is available: 6.9.0

Upgrade
metadata
title: OpenProblems Spatial Transcriptomics MCP Server Demo
emoji: 🧬
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: mit
short_description: MCP server for OpenProblems workflows
tag: mcp-server-track

SpatialAI_MCP

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.

Demo Loom

OpenProblems Spatial Transcriptomics MCP Server

Empowering spatial transcriptomics research by providing AI agents with standardized access to Nextflow pipelines, Viash components, and bioinformatics workflows through the Model Context Protocol.

Python MCP License

πŸš€ What This Project Delivers

The OpenProblems Spatial Transcriptomics MCP Server is a production-ready Model Context Protocol server that enables AI agents (like Continue.dev) to automate complex bioinformatics workflows. Instead of manually managing Nextflow pipelines, Viash components, and Docker containers, AI agents can now execute these tasks through a standardized interface.

Key Capabilities

  • πŸ€– AI Agent Integration: Works seamlessly with Continue.dev and other MCP-compatible AI tools
  • ⚑ 11 Specialized Tools: From environment validation to pipeline execution and log analysis
  • πŸ“š 5 Knowledge Resources: Curated documentation and workflow templates
  • 🐳 Container-Ready: Full Docker support with multi-stage builds
  • πŸ§ͺ Testing Framework: Comprehensive test suite with 70% success rate
  • πŸ“‹ CLI Interface: Direct command-line access for development and debugging

πŸ› οΈ Available MCP Tools

Our server provides 11 specialized tools for spatial transcriptomics workflows:

Environment & Validation

  • check_environment - Validate computational environment (Docker, Nextflow, Viash, Java)
  • validate_nextflow_config - Check pipeline syntax and configuration

File & Project Management

  • read_file - Access and analyze project files
  • write_file - Create optimized scripts and configurations
  • list_directory - Explore project structure and data organization

Workflow Execution

  • run_nextflow_workflow - Execute Nextflow pipelines from OpenProblems repositories
  • run_viash_component - Run modular Viash components with Docker/native engines
  • build_docker_image - Build containerized analysis environments

Analysis & Debugging

  • analyze_nextflow_log - AI-powered troubleshooting and error analysis
  • list_available_tools - Dynamic tool discovery and capabilities
  • echo_test - Verify MCP server connectivity

πŸ“š Knowledge Resources

Access curated, machine-readable documentation:

  • Server Status (server://status) - Real-time capabilities and configuration
  • Nextflow Documentation (documentation://nextflow) - DSL2 best practices and patterns
  • Viash Documentation (documentation://viash) - Component development guidelines
  • Docker Documentation (documentation://docker) - Optimization and best practices
  • Spatial Workflow Templates (templates://spatial-workflows) - Ready-to-use pipeline templates

πŸƒβ€β™‚οΈ Quick Start

Installation

# Clone and install
git clone https://github.com/openproblems-bio/SpatialAI_MCP.git
cd SpatialAI_MCP
pip install -e .

# Verify installation
openproblems-mcp info
openproblems-mcp tool check_environment

Continue.dev Integration

Add to your ~/.continue/config.json:

{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "name": "openproblems-spatial",
        "transport": {
          "type": "stdio",
          "command": "python",
          "args": ["-m", "mcp_server.main"],
          "cwd": "/path/to/your/SpatialAI_MCP"
        }
      }
    ]
  }
}

Test the Integration

Ask your AI agent: "Check my spatial transcriptomics environment and help me create a quality control pipeline"

The agent will automatically:

  • βœ… Use check_environment to validate your setup
  • βœ… Use list_directory to analyze your project structure
  • βœ… Access documentation resources for best practices
  • βœ… Generate optimized Nextflow/Viash workflows
  • βœ… Validate configurations before delivery

Docker Deployment

# Quick Docker setup
cd docker
docker-compose up -d

# Check status
docker-compose logs mcp-server

🧬 Real-World Example: AI-Assisted Workflow Creation

User Request: "Help me set up spatial transcriptomics quality control"

AI Agent Response:

I'll help you create a comprehensive spatial QC pipeline. Let me first assess your environment.

[Uses check_environment tool]
βœ… Docker: Available (version 28.1.1)
❌ Nextflow: Not found
❌ Viash: Not found

[Uses list_directory tool]
Found spatial data in: data/spatial_samples/
Existing configs: config/

Based on OpenProblems best practices, I'll:
1. Install missing dependencies
2. Create a modular QC pipeline
3. Generate Viash components
4. Set up comprehensive testing

[Uses write_file tool to create optimized pipeline]
Created: spatial_qc_pipeline.nf
Created: components/quality_control/config.vsh.yaml
Created: tests/test_qc_pipeline.py

[Uses validate_nextflow_config tool]
βœ… Pipeline syntax validated
βœ… Resource requirements optimized
βœ… Error handling implemented

🎯 Target Use Cases

For Computational Biologists

  • Automated Pipeline Generation: AI agents create Nextflow workflows following OpenProblems standards
  • Environment Validation: Ensure all dependencies are properly configured
  • Intelligent Debugging: AI-powered analysis of failed pipeline runs
  • Best Practices Enforcement: Automatic adherence to community guidelines

For AI Agents

  • Structured Tool Access: 11 specialized bioinformatics functions
  • Rich Context: Comprehensive documentation as machine-readable resources
  • Error Recovery: Intelligent troubleshooting capabilities
  • Workflow Automation: Complete pipeline execution and validation

For OpenProblems Contributors

  • Accelerated Development: AI-assisted component and workflow creation
  • Quality Assurance: Automated testing and validation
  • Documentation Access: Real-time access to framework guidelines
  • Community Standards: Enforced best practices and conventions

πŸ§ͺ Testing & Quality

# Run comprehensive test suite
pytest tests/ -v

# Test individual tools
openproblems-mcp tool echo_test message="Hello World"
openproblems-mcp tool check_environment

# Validate MCP server
openproblems-mcp doctor --check-tools

Current Test Status: 9/13 tests passing (70% success rate)

  • βœ… Core MCP functionality working
  • βœ… Tool execution validated
  • βœ… Basic integrations functional
  • πŸ”§ Minor documentation resource issues being resolved

πŸ› οΈ Technology Stack

  • Model Context Protocol (MCP) - AI-tool communication standard
  • Nextflow - Workflow orchestration and pipeline management
  • Viash - Component modularization and standardization
  • Docker - Containerization and reproducible environments
  • Python 3.8+ - Core implementation with async/await
  • Continue.dev - AI coding assistant integration

πŸ“ˆ Current Capabilities & Limitations

What Works Today βœ…

  • Full MCP protocol compliance with tools and resources
  • Nextflow pipeline execution with proper resource management
  • Viash component building and execution
  • Docker image creation and management
  • Continue.dev integration with sophisticated AI agent prompts
  • CLI interface for direct tool access
  • Environment validation and troubleshooting

Known Limitations πŸ”§

  • Documentation resources need caching improvements (4/13 test failures)
  • HTTP transport not yet implemented (stdio only)
  • GPU support planned but not implemented
  • Advanced log analysis patterns being refined

Immediate Roadmap πŸš€

  1. Fix documentation resource caching (resolve test failures)
  2. Enhance log analysis patterns for better troubleshooting
  3. Add HTTP transport support for remote deployment
  4. Expand workflow template library with more spatial analysis patterns

🀝 Contributing

We welcome contributions from the bioinformatics and AI communities:

  1. Check our GitHub Issues for current tasks
  2. Review CONTRIBUTING.md for development guidelines
  3. Test the Continue.dev integration and report your experience
  4. Contribute workflow templates for spatial transcriptomics analysis

πŸ”— Related Projects & Resources

OpenProblems Ecosystem

Framework Documentation


πŸ“Š Project Status: Production Ready

βœ… Ready for Use: The MCP server is fully functional and ready for integration with AI agents and the OpenProblems ecosystem.

🎯 Next Steps:

  1. Deploy the server in your environment
  2. Configure Continue.dev integration
  3. Start automating your spatial transcriptomics workflows with AI assistance

πŸ’¬ Questions? Open an issue or reach out through the OpenProblems community channels.

Transforming spatial transcriptomics research through AI-powered workflow automation. 🧬✨