Spaces:
Sleeping
Sleeping
File size: 9,312 Bytes
c75526e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | # Continue.dev MCP Integration Setup Guide
## 1. Local Development Setup (Recommended)
### Continue.dev Configuration
Edit your Continue.dev configuration file:
**Location**: `~/.continue/config.json`
```json
{
"models": [
{
"title": "Claude 3.5 Sonnet",
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022",
"apiKey": "your-anthropic-api-key"
}
],
"experimental": {
"modelContextProtocolServers": [
{
"name": "openproblems-spatial",
"transport": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_server.main"],
"cwd": "/path/to/your/SpatialAI_MCP"
}
}
]
},
"docs": [
{
"title": "Nextflow Documentation",
"startUrl": "https://www.nextflow.io/docs/latest/"
},
{
"title": "Viash Documentation",
"startUrl": "https://viash.io/docs/"
},
{
"title": "OpenProblems GitHub",
"startUrl": "https://github.com/openproblems-bio/openproblems-v2"
},
{
"title": "Spatial Transcriptomics Methods",
"startUrl": "https://github.com/openproblems-bio/task_spatial_decomposition"
}
]
}
```
### Important Configuration Notes
1. **Replace the path**: Change `/path/to/your/SpatialAI_MCP` to your actual project directory
2. **Python environment**: Ensure the `python` command points to the environment where you installed the MCP server
3. **Working directory**: The `cwd` field ensures the MCP server runs from the correct directory
### Verification Steps
```bash
# 1. Navigate to your project directory
cd /path/to/your/SpatialAI_MCP
# 2. Verify your MCP server works
python -m mcp_server.main
# 3. Test CLI tools
openproblems-mcp info
openproblems-mcp tool check_environment
# 4. Generate documentation cache
openproblems-mcp download-docs
```
## 2. Alternative Setup Methods
### Method A: Virtual Environment Activation
If you're using conda/virtualenv, specify the full Python path:
```json
{
"experimental": {
"modelContextProtocolServers": [
{
"name": "openproblems-spatial",
"transport": {
"type": "stdio",
"command": "/home/obi/miniforge3/bin/python",
"args": ["-m", "mcp_server.main"],
"cwd": "/home/obi/SpatialAI_MCP"
}
}
]
}
}
```
### Method B: Using Shell Script Wrapper
Create a wrapper script for more control:
**File**: `scripts/start_mcp_server.sh`
```bash
#!/bin/bash
cd /path/to/your/SpatialAI_MCP
source activate your-conda-env # if using conda
exec python -m mcp_server.main
```
**Continue.dev config**:
```json
{
"experimental": {
"modelContextProtocolServers": [
{
"name": "openproblems-spatial",
"transport": {
"type": "stdio",
"command": "/path/to/your/SpatialAI_MCP/scripts/start_mcp_server.sh"
}
}
]
}
}
```
## 3. Remote Deployment Options
### Option A: HTTP Server (Future Enhancement)
Our current MCP server uses stdio transport. To deploy remotely, you'd need an HTTP wrapper:
```python
# Future: http_server.py
from fastapi import FastAPI
from mcp_server.main import handle_call_tool, handle_list_tools
app = FastAPI()
@app.post("/mcp/call-tool")
async def call_tool_endpoint(request: dict):
result = await handle_call_tool(request["name"], request["arguments"])
return {"result": [item.text for item in result]}
```
### Option B: SSH Tunnel (Current Solution)
For remote access with current stdio transport:
```bash
# On remote server
ssh -R 8022:localhost:22 remote-server
# Continue.dev config for SSH tunnel
{
"experimental": {
"modelContextProtocolServers": [
{
"name": "openproblems-spatial",
"transport": {
"type": "stdio",
"command": "ssh",
"args": [
"remote-server",
"cd /path/to/SpatialAI_MCP && python -m mcp_server.main"
]
}
}
]
}
}
```
## 4. Testing Your Integration
### Step 1: Test MCP Server Standalone
```bash
cd /path/to/your/SpatialAI_MCP
# Test tools
openproblems-mcp tool echo_test message="Hello MCP"
openproblems-mcp tool check_environment
# Test resources
openproblems-mcp info
```
### Step 2: Test Continue.dev Integration
1. **Restart VS Code** after updating config
2. **Open Continue.dev sidebar** (Cmd/Ctrl + L)
3. **Ask a spatial transcriptomics question**:
```
"Help me create a Nextflow pipeline for spatial transcriptomics quality control"
```
4. **Verify MCP tools are available** - the agent should:
- Check your environment with `check_environment`
- Access our documentation resources
- Create files using `write_file`
- Validate pipelines with `validate_nextflow_config`
### Step 3: Debug Connection Issues
**Check Continue.dev logs**:
- Open VS Code Developer Tools (Help > Toggle Developer Tools)
- Look for MCP connection errors in Console
**Common issues**:
```bash
# Issue: Python not found
# Solution: Use full Python path
"command": "/usr/bin/python3"
# Issue: Module not found
# Solution: Check working directory and installation
"cwd": "/correct/path/to/SpatialAI_MCP"
# Issue: Permission denied
# Solution: Make script executable
chmod +x scripts/start_mcp_server.sh
```
## 5. Production Deployment Architecture
```mermaid
graph TD
A["π©βπ» Computational Biologist<br/>Continue.dev in VS Code"] --> B["π MCP Connection<br/>(stdio transport)"]
B --> C["π‘ OpenProblems MCP Server<br/>python -m mcp_server.main"]
C --> D["π οΈ Local Tools"]
C --> E["π Cached Documentation"]
C --> F["π³ Local Docker"]
C --> G["β‘ Nextflow Workflows"]
H["π Continue.dev Docs Crawler"] --> I["π Real-time Documentation"]
I --> J["Nextflow.io"]
I --> K["Viash.io"]
I --> L["GitHub OpenProblems"]
A --> H
```
## 6. Example Agent Interactions
### Scenario 1: Environment Setup
**User**: "Check if my environment is ready for spatial analysis"
**Agent Response**:
```
I'll check your spatial transcriptomics environment using the OpenProblems MCP server.
[Uses MCP tool: check_environment]
Results:
β
Docker: Available (version 28.1.1)
β Nextflow: Not found
β Viash: Not found
β Java: Not found
I recommend installing the missing tools:
- Nextflow: curl -s https://get.nextflow.io | bash
- Viash: curl -fsSL get.viash.io | bash
- Java: sudo apt install openjdk-17-jre-headless
```
### Scenario 2: Pipeline Creation
**User**: "Create a spatial QC pipeline following OpenProblems standards"
**Agent Response**:
```
I'll create an optimized spatial transcriptomics QC pipeline using the latest
Nextflow best practices and OpenProblems templates.
[Uses MCP resources and tools to]:
1. Get Nextflow DSL2 best practices
2. Access spatial workflow templates
3. Create optimized pipeline file
4. Validate syntax and configuration
[Creates file: spatial_qc_pipeline.nf with production-ready workflow]
```
## 7. Troubleshooting Common Issues
### MCP Server Not Starting
```bash
# Check if server starts manually
cd /path/to/your/SpatialAI_MCP
python -m mcp_server.main
# If it fails, check:
1. Python environment has required packages
2. Working directory is correct
3. No import errors in the logs
```
### Continue.dev Not Detecting MCP Tools
```bash
# Verify MCP protocol compliance
openproblems-mcp info
# Check Continue.dev logs in VS Code Developer Tools
# Look for MCP connection status messages
```
### Tools Failing to Execute
```bash
# Test tools individually
openproblems-mcp tool list_directory directory_path="."
openproblems-mcp tool validate_nextflow_config pipeline_path="test.nf"
# Check file permissions and paths
ls -la /path/to/your/SpatialAI_MCP
```
## 8. Advanced Configuration
### Resource Limits
```json
{
"experimental": {
"modelContextProtocolServers": [
{
"name": "openproblems-spatial",
"transport": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_server.main"],
"cwd": "/path/to/your/SpatialAI_MCP"
},
"timeout": 30000,
"maxConcurrentRequests": 10
}
]
}
}
```
### Multiple MCP Servers
```json
{
"experimental": {
"modelContextProtocolServers": [
{
"name": "openproblems-spatial",
"transport": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_server.main"],
"cwd": "/path/to/your/SpatialAI_MCP"
}
},
{
"name": "other-mcp-server",
"transport": {
"type": "stdio",
"command": "other-mcp-command"
}
}
]
}
}
```
## 9. Success Validation Checklist
- [ ] Continue.dev config updated with correct paths
- [ ] MCP server starts manually: `python -m mcp_server.main`
- [ ] CLI tools work: `openproblems-mcp info`
- [ ] Documentation cached: `openproblems-mcp download-docs`
- [ ] VS Code restarted after config change
- [ ] Continue.dev sidebar shows MCP tools available
- [ ] Agent can execute spatial transcriptomics tasks
- [ ] Environment validation works
- [ ] Pipeline creation and validation functional
π **Your OpenProblems MCP Server is now integrated with Continue.dev for powerful spatial transcriptomics AI assistance!**
|