Spaces:
Running
Running
Commit
Β·
f9cb2b7
1
Parent(s):
cde8f48
docs: address CodeRabbit feedback for Phase 12 PR
Browse files- Add `text` fence language to architecture diagrams (MD040)
- Update roadmap directory structure (remove websearch, add clinicaltrials/biorxiv)
- Mark Phase 12 as COMPLETE in roadmap
- Rename test_mcp_server.py to test_mcp_tools_live.py for clarity
- Update hackathon requirements with MCP implementation status
- Fix async pattern in Modal integration doc
docs/implementation/12_phase_mcp_server.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
| 23 |
|
| 24 |
### What MCP Enables
|
| 25 |
|
| 26 |
-
```
|
| 27 |
Current State:
|
| 28 |
Our Tools β Called directly by Python code β Only our app can use them
|
| 29 |
|
|
@@ -105,12 +105,12 @@ async def search_pubmed(query: str, max_results: int = 10) -> str:
|
|
| 105 |
### 3.3 MCP Server URL
|
| 106 |
|
| 107 |
Once launched:
|
| 108 |
-
```
|
| 109 |
http://localhost:7860/gradio_api/mcp/
|
| 110 |
```
|
| 111 |
|
| 112 |
Or on HuggingFace Spaces:
|
| 113 |
-
```
|
| 114 |
https://[space-id].hf.space/gradio_api/mcp/
|
| 115 |
```
|
| 116 |
|
|
@@ -806,7 +806,7 @@ Phase 12 is **COMPLETE** when:
|
|
| 806 |
|
| 807 |
## 12. Architecture After Phase 12
|
| 808 |
|
| 809 |
-
```
|
| 810 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 811 |
β Claude Desktop / Cursor β
|
| 812 |
β (MCP Client) β
|
|
|
|
| 23 |
|
| 24 |
### What MCP Enables
|
| 25 |
|
| 26 |
+
```text
|
| 27 |
Current State:
|
| 28 |
Our Tools β Called directly by Python code β Only our app can use them
|
| 29 |
|
|
|
|
| 105 |
### 3.3 MCP Server URL
|
| 106 |
|
| 107 |
Once launched:
|
| 108 |
+
```text
|
| 109 |
http://localhost:7860/gradio_api/mcp/
|
| 110 |
```
|
| 111 |
|
| 112 |
Or on HuggingFace Spaces:
|
| 113 |
+
```text
|
| 114 |
https://[space-id].hf.space/gradio_api/mcp/
|
| 115 |
```
|
| 116 |
|
|
|
|
| 806 |
|
| 807 |
## 12. Architecture After Phase 12
|
| 808 |
|
| 809 |
+
```text
|
| 810 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 811 |
β Claude Desktop / Cursor β
|
| 812 |
β (MCP Client) β
|
docs/implementation/roadmap.md
CHANGED
|
@@ -41,7 +41,9 @@ src/
|
|
| 41 |
βββ tools/ # Search tools
|
| 42 |
β βββ __init__.py
|
| 43 |
β βββ pubmed.py # PubMed E-utilities tool
|
| 44 |
-
β βββ
|
|
|
|
|
|
|
| 45 |
β βββ search_handler.py # Orchestrates multiple tools
|
| 46 |
βββ prompts/ # Prompt templates
|
| 47 |
β βββ __init__.py
|
|
@@ -61,7 +63,8 @@ tests/
|
|
| 61 |
βββ unit/
|
| 62 |
β βββ tools/
|
| 63 |
β β βββ test_pubmed.py
|
| 64 |
-
β β βββ
|
|
|
|
| 65 |
β β βββ test_search_handler.py
|
| 66 |
β βββ agent_factory/
|
| 67 |
β β βββ test_judges.py
|
|
@@ -202,7 +205,7 @@ Structured Research Report
|
|
| 202 |
|
| 203 |
### Hackathon Integration (Phases 12-14)
|
| 204 |
|
| 205 |
-
12. **[Phase 12 Spec: MCP Server](12_phase_mcp_server.md)**
|
| 206 |
13. **[Phase 13 Spec: Modal Pipeline](13_phase_modal_integration.md)** π P1 - $2,500
|
| 207 |
14. **[Phase 14 Spec: Demo & Submission](14_phase_demo_submission.md)** π P0 - REQUIRED
|
| 208 |
|
|
@@ -223,11 +226,11 @@ Structured Research Report
|
|
| 223 |
| Phase 9: Source Cleanup | β
COMPLETE | Remove DuckDuckGo |
|
| 224 |
| Phase 10: ClinicalTrials | β
COMPLETE | ClinicalTrials.gov API |
|
| 225 |
| Phase 11: bioRxiv | β
COMPLETE | Preprint search |
|
| 226 |
-
| Phase 12: MCP Server |
|
| 227 |
| Phase 13: Modal Pipeline | π SPEC READY | Sandboxed code execution |
|
| 228 |
| Phase 14: Demo & Submit | π SPEC READY | Hackathon submission |
|
| 229 |
|
| 230 |
-
*Phases 1-
|
| 231 |
|
| 232 |
---
|
| 233 |
|
|
|
|
| 41 |
βββ tools/ # Search tools
|
| 42 |
β βββ __init__.py
|
| 43 |
β βββ pubmed.py # PubMed E-utilities tool
|
| 44 |
+
β βββ clinicaltrials.py # ClinicalTrials.gov API
|
| 45 |
+
β βββ biorxiv.py # bioRxiv/medRxiv preprints
|
| 46 |
+
β βββ code_execution.py # Modal sandbox execution
|
| 47 |
β βββ search_handler.py # Orchestrates multiple tools
|
| 48 |
βββ prompts/ # Prompt templates
|
| 49 |
β βββ __init__.py
|
|
|
|
| 63 |
βββ unit/
|
| 64 |
β βββ tools/
|
| 65 |
β β βββ test_pubmed.py
|
| 66 |
+
β β βββ test_clinicaltrials.py
|
| 67 |
+
β β βββ test_biorxiv.py
|
| 68 |
β β βββ test_search_handler.py
|
| 69 |
β βββ agent_factory/
|
| 70 |
β β βββ test_judges.py
|
|
|
|
| 205 |
|
| 206 |
### Hackathon Integration (Phases 12-14)
|
| 207 |
|
| 208 |
+
12. **[Phase 12 Spec: MCP Server](12_phase_mcp_server.md)** β
COMPLETE
|
| 209 |
13. **[Phase 13 Spec: Modal Pipeline](13_phase_modal_integration.md)** π P1 - $2,500
|
| 210 |
14. **[Phase 14 Spec: Demo & Submission](14_phase_demo_submission.md)** π P0 - REQUIRED
|
| 211 |
|
|
|
|
| 226 |
| Phase 9: Source Cleanup | β
COMPLETE | Remove DuckDuckGo |
|
| 227 |
| Phase 10: ClinicalTrials | β
COMPLETE | ClinicalTrials.gov API |
|
| 228 |
| Phase 11: bioRxiv | β
COMPLETE | Preprint search |
|
| 229 |
+
| Phase 12: MCP Server | β
COMPLETE | MCP protocol integration |
|
| 230 |
| Phase 13: Modal Pipeline | π SPEC READY | Sandboxed code execution |
|
| 231 |
| Phase 14: Demo & Submit | π SPEC READY | Hackathon submission |
|
| 232 |
|
| 233 |
+
*Phases 1-12 COMPLETE. Phases 13-14 for hackathon prizes.*
|
| 234 |
|
| 235 |
---
|
| 236 |
|
docs/pending/01_hackathon_requirements.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
# MCP's 1st Birthday Hackathon - Requirements Analysis
|
| 2 |
|
|
|
|
|
|
|
| 3 |
## Deadline: November 30, 2025 11:59 PM UTC
|
| 4 |
|
| 5 |
---
|
|
@@ -21,7 +23,7 @@ tags:
|
|
| 21 |
| Requirement | DeepCritical Status | Action Needed |
|
| 22 |
|-------------|---------------------|---------------|
|
| 23 |
| Autonomous Agent behavior | β
Have it | Search-Judge-Synthesize loop |
|
| 24 |
-
| Must use MCP servers as tools |
|
| 25 |
| Must be a Gradio app | β
Have it | `src/app.py` |
|
| 26 |
| Planning, reasoning, execution | β
Have it | Orchestrator + Judge |
|
| 27 |
| Context Engineering / RAG | β
Have it | LlamaIndex + ChromaDB |
|
|
|
|
| 1 |
# MCP's 1st Birthday Hackathon - Requirements Analysis
|
| 2 |
|
| 3 |
+
> **β
MCP Server implemented in Phase 12** - Track 2 compliant
|
| 4 |
+
|
| 5 |
## Deadline: November 30, 2025 11:59 PM UTC
|
| 6 |
|
| 7 |
---
|
|
|
|
| 23 |
| Requirement | DeepCritical Status | Action Needed |
|
| 24 |
|-------------|---------------------|---------------|
|
| 25 |
| Autonomous Agent behavior | β
Have it | Search-Judge-Synthesize loop |
|
| 26 |
+
| Must use MCP servers as tools | β
**DONE** | `src/mcp_tools.py` |
|
| 27 |
| Must be a Gradio app | β
Have it | `src/app.py` |
|
| 28 |
| Planning, reasoning, execution | β
Have it | Orchestrator + Judge |
|
| 29 |
| Context Engineering / RAG | β
Have it | LlamaIndex + ChromaDB |
|
docs/pending/03_modal_integration.md
CHANGED
|
@@ -49,22 +49,24 @@ import numpy as np
|
|
| 49 |
|
| 50 |
### Step 1: Wire Into Agent Pipeline
|
| 51 |
|
| 52 |
-
Add a `
|
| 53 |
|
| 54 |
```python
|
| 55 |
-
# src/
|
|
|
|
| 56 |
from src.tools.code_execution import get_code_executor
|
| 57 |
|
| 58 |
-
class
|
| 59 |
"""Run statistical analysis on evidence using Modal sandbox."""
|
| 60 |
|
| 61 |
async def analyze(self, evidence: list[Evidence], query: str) -> str:
|
| 62 |
# 1. LLM generates analysis code
|
| 63 |
code = await self._generate_analysis_code(evidence, query)
|
| 64 |
|
| 65 |
-
# 2. Execute in Modal sandbox
|
| 66 |
executor = get_code_executor()
|
| 67 |
-
|
|
|
|
| 68 |
|
| 69 |
# 3. Return results
|
| 70 |
return result["stdout"]
|
|
|
|
| 49 |
|
| 50 |
### Step 1: Wire Into Agent Pipeline
|
| 51 |
|
| 52 |
+
Add a `StatisticalAnalyzer` service that uses Modal:
|
| 53 |
|
| 54 |
```python
|
| 55 |
+
# src/services/statistical_analyzer.py
|
| 56 |
+
import asyncio
|
| 57 |
from src.tools.code_execution import get_code_executor
|
| 58 |
|
| 59 |
+
class StatisticalAnalyzer:
|
| 60 |
"""Run statistical analysis on evidence using Modal sandbox."""
|
| 61 |
|
| 62 |
async def analyze(self, evidence: list[Evidence], query: str) -> str:
|
| 63 |
# 1. LLM generates analysis code
|
| 64 |
code = await self._generate_analysis_code(evidence, query)
|
| 65 |
|
| 66 |
+
# 2. Execute in Modal sandbox (run sync executor in thread pool)
|
| 67 |
executor = get_code_executor()
|
| 68 |
+
loop = asyncio.get_event_loop()
|
| 69 |
+
result = await loop.run_in_executor(None, executor.execute, code)
|
| 70 |
|
| 71 |
# 3. Return results
|
| 72 |
return result["stdout"]
|
tests/integration/{test_mcp_server.py β test_mcp_tools_live.py}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
"""Integration tests for MCP
|
| 2 |
|
| 3 |
import pytest
|
| 4 |
|
| 5 |
|
| 6 |
-
class
|
| 7 |
-
"""Integration tests for MCP
|
| 8 |
|
| 9 |
@pytest.mark.integration
|
| 10 |
@pytest.mark.asyncio
|
|
|
|
| 1 |
+
"""Integration tests for MCP tool wrappers with live API calls."""
|
| 2 |
|
| 3 |
import pytest
|
| 4 |
|
| 5 |
|
| 6 |
+
class TestMCPToolsLive:
|
| 7 |
+
"""Integration tests for MCP tools against live APIs (PubMed, etc.)."""
|
| 8 |
|
| 9 |
@pytest.mark.integration
|
| 10 |
@pytest.mark.asyncio
|