feat: MCP server support and GitHub code review#35
Merged
Conversation
Core Infrastructure (Phases 1-3):
- Fix provider bug: MCP servers now passed to containers
- Add mcp_servers and mcp_env fields to ProviderConfig
- Update Docker and Fly providers to merge MCP env vars
- Update Container Manager to pass MCP config through stack
Auto-Allow MCP Tools:
- Add model_validator to auto-enable ListMcpResources/ReadMcpResource
- Existing validator already allows all mcp__* tools
- No need to explicitly list MCP tools in allowed_tools
Launch-Time Credentials:
- Add mcp_env field to LaunchRequest model
- Pass through session_manager and container_manager
- Merge with config-defined env vars in providers
- Example: {"github": {"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."}}
This enables MCP servers (GitHub, filesystem, etc.) to work
with runtime credentials provided at agent launch time.
Breaking Change: None (backward compatible)
Testing: Existing tests pass, MCP integration pending
- Specialized for GitHub PR reviews - Focus on code quality, security, performance, testing, architecture - Uses GitHub MCP server with launch-time token - Auto-allows MCP tools (no explicit listing needed) - Resource limits: 1 CPU, 2GB RAM, 5GB storage
Added comprehensive documentation for Model Context Protocol (MCP) integration: - Updated README with github-code-review preset - Added MCP launch examples with mcp_env parameter - Documented auto-allow MCP tools feature - Updated configs/README with detailed MCP section - Added CHANGELOG entry for unreleased MCP features Key Documentation Updates: - 5 preset configurations (added github-code-review) - Runtime credential injection via mcp_env - Environment variable merging in providers - Auto-enable ListMcpResources and ReadMcpResource - Launch examples with GitHub token Related to feature/mcp-server-support implementation
Fixed JSON serialization error when launching agents with MCP servers. Problem: - McpStdioServerConfig (Pydantic model) cannot be directly JSON serialized - Error: "Object of type McpStdioServerConfig is not JSON serializable" Solution: - Convert Pydantic models to dicts using model_dump() before JSON serialization - Applied to both Docker and Fly providers - Handles both Pydantic v1 (dict()) and v2 (model_dump()) Changes: - docker_provider.py: Convert mcp_servers to dicts before adding to agent_config_dict - fly_provider.py: Same fix for Fly Machines provider - Both providers: Also convert when iterating for env var substitution Fixes launch errors for github-code-review and any agents with MCP servers
Added comprehensive UI support for MCP server credentials at launch time.
Changes:
1. MCPServerEditor Component:
- Fixed "Add MCP Server" button to use platform gray style (bg-gray-700)
- Added environment variables editor with textarea input
- Support for ${PLACEHOLDER} syntax with helpful tooltip
- Shows placeholder hint in textarea
2. McpCredentialsModal Component (NEW):
- Modal dialog for entering MCP credentials at agent launch
- Auto-detects required credentials from config mcp_servers
- Password input fields for each credential
- Shows placeholder expectations (e.g., ${GITHUB_TOKEN})
- Validation for required fields
- "Skip" option to launch without credentials (for testing)
- Helpful tip about credential lifecycle
3. Launch Flow Updated:
- Detects agents with has_mcp_servers flag
- Fetches full config to get MCP server details
- Shows credentials modal before launching
- Passes mcp_env to launch API
- Direct launch for agents without MCP servers
4. API Client Updates:
- Added mcp_env field to LaunchAgentRequest type
- Supports nested credentials: { server: { KEY: "value" } }
5. Dashboard Updates:
- Added github-code-review to PRESET_ICONS
- Integrated McpCredentialsModal component
- Split launch logic into handleLaunchAgent + doLaunchAgent
User Experience:
- Click agent with MCP badge → Modal appears
- Enter credentials → Launch with credentials
- Or skip → Launch without (will fail at runtime)
- Clear error messages if validation fails
Example: Launching github-code-review now prompts for GITHUB_PERSONAL_ACCESS_TOKEN
Fixed TypeScript compilation errors that appeared after merging main into
feature/mcp-server-support branch.
Issues fixed:
1. Template literal syntax error with GITHUB_TOKEN placeholder
- Changed from: ${`${GITHUB_TOKEN}`}
- Changed to: {'${GITHUB_TOKEN}'}
2. Type guard for env property access
- Added check: server.type !== 'sse' && server.type !== 'http'
- The env property only exists on McpStdioServerConfig
- SSE and HTTP server types don't have env property
3. Type assertion for handleUpdateServer
- Added: as McpServerConfig to ensure type safety
- Only updates env for stdio server types
Changes:
- src/agcluster/container/ui/components/builder/MCPServerEditor.tsx
Result:
- npx tsc --noEmit: PASSED
- npm run lint: PASSED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves: #22