# Code-MCP
Code-MCP is a comprehensive Model Context Protocol server providing tools for file operations, code generation, and project management.
## Languages
- TypeScript
## MCP Tool Enforcement
> [!IMPORTANT]
> You are working in the `Code-MCP` repository. You MUST prioritize using the MCP tools provided by the `code-mcp` server for your tasks.
>
> **Available Tools & Capabilities:**
>
> - **Code Generation**: `generate_snippet`, `generate_k8s_manifest`, `generate_terraform_config`, `generate_nginx_config`, `generate_package_json`, `generate_dockerfile`, `generate_env_template`, `generate_terraform_resource`, `generate_observability_config`, `generate_api_client`, `typescript_helper`, `sql_helper`
> - **Scaffolding**: `full_stack_scaffold`, `track_project`, `generate_github_actions`, `developer_rules`, `enforce_project_standards`
> - **IDE Configs**: `generate_continue_config`, `generate_tabnine_config`, `generate_vscode_tasks`, `generate_vscode_launch`, `generate_jetbrains_config`, `generate_cursor_rules`, `generate_windsurf_config`
> - **Analysis & Quality**: `analyze_complexity`, `security_scan`, `lint_code`, `validate_code`, `check_imports`, `check_dependencies`, `project_profiler`, `analyze_python_ast`, `check_python_deps`, `analyze_go_mod`
> - **Filesystem & Git**: `list_files`, `read_file_snippet`, `search_files`, `get_file_tree`, `git_helper`
> - **Memory**: `save_memory`, `read_memory`, `list_memories`, `clear_memory`
> - **Thinking & Planning**: `sequential_thinking`, `plan_task`, `define_user_stories`, `create_personas`, `perform_market_analysis`, `visualize_system`, `generate_diagram`, `suggest_tool_chain`
> - **Communication**: `generate_commit_message`, `generate_pr_description`, `update_changelog`
> - **Data & Context**: `convert_format`, `generate_mock_data`, `summarize_files`, `aggregate_context`, `get_template`
> - **Documentation**: `generate_readme`, `generate_license`, `generate_documentation`, `generate_dashboard`
## Recommended Workflows
> [!TIP]
> **Combine tools for maximum effect:**
>
> 1. **New Feature**: `plan_task` → `sequential_thinking` → `generate_snippet` → `generate_tests`
> 2. **Refactoring**: `project_profiler` → `analyze_complexity` → `reflect_on_code` → `generate_tests`
> 3. **Debugging**: `debug_problem` → `read_file_snippet` → `search_files` → `explain_code`
> 4. **Project Setup**: `track_project` → `full_stack_scaffold` → `generate_readme` → `generate_github_actions`
> 5. **Documentation**: `track_project` → `summarize_files` → `generate_documentation` → `generate_dashboard`
## Coding Standards
- Follow TypeScript best practices
- Write clean, maintainable code
- Include error handling
- Add appropriate logging
## Project Structure
- Keep related files together
- Use consistent naming conventions
- Separate concerns appropriately
## Testing Requirements
- Write tests for new features
- Maintain test coverage
## Security
- Never expose secrets in code
- Validate all inputs
- Use secure dependencies
## Tool Development Standards (CRITICAL)
- **Logic Over Templates**: Tools must implement actual logic, heuristics, or data processing. Static string returns are strictly forbidden for "agentic" tools.
- **Verification**: Always verify new tools by running `npm test`.
- **Strict Exports**: Ensure all handlers and schemas are exported from their source files AND `src/index.ts` / `src/server.ts`.
- **Test Integrity**: Verify that tests import handlers from the actual source, not a mock or undefined reference.
## Deployment Standards
- **Entrypoints**: Cloud deployments often require HTTP servers (`server.js`) for health checks, while local tools use stdio (`index.js`).
- **Health Checks**: Always ensure `/health` endpoint is exposed and accessible on the correct port (usually 3000 or 8080).
- **Environment**: Use `.env.example` to document all required variables. Never commit secrets.
## Agentic Capabilities & Learnings (NEW)
> [!TIP]
> **Logic Refinement**:
>
> - **Validation**: Tools like `sequential_thinking` now validate step counts and check thought complexity.
> - **Context Awareness**: `plan_task` generates dynamic checklists based on tech stack (React, SQL, Auth, etc.).
> - **Expert Systems**: `suggest_tool_chain` uses a rule-based engine to propose tailored workflows (Refactor vs New Feature vs DevOps).
> - **Pattern**: Always prefer robust internal logic over static template returns.
> [!TIP]
> **Self-Improvement**:
>
> - **Strategy**: Use `project_profiler` or `six_thinking_hats` to identify gaps.
> - **Execution**: Build the missing tool, test it, and register it.
> - **Example**: We built `generate_documentation` and `generate_dashboard` to fix identified gaps.
> [!TIP]
> **Deployment Stability**:
>
> - **Root Route**: Cloud deployments must have a `/` handler in `src/server.ts`.
> [!TIP]
> **Agentic CI/CD (Self-Healing)**:
>
> - **Concept**: Enable the codebase to analyze and fix itself using its own tools in a CI/CD pipeline.
> - **Implementation**: Create a script (e.g., `src/scripts/dependabot-agent.ts`) that imports internal tool handlers directly (e.g., `securityScanHandler`).
> - **Workflow**: Trigger this script via GitHub Actions (e.g., on Dependabot PRs) to perform autonomous checks/fixes.
> [!TIP]
> **Advanced Tool intelligence**:
>
> - **Intent Detection**: Tools like `suggest_tool_chain` now use regex-based intent classification (Refactor, Debug, Docs, Deploy, Test) to suggest specific workflows.
> - **Dynamic Verification**: `security_scan` and `reflect_on_code` use regex patterns and heuristics to provide actual analysis, not just placeholders.
> - **Smart Profiling**: `project_profiler` checks for specific configuration files (tsconfig, Dockerfile, etc.) to offer relevant quick wins.
>
> **Autonomous "Fix It" Capability**:
> The system is evolving to not just suggest, but _orchestrate_ fixes.
>
> - **Workflow**: User input -> Intent Detection -> Tool Chain Proposal -> Execution.
> - **Goal**: Enable simple "fix this" commands to trigger complex, safe, multi-step repairs.