Skip to content

Conversation

@markomanninen
Copy link
Owner

🎉 Major Features

Full Web Application Debugging

  • HTTP-triggered breakpoints for Flask, Django, and FastAPI applications
  • Launch web servers under debugger control with dap_launch
  • Pause execution on HTTP requests and inspect request handlers interactively
  • Complete automated test suite demonstrating the workflow

New Examples & Documentation

  • examples/web_flask/run_flask.py - Flask app launcher for debugging
  • tests/test_web_app_debug.py - Comprehensive automated tests (2 tests, both passing)
  • docs/DEBUGGING_WEB_APPS.md - Complete guide for web app debugging
  • Enhanced AI agent instructions in agent_instructions.md

⚠️ Breaking Changes

Removed dap_attach()

The dap_attach approach was investigated but does not work with debugpy. When you run python -m debugpy --listen, debugpy does not respond to DAP attach requests.

Migration: Use dap_launch for ALL debugging scenarios:

  • ✅ Web servers (Flask/Django/FastAPI)
  • ✅ GUI applications
  • ✅ Command-line scripts
  • ✅ Long-running processes

✨ What's New

Files Added

  • examples/web_flask/run_flask.py - Flask debugging launcher
  • examples/gui_counter/run_counter_debug.py - GUI counter launcher
  • tests/test_web_app_debug.py - Automated web app debugging tests
  • docs/DEBUGGING_WEB_APPS.md - Comprehensive debugging guide
  • .envrc - Auto-activate venv with direnv

Documentation Updates

  • agent_instructions.md: Added "Debugging Web Applications" section
  • docs/mcp_usage.md: Updated with web app debugging examples
  • examples/web_flask/README.md: Complete rewrite with correct workflow
  • examples/gui_counter/README.md: Added GUI debugging instructions

🔧 Improvements

Code Quality

  • Removed 187 lines of non-functional dap_attach code
  • Removed DirectDAPClient class and all attach mode logic
  • Fixed all ruff, black, and mypy linting issues
  • Added types-aiofiles for proper type checking

Testing

  • 9/9 tests passing (up from 7)
  • 2 new web app debugging tests
  • Tests verify HTTP-triggered breakpoints and loop iteration debugging

Developer Experience

  • .envrc for automatic venv activation with direnv
  • VSCode settings configured to use .venv by default
  • Improved pre-commit hooks

📊 Test Results

All 9 tests passing in 45.57s

🚀 Ready to Merge

This PR is ready for review and merge. All tests pass, documentation is comprehensive, and the code has been thoroughly cleaned up.

google-labs-jules bot and others added 4 commits October 31, 2025 05:03
This commit introduces several security and optimization enhancements to the MCP server.

Security:
- Disabled the `run_in_terminal` function to prevent arbitrary code execution.
- Added path traversal protection to the `read_text_file` function.
- Sanitized input for the `run_tests_json` function to prevent command injection.

Optimization:
- Cached the Python executable path to avoid redundant searches.
- Cached agent instructions to avoid redundant file reads.
- Made the `read_text_file` function asynchronous to prevent blocking the event loop.
This commit implements full web application debugging support using dap_launch
and removes all non-functional dap_attach code, cleaning up the codebase.

## Key Changes

### Web App Debugging Implementation
- Added Flask debugging example with launcher script (examples/web_flask/run_flask.py)
- Created comprehensive automated tests (tests/test_web_app_debug.py)
- Demonstrates HTTP-triggered breakpoints in web applications
- Tests verify breakpoint hits in loops and variable inspection

### Code Cleanup
- Removed dap_attach() function (187 lines) - does not work with debugpy
- Removed DirectDAPClient references from mcp_server.py
- Simplified StdioDAPClient to launch-only mode
- Deleted non-functional attach mode logic

### Documentation Updates
- agent_instructions.md: Added "Debugging Web Applications" section
- docs/mcp_usage.md: Updated with web app debugging workflow
- docs/DEBUGGING_WEB_APPS.md: New comprehensive guide
- examples/web_flask/README.md: Complete rewrite with correct workflow
- examples/gui_counter/README.md: Added GUI debugging instructions

### New Files
- examples/web_flask/run_flask.py: Flask launcher for debugging
- examples/gui_counter/run_counter_debug.py: GUI counter launcher
- tests/test_web_app_debug.py: Automated web app debugging tests
- docs/DEBUGGING_WEB_APPS.md: Comprehensive debugging guide

### Linting & Configuration
- Fixed ruff, black, and mypy linting issues
- Updated .pre-commit-config.yaml to exclude examples from mypy
- Updated pyproject.toml with explicit package bases configuration
- Added types-aiofiles for proper type checking

### Why dap_attach was removed
The dap_attach approach was investigated but does not work with debugpy.
When you run `python -m debugpy --listen`, debugpy does not work with debugpy does not respond to
DAP attach requests. dap_launch is the unified solution for all debugging
scenarios including web servers, GUI apps, and scripts.

### Test Results
All 9 tests passing:
- 7 core tests (mcp_server, cli, end-to-end)
- 2 new web app debugging tests

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

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@markomanninen markomanninen merged commit 88f30bb into main Oct 31, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants