-
Notifications
You must be signed in to change notification settings - Fork 33
feat(mcp-server): Add create_project tool and improve test coverage #449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(mcp-server): Add create_project tool and improve test coverage #449
Conversation
Implement a Python-based Model Context Protocol server that provides read-only access to the ACP backend API. The server runs as a sidecar in Claude runner pods and exposes 13 tools organized into 4 categories: - Project Management (3 tools): list/get projects, check access - Session Browsing (4 tools): list/get sessions, K8s resources, workspace - Workspace Access (1 tool): get file contents - Cluster Info (4 tools): workflows, metadata, cluster info, health Key features: - Uses FastMCP for MCP protocol implementation - Bearer token authentication with user's BOT_TOKEN - Comprehensive error handling with status code mapping - Path traversal protection on file access - Unit tests with 100% coverage of API client Integration: - Added to runner's .mcp.json configuration - Installed via Dockerfile during runner build - Environment variables (BACKEND_API_URL, BOT_TOKEN) set by operator 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add create_project() method to API client with proper error handling - Fix check_health() endpoint to use correct URL (not under /api) - Add create_project MCP tool for project creation via MCP - Improve test mocking with pytest_asyncio and proper AsyncMock usage - Add 13 new test cases covering project, session, and workflow operations - Add e2e tests to verify MCP server can reach backend endpoints - Update .gitignore to exclude .mcp.json (contains tokens) and LOCAL_SETUP.md Test coverage: 25/25 passing tests Linting: Clean (black + flake8) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Claude Code ReviewSummaryThis PR adds a new MCP (Model Context Protocol) server for the Ambient Code Platform API with comprehensive test coverage. The implementation introduces 14 MCP tools for read-only access to projects, sessions, and workflows, with one write operation (create_project). Code quality is excellent with proper async patterns, error handling, and security measures. Issues by SeverityBlocker IssuesNone - No blocking issues found. Critical Issues1. Token Security - Verified OK
Major Issues1. Missing Type Annotations in server.py:27
2. Broad Exception Catching
3. Health Endpoint URL Manipulation (client.py:352)
4. Missing Cleanup in Global Client
Minor Issues
Positive Highlights✅ Excellent Security Practices - Token length logging (PERFECT adherence to standards) RecommendationsPriority 1 (Before Merge)
Priority 2 (Follow-up PR) Overall AssessmentGrade: A- (Excellent work with minor improvements needed) Recommendation: APPROVE with Priority 1 fixes 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines. |
|
Why just expose the abilty to create projects but nothing else? The whole git commit message says "what" and not why which is far more important. Is the high level goal here for an agentic session to be able to "recurse" on its own and spawn a full sub-workspace? |
Summary
Enhances the MCP Ambient Server with project creation capabilities and significantly improves test coverage.
Changes
API Client (
client.py)create_project()method with proper error handling (ConnectError, TimeoutException)check_health()endpoint to correctly use/health(not under/api)MCP Server (
server.py)create_projectMCP tool for creating projects via MCP interfacename(required),display_name(optional),description(optional)Test Suite (
test_client.py)pytest_asyncioand properAsyncMockusagemock_httpx_response()helper for cleaner test setuptest_create_project_success/test_create_project_conflicttest_check_project_access_success/test_check_project_access_forbiddentest_get_session_success/test_get_session_not_foundtest_get_session_k8s_resources_successtest_list_ootb_workflows_successtest_get_workflow_metadata_success/test_get_workflow_metadata_not_foundtest_get_cluster_info_successtest_list_sessions_emptytest_list_session_workspace_successE2E Tests (
vteam.cy.ts)/api/cluster-info,/api/workflows/ootb)Configuration (
.gitignore).mcp.json- Contains sensitive auth tokens, user-specificLOCAL_SETUP.md- Developer-specific setup documentationQuality Assurance
All checks passing:
Test Coverage
Breaking Changes
None - all changes are additive.
Dependencies
No new dependencies added.
🤖 Generated with Claude Code