mcp-debugger 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_debugger-0.1.0/.gitignore +18 -0
- mcp_debugger-0.1.0/CHANGELOG.md +106 -0
- mcp_debugger-0.1.0/CONTRIBUTING.md +75 -0
- mcp_debugger-0.1.0/LICENSE +21 -0
- mcp_debugger-0.1.0/PKG-INFO +207 -0
- mcp_debugger-0.1.0/README.md +160 -0
- mcp_debugger-0.1.0/docs/00-project-charter.md +22 -0
- mcp_debugger-0.1.0/docs/01-architecture-deep.md +96 -0
- mcp_debugger-0.1.0/docs/02-data-models-detailed.md +158 -0
- mcp_debugger-0.1.0/docs/03-database-schema.md +153 -0
- mcp_debugger-0.1.0/docs/04-25-day-plan-detailed.md +232 -0
- mcp_debugger-0.1.0/docs/05-mcp-protocol-reference.md +226 -0
- mcp_debugger-0.1.0/docs/06-production-standards.md +100 -0
- mcp_debugger-0.1.0/docs/07-glossary.md +60 -0
- mcp_debugger-0.1.0/docs/08-faq.md +51 -0
- mcp_debugger-0.1.0/docs/AI_INSTRUCTIONS.md +56 -0
- mcp_debugger-0.1.0/docs/README.md +24 -0
- mcp_debugger-0.1.0/docs/architecture.md +227 -0
- mcp_debugger-0.1.0/docs/commands.md +567 -0
- mcp_debugger-0.1.0/docs/compatibility.md +36 -0
- mcp_debugger-0.1.0/docs/config.md +221 -0
- mcp_debugger-0.1.0/docs/contributing.md +111 -0
- mcp_debugger-0.1.0/docs/diagrams/README.md +142 -0
- mcp_debugger-0.1.0/docs/faq.md +215 -0
- mcp_debugger-0.1.0/docs/replay.md +117 -0
- mcp_debugger-0.1.0/docs/tutorials.md +344 -0
- mcp_debugger-0.1.0/pyproject.toml +106 -0
- mcp_debugger-0.1.0/scripts/check_version.py +72 -0
- mcp_debugger-0.1.0/scripts/stress_test.py +147 -0
- mcp_debugger-0.1.0/scripts/test_real_servers.py +433 -0
- mcp_debugger-0.1.0/src/mcp_debugger/__init__.py +5 -0
- mcp_debugger-0.1.0/src/mcp_debugger/analytics.py +443 -0
- mcp_debugger-0.1.0/src/mcp_debugger/cli.py +2185 -0
- mcp_debugger-0.1.0/src/mcp_debugger/config.py +377 -0
- mcp_debugger-0.1.0/src/mcp_debugger/display/__init__.py +0 -0
- mcp_debugger-0.1.0/src/mcp_debugger/exporters/__init__.py +6 -0
- mcp_debugger-0.1.0/src/mcp_debugger/exporters/json_exporter.py +178 -0
- mcp_debugger-0.1.0/src/mcp_debugger/exporters/markdown_exporter.py +196 -0
- mcp_debugger-0.1.0/src/mcp_debugger/exporters/otlp_exporter.py +206 -0
- mcp_debugger-0.1.0/src/mcp_debugger/exporters/otlp_replay_exporter.py +221 -0
- mcp_debugger-0.1.0/src/mcp_debugger/protocol/__init__.py +0 -0
- mcp_debugger-0.1.0/src/mcp_debugger/protocol/error_classifier.py +108 -0
- mcp_debugger-0.1.0/src/mcp_debugger/protocol/schemas.py +92 -0
- mcp_debugger-0.1.0/src/mcp_debugger/protocol/validator.py +471 -0
- mcp_debugger-0.1.0/src/mcp_debugger/proxy/__init__.py +0 -0
- mcp_debugger-0.1.0/src/mcp_debugger/proxy/stdio_proxy.py +408 -0
- mcp_debugger-0.1.0/src/mcp_debugger/py.typed +1 -0
- mcp_debugger-0.1.0/src/mcp_debugger/replay/__init__.py +14 -0
- mcp_debugger-0.1.0/src/mcp_debugger/replay/diff.py +168 -0
- mcp_debugger-0.1.0/src/mcp_debugger/replay/engine.py +446 -0
- mcp_debugger-0.1.0/src/mcp_debugger/storage/__init__.py +0 -0
- mcp_debugger-0.1.0/src/mcp_debugger/storage/database.py +959 -0
- mcp_debugger-0.1.0/src/mcp_debugger/validate_live.py +250 -0
- mcp_debugger-0.1.0/src/mcp_debugger/version.py +3 -0
- mcp_debugger-0.1.0/tests/__init__.py +0 -0
- mcp_debugger-0.1.0/tests/conftest.py +54 -0
- mcp_debugger-0.1.0/tests/mock_servers/echo_server.py +29 -0
- mcp_debugger-0.1.0/tests/test_cli/test_cli_config.py +122 -0
- mcp_debugger-0.1.0/tests/test_cli/test_cli_edge_cases.py +1446 -0
- mcp_debugger-0.1.0/tests/test_cli/test_export.py +117 -0
- mcp_debugger-0.1.0/tests/test_cli/test_inspect.py +437 -0
- mcp_debugger-0.1.0/tests/test_cli/test_list.py +85 -0
- mcp_debugger-0.1.0/tests/test_cli/test_proxy.py +28 -0
- mcp_debugger-0.1.0/tests/test_cli/test_replay.py +195 -0
- mcp_debugger-0.1.0/tests/test_cli/test_stats.py +540 -0
- mcp_debugger-0.1.0/tests/test_cli/test_validate.py +402 -0
- mcp_debugger-0.1.0/tests/test_config/test_config.py +386 -0
- mcp_debugger-0.1.0/tests/test_exporters/test_json.py +191 -0
- mcp_debugger-0.1.0/tests/test_exporters/test_markdown.py +110 -0
- mcp_debugger-0.1.0/tests/test_exporters/test_otlp.py +399 -0
- mcp_debugger-0.1.0/tests/test_integration/test_integration.py +350 -0
- mcp_debugger-0.1.0/tests/test_property.py +126 -0
- mcp_debugger-0.1.0/tests/test_protocol/test_error_classifier.py +142 -0
- mcp_debugger-0.1.0/tests/test_protocol/test_schemas.py +190 -0
- mcp_debugger-0.1.0/tests/test_protocol/test_validator.py +416 -0
- mcp_debugger-0.1.0/tests/test_proxy/test_stdio_proxy.py +774 -0
- mcp_debugger-0.1.0/tests/test_replay/test_diff.py +134 -0
- mcp_debugger-0.1.0/tests/test_replay/test_engine.py +486 -0
- mcp_debugger-0.1.0/tests/test_storage/test_database.py +809 -0
- mcp_debugger-0.1.0/tests/test_stress.py +294 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `mcp-debugger` are documented here.
|
|
4
|
+
|
|
5
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
+
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.1.0] โ 2026-06-29
|
|
11
|
+
|
|
12
|
+
Initial release. Full-featured MCP session debugger with proxy recording, inspection, validation, replay, export, and analytics.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
#### Core Proxy
|
|
17
|
+
- `proxy` command: transparent asyncio stdio proxy that records all MCP JSON-RPC messages to SQLite
|
|
18
|
+
- Session naming via `--name` / `-n`
|
|
19
|
+
- Verbose logging via `--verbose` / `-v`
|
|
20
|
+
- Graceful shutdown on `Ctrl+C` / EOF with guaranteed database cleanup (`try...finally`)
|
|
21
|
+
- 10 MB `StreamReader` limit to handle large MCP payloads without crashing
|
|
22
|
+
|
|
23
|
+
#### Session Management
|
|
24
|
+
- `list` command: browse historical sessions with status, message count, and timestamps
|
|
25
|
+
- Filter by status (`running`, `completed`, `error`) and limit via `--limit`
|
|
26
|
+
- JSON output mode (`--json`) for scripting and automation
|
|
27
|
+
|
|
28
|
+
#### Inspection
|
|
29
|
+
- `inspect` command: syntax-highlighted, formatted message browser using Rich
|
|
30
|
+
- Filter by method name (`--method`), direction (`--direction`), substring (`--search`)
|
|
31
|
+
- Pagination via `--limit` and `--offset`
|
|
32
|
+
- Output to file via `--output`
|
|
33
|
+
|
|
34
|
+
#### Protocol Validation
|
|
35
|
+
- `validate` command: rule-based MCP protocol compliance checker
|
|
36
|
+
- Live server validation (`--server`) and recorded session validation (`SESSION_ID`)
|
|
37
|
+
- Rules: handshake order, method name validity, tool schema format (JSON Schema Draft-07), error code validity
|
|
38
|
+
- JSON output for CI/CD integration (`--json`)
|
|
39
|
+
- Exit code `0` (pass) / `1` (critical failure)
|
|
40
|
+
|
|
41
|
+
#### Analytics
|
|
42
|
+
- `stats` command: comprehensive session dashboard โ message counts, latency (p50/p95/p99), tool usage, error rates
|
|
43
|
+
- `compare` command: delta report between two sessions โ latency regression, error rate changes, new/missing tools
|
|
44
|
+
- `errors` command: classified error list with category filter (`protocol`, `tool_execution`, `timeout`, `connection`, `unknown`)
|
|
45
|
+
- `tools` command: discovered tool list with call counts; full schema view via `--detail`
|
|
46
|
+
|
|
47
|
+
#### Replay & Regression Testing
|
|
48
|
+
- `replay` command: re-sends recorded client messages to a target server, compares responses with inline diffs
|
|
49
|
+
- Filter by method (`--filter-method`), limit messages (`--max-messages`), custom timeout (`--timeout`)
|
|
50
|
+
- JSON report output (`--json`) and file output (`--output`)
|
|
51
|
+
- Save replay results to database (`--save`)
|
|
52
|
+
- Exit codes: `0` (all match) / `1` (mismatches) / `2` (server crash)
|
|
53
|
+
|
|
54
|
+
#### Export
|
|
55
|
+
- `export` command with three formats:
|
|
56
|
+
- **JSON** โ structured machine-readable dump
|
|
57
|
+
- **Markdown** โ human-readable report with optional raw message blocks (`--include-raw`)
|
|
58
|
+
- **OTLP** โ OpenTelemetry traces sent to a Jaeger/Grafana/DataDog collector
|
|
59
|
+
- Per-format options: `--output`, `--pretty`, `--endpoint`, `--insecure`, `--service-name`, `--limit`
|
|
60
|
+
- OTLP requires optional install: `pip install "mcp-debugger[export]"`
|
|
61
|
+
|
|
62
|
+
#### Configuration
|
|
63
|
+
- `config` command with subcommands: `init`, `get`, `set`, `unset`, `list`, `reset`
|
|
64
|
+
- TOML config file at `~/.mcp-debugger/config.toml` (Linux/macOS) or `%APPDATA%\mcp-debugger\config.toml` (Windows)
|
|
65
|
+
- Dot-notation keys: `replay.timeout`, `aliases.fs`, `export.default_format`, etc.
|
|
66
|
+
- Server aliases for short-hand replay and proxy usage
|
|
67
|
+
- Graceful fallback to defaults on missing or corrupt config file
|
|
68
|
+
- CLI flag always overrides config file value
|
|
69
|
+
|
|
70
|
+
#### Environment Diagnostics
|
|
71
|
+
- `doctor` command: checks Python version, SQLite version, database directory, file permissions, schema version, Node.js, npx, git, PATH, config validity
|
|
72
|
+
- Exit code `0` (all good) / `1` (critical failure)
|
|
73
|
+
|
|
74
|
+
#### Storage
|
|
75
|
+
- SQLite database with 6 tables: `sessions`, `messages`, `tools`, `errors`, `replays`, `replay_messages`
|
|
76
|
+
- Async access via `aiosqlite` โ non-blocking, event-loop friendly
|
|
77
|
+
- Schema version tracking via `PRAGMA user_version = 1`
|
|
78
|
+
- WAL mode for safe concurrent access
|
|
79
|
+
|
|
80
|
+
#### Test Suite
|
|
81
|
+
- 247 tests across unit, integration, property-based, and stress categories
|
|
82
|
+
- **96.54% line coverage**
|
|
83
|
+
- Tests run on Python 3.11 and 3.12, Ubuntu and Windows via GitHub Actions
|
|
84
|
+
- Property-based tests using `hypothesis` for schema round-trips and diff symmetry
|
|
85
|
+
- Stress tests: 10k-message sessions, large payload (50 MB), concurrent proxies
|
|
86
|
+
|
|
87
|
+
#### Documentation
|
|
88
|
+
- `README.md` with badges, feature overview, quickstart, and links
|
|
89
|
+
- `docs/commands.md` โ full command reference with all options and examples
|
|
90
|
+
- `docs/architecture.md` โ component overview, data flow, design decisions
|
|
91
|
+
- `docs/tutorials.md` โ 5 step-by-step workflow guides
|
|
92
|
+
- `docs/faq.md` โ 15+ Q&As covering installation, usage, and troubleshooting
|
|
93
|
+
- `docs/config.md` โ full configuration key reference
|
|
94
|
+
- `docs/contributing.md` โ development setup, test structure, CI details
|
|
95
|
+
- `CONTRIBUTING.md` โ contributor quick-start
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Roadmap
|
|
100
|
+
|
|
101
|
+
These features are planned for future releases:
|
|
102
|
+
|
|
103
|
+
- **v0.2.0** โ PyPI publish, `pip install mcp-debugger` from the public index
|
|
104
|
+
- **v0.3.0** โ Web UI for browsing sessions in a browser (optional, via `mcp-debugger serve`)
|
|
105
|
+
- **v0.4.0** โ Diff ignore paths configuration for non-deterministic replay fields
|
|
106
|
+
- **v0.5.0** โ MCP schema version tracking and automatic upgrade migrations
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Contributing Guidelines
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to **MCP Debugger**! This document outlines the development workflow, code style standards, and tooling instructions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Development Environment Setup
|
|
8
|
+
|
|
9
|
+
This project uses `uv` for package management and Python 3.11+.
|
|
10
|
+
|
|
11
|
+
### Step 1: Clone the Repository
|
|
12
|
+
```bash
|
|
13
|
+
git clone https://github.com/sushant-mutnale/mcp-debugger.git
|
|
14
|
+
cd mcp-debugger
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Step 2: Set Up Virtual Environment & Dependencies
|
|
18
|
+
Initialize and activate your environment, then install in editable mode with development dependencies:
|
|
19
|
+
```bash
|
|
20
|
+
# Using uv (recommended)
|
|
21
|
+
uv venv
|
|
22
|
+
source .venv/bin/activate # Or .venv\Scripts\activate on Windows
|
|
23
|
+
uv pip install -e .[dev]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Step 3: Run Verification Commands
|
|
27
|
+
Verify that the CLI package is installed correctly and tests run green:
|
|
28
|
+
```bash
|
|
29
|
+
mcp-debugger version
|
|
30
|
+
pytest
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. Code Quality & Standards
|
|
36
|
+
|
|
37
|
+
We enforce strict linting, formatting, and static analysis checks to maintain code safety:
|
|
38
|
+
|
|
39
|
+
- **Style & Formatter**: We use `ruff` for code linting and formatting. Run these before pushing changes:
|
|
40
|
+
```bash
|
|
41
|
+
ruff check src/ tests/
|
|
42
|
+
ruff format src/ tests/
|
|
43
|
+
```
|
|
44
|
+
- **Type Safety**: Code must pass strict `mypy` audits:
|
|
45
|
+
```bash
|
|
46
|
+
mypy src/ tests/
|
|
47
|
+
```
|
|
48
|
+
- **Logging**:
|
|
49
|
+
- Always log internal debug/info data to `sys.stderr` or file-handlers.
|
|
50
|
+
- Do not use print statements or log to `sys.stdout` in the proxy logic, as this corrupts standard I/O communication between client and server.
|
|
51
|
+
- **Error Handling**:
|
|
52
|
+
- Avoid bare `except:` statements.
|
|
53
|
+
- Fail loudly on critical startup bugs (like failing to launch the subprocess) and retry transient errors (like sqlite lock errors).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 3. Git & Pull Request Workflow
|
|
58
|
+
|
|
59
|
+
1. Create a descriptive feature branch from `main`:
|
|
60
|
+
```bash
|
|
61
|
+
git checkout -b feature/your-feature-name
|
|
62
|
+
```
|
|
63
|
+
2. Make your edits and include comprehensive unit/integration tests under `tests/`.
|
|
64
|
+
3. Verify that all linting, formatting, type checking, and tests pass successfully:
|
|
65
|
+
```bash
|
|
66
|
+
ruff check src/ tests/
|
|
67
|
+
ruff format src/ tests/ --check
|
|
68
|
+
mypy src/ tests/
|
|
69
|
+
pytest
|
|
70
|
+
```
|
|
71
|
+
4. Commit your changes with clear, imperative-style commit messages:
|
|
72
|
+
```bash
|
|
73
|
+
git commit -m "feat: add schema validator for initialize method"
|
|
74
|
+
```
|
|
75
|
+
5. Push to your branch and open a Pull Request.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sushant Mutnale
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-debugger
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Transparent proxy to debug, record, validate, and replay MCP (Model Context Protocol) sessions
|
|
5
|
+
Project-URL: Homepage, https://github.com/sushant-mutnale/mcp-debugger
|
|
6
|
+
Project-URL: Repository, https://github.com/sushant-mutnale/mcp-debugger
|
|
7
|
+
Project-URL: Documentation, https://github.com/sushant-mutnale/mcp-debugger#readme
|
|
8
|
+
Project-URL: Issues, https://github.com/sushant-mutnale/mcp-debugger/issues
|
|
9
|
+
Author-email: Sushant Mutnale <sushant.mutnale@gmail.com>
|
|
10
|
+
Maintainer-email: Sushant Mutnale <sushant.mutnale@gmail.com>
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
23
|
+
Classifier: Topic :: Software Development :: Testing
|
|
24
|
+
Classifier: Topic :: System :: Monitoring
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Requires-Dist: aiosqlite>=0.19.0
|
|
27
|
+
Requires-Dist: jsonschema>=4.0.0
|
|
28
|
+
Requires-Dist: pydantic>=2.5.0
|
|
29
|
+
Requires-Dist: rich>=13.7.0
|
|
30
|
+
Requires-Dist: tomli>=2.0.1; python_version < '3.11'
|
|
31
|
+
Requires-Dist: typer>=0.9.0
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: hypothesis>=6.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: mypy>=1.7.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-benchmark>=4.0.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
42
|
+
Provides-Extra: otlp
|
|
43
|
+
Requires-Dist: opentelemetry-api>=1.20.0; extra == 'otlp'
|
|
44
|
+
Requires-Dist: opentelemetry-exporter-otlp>=1.20.0; extra == 'otlp'
|
|
45
|
+
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'otlp'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# mcp-debugger
|
|
49
|
+
|
|
50
|
+
> Transparent proxy to **debug, record, validate, and replay** MCP (Model Context Protocol) sessions.
|
|
51
|
+
|
|
52
|
+
[](https://pypi.org/project/mcp-debugger/)
|
|
53
|
+
[](https://github.com/sushant-mutnale/mcp-debugger/actions/workflows/ci.yml)
|
|
54
|
+
[](https://pypi.org/project/mcp-debugger/)
|
|
55
|
+
[](https://opensource.org/licenses/MIT)
|
|
56
|
+
[](https://github.com/sushant-mutnale/mcp-debugger/actions)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## โจ Features
|
|
61
|
+
|
|
62
|
+
| Feature | What it does |
|
|
63
|
+
|---|---|
|
|
64
|
+
| ๐ **Record** | Capture every JSON-RPC message between an MCP client and server |
|
|
65
|
+
| ๐ **Inspect** | Browse messages with syntax-highlighted, formatted terminal output |
|
|
66
|
+
| โ
**Validate** | Check MCP protocol compliance โ handshake order, method names, schemas |
|
|
67
|
+
| ๐ **Replay** | Regression-test server changes by replaying recorded sessions |
|
|
68
|
+
| ๐ **Stats** | Visualise tool usage, latency trends, and error rates |
|
|
69
|
+
| ๐ **Compare** | Delta reports between two sessions (latency, errors, tool calls) |
|
|
70
|
+
| ๐ค **Export** | JSON, Markdown, or OpenTelemetry (OTLP) traces |
|
|
71
|
+
| โ๏ธ **Config** | Persistent user preferences โ aliases, timeouts, defaults |
|
|
72
|
+
| ๐ฉบ **Doctor** | Environment diagnostics โ Python version, SQLite, Node.js, paths |
|
|
73
|
+
| ๐ **Local-first** | No cloud, no signup โ all data stays on your machine |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## ๐ฆ Installation
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install mcp-debugger
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
With optional OpenTelemetry (OTLP) export support:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install "mcp-debugger[otlp]"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Requirements:** Python 3.11+, Node.js (for `npx`-based MCP servers)
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## ๐ Quickstart
|
|
94
|
+
|
|
95
|
+
### 1. Record a session
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
mcp-debugger proxy \
|
|
99
|
+
--server "npx -y @modelcontextprotocol/server-filesystem /tmp" \
|
|
100
|
+
--name "my-first-session"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Interact with your MCP client (e.g. Claude Desktop). Press `Ctrl+C` to stop.
|
|
104
|
+
|
|
105
|
+
### 2. List recorded sessions
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
mcp-debugger list
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Inspect a session
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
mcp-debugger inspect 1
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 4. Validate protocol compliance
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
mcp-debugger validate --server "npx -y @modelcontextprotocol/server-filesystem /tmp"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 5. Replay against a new server version
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
mcp-debugger replay 1 --server "npx -y @modelcontextprotocol/server-filesystem /tmp"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 6. Export to Markdown
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
mcp-debugger export 1 --format markdown --output session-report.md
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## ๐ง Use with Claude Desktop
|
|
138
|
+
|
|
139
|
+
Edit your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS, `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"mcpServers": {
|
|
144
|
+
"my-filesystem": {
|
|
145
|
+
"command": "mcp-debugger",
|
|
146
|
+
"args": [
|
|
147
|
+
"proxy",
|
|
148
|
+
"--server",
|
|
149
|
+
"npx -y @modelcontextprotocol/server-filesystem /path/to/dir",
|
|
150
|
+
"--name",
|
|
151
|
+
"claude-session"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Every message between Claude and your server is now recorded transparently.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## ๐ Documentation
|
|
163
|
+
|
|
164
|
+
| Document | Description |
|
|
165
|
+
|---|---|
|
|
166
|
+
| [Command Reference](docs/commands.md) | Every CLI command with all options and examples |
|
|
167
|
+
| [Architecture](docs/architecture.md) | How it works โ components, data flow, sequence diagrams |
|
|
168
|
+
| [Tutorials](docs/tutorials.md) | Step-by-step workflows for common use cases |
|
|
169
|
+
| [Configuration](docs/config.md) | All config keys, defaults, and examples |
|
|
170
|
+
| [FAQ](docs/faq.md) | Common questions and troubleshooting |
|
|
171
|
+
| [Contributing](docs/contributing.md) | Development setup, test structure, PR process |
|
|
172
|
+
| [Changelog](CHANGELOG.md) | Version history |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## ๐งช Development Setup
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
git clone https://github.com/sushant-mutnale/mcp-debugger.git
|
|
180
|
+
cd mcp-debugger
|
|
181
|
+
python -m venv .venv
|
|
182
|
+
source .venv/bin/activate # Linux/macOS
|
|
183
|
+
# or: .venv\Scripts\activate # Windows
|
|
184
|
+
pip install -e ".[dev]"
|
|
185
|
+
|
|
186
|
+
# Run all tests
|
|
187
|
+
pytest
|
|
188
|
+
|
|
189
|
+
# With coverage
|
|
190
|
+
pytest --cov=mcp_debugger --cov-report=term-missing
|
|
191
|
+
|
|
192
|
+
# Lint and type-check
|
|
193
|
+
ruff check .
|
|
194
|
+
mypy src/mcp_debugger --ignore-missing-imports
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## ๐ค Contributing
|
|
200
|
+
|
|
201
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions, coding style, and pull request process.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## ๐ License
|
|
206
|
+
|
|
207
|
+
MIT ยฉ [Sushant Mutnale](https://github.com/sushant-mutnale)
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# mcp-debugger
|
|
2
|
+
|
|
3
|
+
> Transparent proxy to **debug, record, validate, and replay** MCP (Model Context Protocol) sessions.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/mcp-debugger/)
|
|
6
|
+
[](https://github.com/sushant-mutnale/mcp-debugger/actions/workflows/ci.yml)
|
|
7
|
+
[](https://pypi.org/project/mcp-debugger/)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://github.com/sushant-mutnale/mcp-debugger/actions)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## โจ Features
|
|
14
|
+
|
|
15
|
+
| Feature | What it does |
|
|
16
|
+
|---|---|
|
|
17
|
+
| ๐ **Record** | Capture every JSON-RPC message between an MCP client and server |
|
|
18
|
+
| ๐ **Inspect** | Browse messages with syntax-highlighted, formatted terminal output |
|
|
19
|
+
| โ
**Validate** | Check MCP protocol compliance โ handshake order, method names, schemas |
|
|
20
|
+
| ๐ **Replay** | Regression-test server changes by replaying recorded sessions |
|
|
21
|
+
| ๐ **Stats** | Visualise tool usage, latency trends, and error rates |
|
|
22
|
+
| ๐ **Compare** | Delta reports between two sessions (latency, errors, tool calls) |
|
|
23
|
+
| ๐ค **Export** | JSON, Markdown, or OpenTelemetry (OTLP) traces |
|
|
24
|
+
| โ๏ธ **Config** | Persistent user preferences โ aliases, timeouts, defaults |
|
|
25
|
+
| ๐ฉบ **Doctor** | Environment diagnostics โ Python version, SQLite, Node.js, paths |
|
|
26
|
+
| ๐ **Local-first** | No cloud, no signup โ all data stays on your machine |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## ๐ฆ Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install mcp-debugger
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
With optional OpenTelemetry (OTLP) export support:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install "mcp-debugger[otlp]"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Requirements:** Python 3.11+, Node.js (for `npx`-based MCP servers)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## ๐ Quickstart
|
|
47
|
+
|
|
48
|
+
### 1. Record a session
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
mcp-debugger proxy \
|
|
52
|
+
--server "npx -y @modelcontextprotocol/server-filesystem /tmp" \
|
|
53
|
+
--name "my-first-session"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Interact with your MCP client (e.g. Claude Desktop). Press `Ctrl+C` to stop.
|
|
57
|
+
|
|
58
|
+
### 2. List recorded sessions
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
mcp-debugger list
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Inspect a session
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
mcp-debugger inspect 1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 4. Validate protocol compliance
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
mcp-debugger validate --server "npx -y @modelcontextprotocol/server-filesystem /tmp"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 5. Replay against a new server version
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
mcp-debugger replay 1 --server "npx -y @modelcontextprotocol/server-filesystem /tmp"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 6. Export to Markdown
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
mcp-debugger export 1 --format markdown --output session-report.md
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## ๐ง Use with Claude Desktop
|
|
91
|
+
|
|
92
|
+
Edit your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS, `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"my-filesystem": {
|
|
98
|
+
"command": "mcp-debugger",
|
|
99
|
+
"args": [
|
|
100
|
+
"proxy",
|
|
101
|
+
"--server",
|
|
102
|
+
"npx -y @modelcontextprotocol/server-filesystem /path/to/dir",
|
|
103
|
+
"--name",
|
|
104
|
+
"claude-session"
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Every message between Claude and your server is now recorded transparently.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## ๐ Documentation
|
|
116
|
+
|
|
117
|
+
| Document | Description |
|
|
118
|
+
|---|---|
|
|
119
|
+
| [Command Reference](docs/commands.md) | Every CLI command with all options and examples |
|
|
120
|
+
| [Architecture](docs/architecture.md) | How it works โ components, data flow, sequence diagrams |
|
|
121
|
+
| [Tutorials](docs/tutorials.md) | Step-by-step workflows for common use cases |
|
|
122
|
+
| [Configuration](docs/config.md) | All config keys, defaults, and examples |
|
|
123
|
+
| [FAQ](docs/faq.md) | Common questions and troubleshooting |
|
|
124
|
+
| [Contributing](docs/contributing.md) | Development setup, test structure, PR process |
|
|
125
|
+
| [Changelog](CHANGELOG.md) | Version history |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## ๐งช Development Setup
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git clone https://github.com/sushant-mutnale/mcp-debugger.git
|
|
133
|
+
cd mcp-debugger
|
|
134
|
+
python -m venv .venv
|
|
135
|
+
source .venv/bin/activate # Linux/macOS
|
|
136
|
+
# or: .venv\Scripts\activate # Windows
|
|
137
|
+
pip install -e ".[dev]"
|
|
138
|
+
|
|
139
|
+
# Run all tests
|
|
140
|
+
pytest
|
|
141
|
+
|
|
142
|
+
# With coverage
|
|
143
|
+
pytest --cov=mcp_debugger --cov-report=term-missing
|
|
144
|
+
|
|
145
|
+
# Lint and type-check
|
|
146
|
+
ruff check .
|
|
147
|
+
mypy src/mcp_debugger --ignore-missing-imports
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## ๐ค Contributing
|
|
153
|
+
|
|
154
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions, coding style, and pull request process.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## ๐ License
|
|
159
|
+
|
|
160
|
+
MIT ยฉ [Sushant Mutnale](https://github.com/sushant-mutnale)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Project Charter
|
|
2
|
+
|
|
3
|
+
## Problem Statement
|
|
4
|
+
Currently, Model Context Protocol (MCP) developers debug stdio-based JSON-RPC communication using basic `print()` statements and manual log reading. There is a lack of specialized tooling to record, replay, or validate MCP session traffic, leading to slow debugging cycles and difficult regression testing.
|
|
5
|
+
|
|
6
|
+
## Solution
|
|
7
|
+
`mcp-debugger` is a Python-native CLI tool that acts as a transparent man-in-the-middle proxy. It captures all JSON-RPC traffic between MCP clients and servers, stores session data locally in an SQLite database, and offers rich CLI command utilities (`inspect`, `validate`, `replay`) to troubleshoot and audit integrations.
|
|
8
|
+
|
|
9
|
+
## Target Users
|
|
10
|
+
- **MCP Server Developers**: Need to check if their server responds correctly to client queries and complies with the MCP specification.
|
|
11
|
+
- **Agent Framework Maintainers**: Integrate framework libraries (e.g. LangChain, Cursor, OpenAI Agents SDK) with various MCP servers and need visibility into JSON-RPC traffic.
|
|
12
|
+
- **DevOps/QA Engineers**: Testing and validating MCP server compliance in CI/CD pipelines.
|
|
13
|
+
|
|
14
|
+
## Success Criteria (Measurable)
|
|
15
|
+
- Achieve **500+ GitHub stars** within 3 months of public release.
|
|
16
|
+
- Adoption by **5+ public MCP servers** in their CI/CD compliance workflows.
|
|
17
|
+
- **Zero configuration** needed for basic usage (i.e. simple `pip install` and run commands immediately).
|
|
18
|
+
|
|
19
|
+
## Non-Goals (Phase 1)
|
|
20
|
+
- **No Cloud Dashboard**: All operations are 100% local-first to ensure developer data privacy.
|
|
21
|
+
- **No Multi-user Support**: Designed as a single-user local command-line utility.
|
|
22
|
+
- **No Native Windows Support**: The initial target OS is Linux/macOS (Phase 1 stdio handling may rely on POSIX-compatible async I/O behaviors, although the CLI commands themselves can run on Windows with appropriate workarounds).
|