Commit Graph

10 Commits

Author SHA1 Message Date
Luis Erlacher
e2e1201d62 feat: Enhance Playwright and MCP configuration for Kubernetes deployment
Some checks failed
Build Images / build-server-docker (push) Has been cancelled
Build Images / build-mcp-docker (push) Has been cancelled
Build Images / build-agents-docker (push) Has been cancelled
Build Images / build-frontend-docker (push) Has been cancelled
Build Images / build-server-k8s (push) Has been cancelled
Build Images / build-mcp-k8s (push) Has been cancelled
Build Images / build-agents-k8s (push) Has been cancelled
Build Images / build-frontend-k8s (push) Has been cancelled
- Updated docker-compose.yml to include PLAYWRIGHT_BROWSERS_PATH and MCP_PUBLIC_URL environment variables.
- Modified k8s-manifests-complete.yaml to add Playwright and MCP configurations in the ConfigMap and deployment spec.
- Adjusted resource limits in k8s manifests for improved performance during crawling.
- Updated Dockerfiles to install Playwright browsers in accessible locations for appuser.
- Added HTTP health check endpoint in mcp_server.py for better monitoring.
- Enhanced MCP API to utilize MCP_PUBLIC_URL for generating client configuration.
- Created MCP_PUBLIC_URL_GUIDE.md for detailed configuration instructions.
- Documented changes and recommendations in K8S_COMPLETE_ADJUSTMENTS.md.
2025-11-04 15:38:32 -03:00
462d1267c7 fix(mcp): Implement HTTP /health endpoint using FastMCP's custom_route API
Some checks are pending
Build Images / build-server-docker (push) Waiting to run
Build Images / build-mcp-docker (push) Blocked by required conditions
Build Images / build-agents-docker (push) Blocked by required conditions
Build Images / build-frontend-docker (push) Blocked by required conditions
Build Images / build-server-k8s (push) Blocked by required conditions
Build Images / build-mcp-k8s (push) Blocked by required conditions
Build Images / build-agents-k8s (push) Blocked by required conditions
Build Images / build-frontend-k8s (push) Blocked by required conditions
Fixed the health endpoint implementation using the correct FastMCP API:
- Use @mcp.custom_route('/health', methods=['GET']) instead of mcp.create_app()
- Returns 200 when healthy, 503 when starting/degraded
- Provides full health status (api_service, agents_service, uptime)

The previous attempt used mcp.create_app() which doesn't exist in FastMCP 1.12.2.
FastMCP's correct API for custom HTTP endpoints is @mcp.custom_route().

Fixes frontend getting 404 errors on GET /health
2025-10-28 12:53:54 -03:00
c581c8a9bb fix(mcp): Add HTTP /health endpoint for frontend health checks
Some checks are pending
Build Images / build-server-docker (push) Waiting to run
Build Images / build-mcp-docker (push) Blocked by required conditions
Build Images / build-agents-docker (push) Blocked by required conditions
Build Images / build-frontend-docker (push) Blocked by required conditions
Build Images / build-server-k8s (push) Blocked by required conditions
Build Images / build-mcp-k8s (push) Blocked by required conditions
Build Images / build-agents-k8s (push) Blocked by required conditions
Build Images / build-frontend-k8s (push) Blocked by required conditions
The MCP only had health_check as an MCP tool, not as an HTTP endpoint.
Frontend was getting 404 when trying GET /health.

Added FastAPI route /health that returns:
- 200 when healthy with full health status
- 503 when starting/degraded with status message

Fixes frontend MCP status dashboard showing 'unhealthy'
2025-10-28 12:24:51 -03:00
Cole Medin
c3be65322b
Improved MCP and global rules instructions (#705) 2025-09-20 12:58:20 -05:00
Cole Medin
34a51ec362
feat: MCP server optimization with tool consolidation and vertical sl… (#647)
* feat: MCP server optimization with tool consolidation and vertical slice architecture

- Consolidated MCP tools from ~20 to 8 tools for improved UX
- Restructured to vertical slice architecture (features/domain pattern)
- Optimized payload sizes with truncation and array count replacements
- Changed default include_closed to true for better task visibility
- Moved RAG module to features directory structure
- Removed legacy modules directory in favor of feature-based organization

Key improvements:
- list_tasks, manage_task (create/update/delete consolidated)
- list_projects, manage_project (create/update/delete consolidated)
- list_documents, manage_document (create/update/delete consolidated)
- list_versions, manage_version (create/restore consolidated)
- Reduced default page size from 50 to 10 items
- Added search query support to list operations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: Consolidate MCP tools and rename list_* to find_*

Major refactoring of MCP tools to reduce complexity and improve naming:

## Tool Consolidation (22 → ~10 tools)
- Consolidated CRUD operations into two tools per domain:
  - find_[resource]: Handles list, search, and get single item
  - manage_[resource]: Handles create, update, delete with "action" parameter
- Removed backward compatibility/legacy function mappings
- Optimized response payloads with truncation (1000 char limit for projects/tasks)

## Renamed Functions
- list_projects → find_projects
- list_tasks → find_tasks
- list_documents → find_documents
- list_versions → find_versions

## Bug Fixes
- Fixed supabase query chaining bug where .or_() calls overwrote previous conditions
- Fixed search implementation to handle single vs multiple terms correctly

## Test Updates
- Updated all tests to use new consolidated tools
- Removed problematic test_consolidated_tools.py
- Fixed error type assertions to match actual responses
- All 44 tests passing

## Documentation Updates
- Updated CLAUDE.md with new tool names and patterns
- Updated MCP instructions with consolidated tool examples
- Added guidance to avoid backward compatibility code

## API Changes
- Updated API route defaults: include_closed=True, per_page=10
- Aligned defaults with consolidated tool implementations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-13 10:52:14 -05:00
Rasmus Widing
26a933288f style(mcp): Clean up whitespace in MCP instructions
- Remove trailing whitespace
- Consistent formatting in instruction text
2025-08-21 22:11:10 +03:00
Rasmus Widing
28eede38b5 fix(mcp): Fix update_task signature and MCP instructions
Resolves #420 - Tasks being duplicated instead of updated

Changes:
1. Fixed update_task function signature to use individual optional parameters
   - Changed from TypedDict to explicit parameters (title, status, etc.)
   - Consistent with update_project and update_document patterns
   - Builds update_fields dict internally from provided parameters

2. Updated MCP instructions with correct function names
   - Replaced non-existent manage_task with actual functions
   - Added complete function signatures for all tools
   - Improved workflow documentation with concrete examples

This fixes the issue where AI agents were confused by:
- Wrong function names in instructions (manage_task vs update_task)
- Inconsistent parameter patterns across update functions
- TypedDict magic that wasn't clearly documented

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 22:11:10 +03:00
Rasmus Widing
cf3d7b17fe feat(mcp): Add robust error handling and timeout configuration
Critical improvements to MCP server reliability and client experience:

Error Handling:
- Created MCPErrorFormatter for consistent error responses across all tools
- Provides structured errors with type, message, details, and actionable suggestions
- Helps clients (like Claude Code) understand and handle failures gracefully
- Categorizes errors (connection_timeout, validation_error, etc.) for better debugging

Timeout Configuration:
- Centralized timeout config with environment variable support
- Different timeouts for regular operations vs polling operations
- Configurable via MCP_REQUEST_TIMEOUT, MCP_CONNECT_TIMEOUT, etc.
- Prevents indefinite hangs when services are unavailable

Module Registration:
- Distinguishes between ImportError (acceptable) and code errors (must fix)
- SyntaxError/NameError/AttributeError now halt execution immediately
- Prevents broken code from silently failing in production

Polling Safety:
- Fixed project creation polling with exponential backoff
- Handles API unavailability with proper error messages
- Maximum attempts configurable via MCP_MAX_POLLING_ATTEMPTS

Response Normalization:
- Fixed inconsistent response handling in list_tasks
- Validates and normalizes different API response formats
- Clear error messages when response format is unexpected

These changes address critical issues from PR review while maintaining
backward compatibility. All 20 existing tests pass.
2025-08-19 15:38:13 +03:00
Rasmus Widing
52f54699e9 Register all separated tools in MCP server
Update MCP server to use the new modular tool structure:
- Projects and tasks from existing modules
- Documents and versions from new modules
- Feature management from standalone module

Remove all feature flag logic as separated tools are now default.
2025-08-18 20:42:36 +03:00
Rasmus Widing
1f03b40af1 Refactor MCP server structure and add separate project tools
- Rename src/mcp to src/mcp_server for clarity
- Update all internal imports to use new path
- Create features/projects directory for modular tool organization
- Add separate, simple project tools (create, list, get, delete, update)
- Keep consolidated tools for backward compatibility (via env var)
- Add USE_SEPARATE_PROJECT_TOOLS env var to toggle between approaches

The new separate tools:
- Solve the async project creation context loss issue
- Provide clearer, single-purpose interfaces
- Remove complex PRP examples for simplicity
- Handle project creation polling automatically
2025-08-18 15:55:00 +03:00