mitmproxy2swagger is a tool for automatically converting network traffic captures into OpenAPI 3.0 specifications.
The tool solves the problem of reverse-engineering REST APIs without access to their documentation. It works by capturing HTTP traffic through mitmproxy or browser DevTools, then processing that traffic in two passes: the first pass extracts endpoints and parameters from the captured requests and responses, marking them with an ignore prefix; the second pass generates endpoint descriptions after you manually review and enable the endpoints you want included. The tool can merge data from multiple capture sessions and extend existing schemas incrementally.
This tool suits developers who need to understand or document undocumented APIs, integrate with third-party services without public specifications, or generate baseline API documentation from live application behavior. It works with traffic captured via mitmproxy's web interface or exported as HAR files from browser DevTools. The two-pass workflow gives you control over what gets included in the final specification, preventing noise from unrelated requests. Be aware that the optional flags for adding example data and headers can expose sensitive information like tokens or passwords, so use them cautiously.
The project shows active maintenance with regular updates addressing user needs. Development includes responsiveness to feature requests, as evidenced by the addition of HAR file support. The codebase demonstrates attention to practical usability concerns, such as the ability to safely merge multiple traffic captures and preserve manual edits across runs.