Phase 1: Project setup and FastMCP server skeleton#9
Conversation
- pyproject.toml with FastMCP, uvicorn, and dev dependencies - Makefile with check, fmt, lint, test, install, uninstall targets - LaunchAgent plist and install/uninstall scripts for auto-start - dev.sh script for development mode with auto-reload - Basic FastMCP server with placeholder tools: - get_status: Returns server status - ingest_logs: Placeholder for log ingestion - query_tool_frequency: Placeholder for frequency queries - Usage guide as MCP resource at session-analytics://guide - Tests for the placeholder tools - README with installation and usage instructions Server runs on port 8081 (to not conflict with event-bus on 8080). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Phase 1 - Project Setup and FastMCP Server SkeletonGreat foundation for the session analytics MCP server! The infrastructure follows the claude-event-bus pattern well. Here's my detailed feedback: ✅ Strengths
🔍 Code Quality Issues1. Test Coverage Gap (src/session_analytics/server.py:104-126) The tests use 2. Missing Error Handling (src/session_analytics/server.py:39-42) The 3. Hardcoded Port Conflicts (scripts/dev.sh:35-36) The script assumes port 8081 is only used by this service, but doesn't verify. Consider adding a port availability check before starting. 4. Path Handling (scripts/install-launchagent.sh:11) The script doesn't validate that PROJECT_DIR has the expected structure. Add validation for pyproject.toml existence. 🔒 Security Considerations1. Overly Permissive Settings (.claude/settings.local.json) The 2. Log File Permissions (scripts/com.evansenter.claude-session-analytics.plist:32-35) Session logs may contain sensitive information. The LaunchAgent logs are world-readable by default. Consider setting explicit permissions (chmod 600) in the install script. ⚡ Performance Considerations1. No Health Check Endpoint The 2. Missing Timeout in dev.sh (scripts/dev.sh:14-18) The LaunchAgent stop doesn't have a timeout. If the service hangs, this could block indefinitely. Consider using timeout command or adding fallback to pkill. 📊 Test Coverage Gaps
🐛 Potential Bugs1. Race Condition in dev.sh (scripts/dev.sh:14-23) There's a TOCTOU race between checking if the service is running and unloading it. Consider using an atomic operation instead. 2. Python Version Detection (Makefile:27) The Python version detection could fail silently if none of the required versions exist. Add explicit error handling. 💡 Suggestions
📝 Documentation
SummaryThis is a solid Phase 1 implementation with good architecture and developer experience. The main concerns are:
Recommendation: Approve with requested changes. The issues are non-blocking for a Phase 1 PR but should be addressed before Phase 2 (storage layer) to avoid compounding problems. Great work on the infrastructure! 🎉 |
Summary
Set up the basic project infrastructure following the
claude-event-buspattern.Server runs on port 8081 (to not conflict with event-bus on 8080).
Test plan
make checkpasses (fmt, lint, test)Closes #1
🤖 Generated with Claude Code