--- 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](https://www.loom.com/share/09dcc3ed89ca471da787d9714c37836e?sid=4a8a0f09-641d-43b2-8eca-7bef88b0a032) # 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://img.shields.io/badge/python-3.8+-blue.svg)](https://python.org) [![MCP](https://img.shields.io/badge/protocol-MCP-green.svg)](https://modelcontextprotocol.io) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](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. **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](https://github.com/openproblems-bio/SpatialAI_MCP/issues)** for current tasks 2. **Review [CONTRIBUTING.md](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** - **[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. 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.* ๐Ÿงฌโœจ