CoolFace
Apppublic

Agents-MCP-Hackathon/SpatialAI_MCP

sourceHugging Facemitupdated 1y agoView on Hugging Face
2likes
App README

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](https://python.org) ![MCP](https://modelcontextprotocol.io) ![License](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

bash
# 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:

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

bash
# 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

bash
# 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)](https://modelcontextprotocol.io/) - AI-tool communication standard
  • โ€”[Nextflow](https://nextflow.io/) - Workflow orchestration and pipeline management
  • โ€”[Viash](https://viash.io/) - Component modularization and standardization
  • โ€”[Docker](https://docker.com/) - Containerization and reproducible environments
  • โ€”Python 3.8+ - Core implementation with async/await
  • โ€”[Continue.dev](https://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. 1.Fix documentation resource caching (resolve test failures)
  2. 2.Enhance log analysis patterns for better troubleshooting
  3. 3.Add HTTP transport support for remote deployment
  4. 4.Expand workflow template library with more spatial analysis patterns

๐Ÿค Contributing

We welcome contributions from the bioinformatics and AI communities:

  1. 1.Check our [GitHub Issues](https://github.com/openproblems-bio/SpatialAI_MCP/issues) for current tasks
  2. 2.Review [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines
  3. 3.Test the Continue.dev integration and report your experience
  4. 4.Contribute workflow templates for spatial transcriptomics analysis

๐Ÿ”— Related Projects & Resources

OpenProblems Ecosystem

  • โ€”[OpenProblems](https://github.com/openproblems-bio/openproblems) - Community benchmarking platform
  • โ€”[Spatial Decomposition Task](https://github.com/openproblems-bio/task_spatial_decomposition) - Spatial analysis benchmarks
  • โ€”[IST Preprocessing](https://github.com/openproblems-bio/task_ist_preprocessing) - Data preprocessing workflows

Framework Documentation

  • โ€”[Nextflow Documentation](https://nextflow.io/docs/latest/) - Pipeline development guide
  • โ€”[Viash Documentation](https://viash.io/docs/) - Component creation guide
  • โ€”[Continue.dev Setup](docs/CONTINUE_DEV_SETUP.md) - AI agent integration guide

๐Ÿ“Š 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. 1.Deploy the server in your environment
  2. 2.Configure Continue.dev integration
  3. 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. ๐Ÿงฌโœจ