Skip to content

Commit f19adec

Browse files
committed
chore: change server transport to stdio
1 parent d16a736 commit f19adec

20 files changed

Lines changed: 319 additions & 84 deletions
File renamed without changes.
File renamed without changes.

.ctxfy/tasks/ctxfy-17-recieving-task/current-project-context.md renamed to .ctxfy/tasks/ctxfy-18-recieving-task/current-project-context.md

File renamed without changes.
File renamed without changes.

.ctxfy/tasks/ctxfy-17-recieving-task/skill-discovery.json renamed to .ctxfy/tasks/ctxfy-18-recieving-task/skill-discovery.json

File renamed without changes.
File renamed without changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
### System Context Layer (Static - Project Rules)
2+
3+
**Persona**: MCP Server Developer implementing STDIO transport
4+
**Capabilities**: Access to FastMCP library (v2.13.0), functional core with imperative shell architecture, STDIO transport configuration
5+
**Constraints**: Must follow FCIS pattern, maintain 80%+ test coverage, preserve MCP specification compatibility
6+
7+
### Domain Context Layer (Hybrid)
8+
9+
**Static Project Rules:**
10+
- Package architecture: Functional Core (src/core/) + Imperative Shell (src/shell/)
11+
- Transport logic must stay in shell layer (src/shell/adapters/, src/shell/orchestrators/)
12+
- Python toolchain: FastMCP v2.13.0+, pydantic v2.12+, strict mypy typing
13+
- Core functions remain pure (no I/O), shell handles side effects and transport
14+
15+
**Dynamic Project Context:**
16+
- Current HTTP transport in `src/app.py` using `mcp_server.http_app()`
17+
- Registration flow: `create_mcp_server()``MCPOrchestrator(mcp)``tool_registry.register_all_to_mcp()`
18+
- FastMCP provides `run()` method for STDIO transport
19+
- Existing MCP orchestrator in `src/shell/orchestrators/mcp_orchestrator.py`
20+
21+
**Active Skills:**
22+
- No specific skills loaded (fallback strategy: proceed_without_skills)
23+
24+
### Task Context Layer (Dynamic)
25+
26+
**Task Description**: Change MCP Server communication transport from HTTP to STDIO to enable `ctx.read_resource(task_file_uri)` functionality with file system URIs and improve client integration efficiency.
27+
28+
**Success Criteria**:
29+
- MCP Server uses STDIO as primary transport instead of HTTP
30+
- `ctx.read_resource(task_file_uri)` works correctly with `file://` and `resource://` URIs
31+
- All registered resources/tools continue functioning after transport change
32+
- Server maintains MCP specification compatibility with clients (Claude Code, Cursor, Trae, etc.)
33+
34+
**Integration Points**:
35+
- Modify `src/app.py` to use FastMCP's STDIO transport via `run()` method
36+
- Update `MCPOrchestrator` registration flow to work with STDIO transport
37+
- Preserve existing tool registration mechanism through `tool_registry.register_all_to_mcp()`
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## 📂 PROJECT STRUCTURE RELEVANT TO MCP TRANSPORT
2+
src/
3+
├── app.py # Current HTTP transport implementation
4+
├── core/ # Functional Core (business logic)
5+
│ ├── models/
6+
│ ├── ports/
7+
│ ├── use_cases/
8+
│ └── workflows/
9+
└── shell/ # Imperative Shell (I/O coordination)
10+
├── adapters/
11+
├── orchestrators/
12+
│ └── mcp_orchestrator.py
13+
└── registry/
14+
15+
## 🔍 EXISTING IMPLEMENTATIONS
16+
- **Concrete file path**: `src/app.py` - current HTTP transport using `mcp_server.http_app()`
17+
- **Registration pattern**: `MCPOrchestrator(mcp)` registers tools/prompts via `tool_registry.register_all_to_mcp(mcp)`
18+
19+
## ⚙️ CONFIGURATION PATHWAYS
20+
- **Transport mechanism**: FastMCP provides `run()` method for STDIO transport
21+
- **Registration flow**: `create_mcp_server()``MCPOrchestrator(mcp)``tool_registry.register_all_to_mcp()`
22+
23+
## 🛡️ CRITICAL RULES & VALIDATION
24+
✅ package-and-module-architecture.md compliance: Following FCIS pattern with core/shell separation
25+
✅ functional-code-imperative-shell.md compliance: Transport logic stays in shell layer
26+
✅ immutable-value-objects.md compliance: Value objects remain immutable in core
27+
✅ python-toolchain-standards.md compliance: Using FastMCP library properly
28+
✅ Token limit compliance: 500/500
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
🏷️ PRP METADATA
2+
PRP ID: PRP-MCP-STDIO-001
3+
Type: Backend Development
4+
Domain: MCP Server Transport
5+
Technology Stack: Python/FastMCP/STDIO
6+
Complexity Level: Medium
7+
8+
🎯 BUSINESS CONTEXT LAYER
9+
Business Objectives
10+
- MCP Server utilizes STDIO transport to enable ctx.read_resource(task_file_uri) functionality with file:// and resource:// URIs
11+
- Maintain compatibility with MCP specification for Claude Code, Cursor, Trae clients
12+
- Improve communication efficiency and reliability between server and clients
13+
14+
SLAs & Performance Requirements
15+
- 100% of resource reading tests pass with URIs after transport change
16+
- Response time for basic operations remains under 2 seconds
17+
- No regressions in existing functionality
18+
- STDIO transport test coverage reaches 90%
19+
20+
🔧 TECHNICAL TRANSLATION
21+
Architecture Pattern
22+
- Functional Core & Imperative Shell (FCIS) with transport logic in shell layer
23+
- Hexagonal Architecture with STDIO adapter implementation
24+
- Maintain core/shell separation with MCPOrchestrator in shell coordinating transport
25+
26+
Technology Specifications
27+
- FastMCP library for STDIO transport implementation
28+
- Python 3.13 with proper dependency management
29+
- Ruff line-length=88 and MyPy strict mode compliance
30+
31+
Specification Output
32+
📝 SPECIFICATION OUTPUT
33+
Expected Deliverables
34+
- src/app.py updated to use STDIO transport instead of HTTP
35+
- MCPOrchestrator(mcp) configured for STDIO communication
36+
- tool_registry.register_all_to_mcp(mcp) working with STDIO transport
37+
- Updated documentation for STDIO client connections
38+
39+
Code Structure Guidelines
40+
- Transport changes confined to src/shell/ layer
41+
- Core business logic remains unchanged in src/core/
42+
- STDIO adapter follows port naming conventions (*CommandPort, *RepositoryPort)
43+
44+
✅ VALIDATION FRAMEWORK
45+
Testing Strategy
46+
- Unit tests for core functionality remain unchanged (≥70% of suite)
47+
- Integration tests validate STDIO transport with real adapters (≤25% of suite)
48+
- E2E tests verify client connectivity via STDIO (≤5% of suite)
49+
50+
Quality Gates
51+
- Architecture compliance: Core functions remain pure without I/O
52+
- Test distribution: 70/25/5 ratio maintained
53+
- Code quality: Ruff formatting and MyPy strict validation pass
54+
55+
✨ AI CONTEXT ADAPTATION
56+
Model Compatibility Notes
57+
- Claude 3: Excellent for complex transport architecture changes
58+
- Include specific file paths (src/app.py, MCPOrchestrator) in prompts
59+
- Emphasize FCIS compliance during implementation
60+
61+
📊 SUCCESS METRICS
62+
Performance Metrics
63+
- Resource reading operations complete in <2 seconds
64+
- Client connection establishment time <500ms
65+
- STDIO transport throughput: 1500 req/sec
66+
67+
Quality & Reliability Metrics
68+
- 90% test coverage for STDIO transport code
69+
- Zero regressions in existing functionality
70+
- Ruff formatting compliance: 100%
71+
72+
📋 ARCHITECTURE COMPLIANCE CHECKLIST
73+
- [ ] FCIS patterns properly implemented in src/app.py
74+
- [ ] Port naming conventions followed in src/core/ports/
75+
- [ ] Test distribution requirements met in tests/
76+
- [ ] Value objects are immutable in src/core/models/
77+
- [ ] Core functions are pure in src/core/use_cases/
78+
- [ ] Token budget under 1000 tokens
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"task_id": "ctxfy-19-stdio-transport",
3+
"task_title": "Mudança do Transporte do MCP Server para STDIO",
4+
"task_summary": "Change MCP Server communication transport from HTTP to STDIO to enable ctx.read_resource(task_file_uri) functionality to work properly with file system URIs and improve client integration efficiency and reliability.",
5+
"task_type": "implementation",
6+
"domain_keywords": ["STDIO", "MCP Server", "Transport", "Communication", "URI"],
7+
"discovered_skills": [],
8+
"context_budget_used": 45,
9+
"context_budget_remaining": 75,
10+
"fallback_strategy": "proceed_without_skills"
11+
}

0 commit comments

Comments
 (0)