jmunch-mcp 0.0.3__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.
- jmunch_mcp-0.0.3/.claude/settings.local.json +28 -0
- jmunch_mcp-0.0.3/.gitignore +35 -0
- jmunch_mcp-0.0.3/LICENSE +21 -0
- jmunch_mcp-0.0.3/PKG-INFO +91 -0
- jmunch_mcp-0.0.3/README.md +55 -0
- jmunch_mcp-0.0.3/bench/README.md +26 -0
- jmunch_mcp-0.0.3/bench/RESULTS_firecrawl.md +31 -0
- jmunch_mcp-0.0.3/bench/RESULTS_github.md +31 -0
- jmunch_mcp-0.0.3/bench/__init__.py +0 -0
- jmunch_mcp-0.0.3/bench/firecrawl.toml +11 -0
- jmunch_mcp-0.0.3/bench/github.toml +16 -0
- jmunch_mcp-0.0.3/bench/probe.py +54 -0
- jmunch_mcp-0.0.3/bench/probe_call.py +63 -0
- jmunch_mcp-0.0.3/bench/probe_tools.py +56 -0
- jmunch_mcp-0.0.3/bench/run_bench.py +259 -0
- jmunch_mcp-0.0.3/bench/scripts.py +90 -0
- jmunch_mcp-0.0.3/configs/brave-search.toml +11 -0
- jmunch_mcp-0.0.3/configs/fetch.toml +10 -0
- jmunch_mcp-0.0.3/configs/github-codemunch.toml +11 -0
- jmunch_mcp-0.0.3/configs/github-docs.toml +10 -0
- jmunch_mcp-0.0.3/configs/jcodemunch.toml +10 -0
- jmunch_mcp-0.0.3/configs/jdatamunch.toml +10 -0
- jmunch_mcp-0.0.3/configs/jdocmunch.toml +10 -0
- jmunch_mcp-0.0.3/examples/config.toml +12 -0
- jmunch_mcp-0.0.3/pyproject.toml +35 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/__init__.py +1 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/__main__.py +67 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/backends/__init__.py +0 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/backends/base.py +34 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/backends/jsontree.py +194 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/backends/tabular.py +219 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/backends/text.py +228 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/cli/__init__.py +0 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/cli/dashboard.html +432 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/cli/dashboard.py +486 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/cli/discovery.py +391 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/cli/init.py +339 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/cli/rewrite.py +221 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/config.py +51 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/errors.py +32 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/jsonpath.py +145 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/meta.py +136 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/metrics.py +253 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/proxy.py +376 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/registry.py +96 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/sniffer.py +89 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/stats.py +67 -0
- jmunch_mcp-0.0.3/src/jmunch_mcp/verbs.py +201 -0
- jmunch_mcp-0.0.3/tests/test_dashboard.py +224 -0
- jmunch_mcp-0.0.3/tests/test_init.py +215 -0
- jmunch_mcp-0.0.3/tests/test_jsonpath.py +53 -0
- jmunch_mcp-0.0.3/tests/test_jsontree.py +72 -0
- jmunch_mcp-0.0.3/tests/test_meta.py +47 -0
- jmunch_mcp-0.0.3/tests/test_metrics.py +111 -0
- jmunch_mcp-0.0.3/tests/test_proxy_interception.py +187 -0
- jmunch_mcp-0.0.3/tests/test_registry.py +59 -0
- jmunch_mcp-0.0.3/tests/test_rewrite.py +224 -0
- jmunch_mcp-0.0.3/tests/test_session_report.py +89 -0
- jmunch_mcp-0.0.3/tests/test_sniffer.py +35 -0
- jmunch_mcp-0.0.3/tests/test_tabular.py +69 -0
- jmunch_mcp-0.0.3/tests/test_text.py +91 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"mcp__jcodemunch__resolve_repo",
|
|
5
|
+
"mcp__jcodemunch__index_folder",
|
|
6
|
+
"mcp__jcodemunch__search_text",
|
|
7
|
+
"mcp__jcodemunch__get_file_content",
|
|
8
|
+
"Bash(git -C /c/MCPs/jmunch-mcp status)",
|
|
9
|
+
"Bash(git -C /c/MCPs/jmunch-mcp log --oneline -5)",
|
|
10
|
+
"Bash(git *)",
|
|
11
|
+
"Bash(PYTHONPATH=src python -m pytest tests/ -q)",
|
|
12
|
+
"Bash(GITHUB_TOKEN=\"\" git push origin main)",
|
|
13
|
+
"Bash(GITHUB_TOKEN=\"\" git push origin v0.0.2)",
|
|
14
|
+
"mcp__fetch__fetch",
|
|
15
|
+
"mcp__fetch__jmunch_peek",
|
|
16
|
+
"mcp__fetch__jmunch_slice",
|
|
17
|
+
"mcp__jcodemunch__search_symbols",
|
|
18
|
+
"mcp__jcodemunch__get_file_outline",
|
|
19
|
+
"mcp__jcodemunch__get_symbol_source",
|
|
20
|
+
"Bash(PYTHONPATH=src python -m pytest tests/test_metrics.py tests/test_dashboard.py -q)",
|
|
21
|
+
"mcp__jcodemunch__index_file",
|
|
22
|
+
"mcp__fetch__jmunch_summarize",
|
|
23
|
+
"mcp__fetch__jmunch_search",
|
|
24
|
+
"Bash(rm -rf dist build *.egg-info src/*.egg-info)",
|
|
25
|
+
"Bash(python -m build)"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
.eggs/
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg
|
|
10
|
+
.installed.cfg
|
|
11
|
+
|
|
12
|
+
# Virtual envs
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# Test / tooling caches
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
.coverage
|
|
22
|
+
htmlcov/
|
|
23
|
+
.tox/
|
|
24
|
+
|
|
25
|
+
# Editors / OS
|
|
26
|
+
.vscode/
|
|
27
|
+
.idea/
|
|
28
|
+
*.swp
|
|
29
|
+
.DS_Store
|
|
30
|
+
Thumbs.db
|
|
31
|
+
|
|
32
|
+
# Local runtime artifacts
|
|
33
|
+
*.log
|
|
34
|
+
*.bak
|
|
35
|
+
~/.jmunch/
|
jmunch_mcp-0.0.3/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 J. Gravelle
|
|
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,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jmunch-mcp
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: Transparent MCP proxy that reduces token cost of large tool responses via content-aware handles
|
|
5
|
+
Project-URL: Homepage, https://github.com/jgravelle/jmunch-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/jgravelle/jmunch-mcp
|
|
7
|
+
Author-email: "J. Gravelle" <j@gravelle.us>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2026 J. Gravelle
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Requires-Python: >=3.10
|
|
34
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# jmunch-mcp
|
|
38
|
+
|
|
39
|
+
Transparent MCP proxy that reduces the token cost of large upstream tool responses. Wraps a single upstream MCP, forwards every call, and handle-ifies fat payloads into content-aware backends the agent can query with a small set of universal verbs (`peek`, `slice`, `search`, `aggregate`, `describe`, `list_handles`).
|
|
40
|
+
|
|
41
|
+
## Benchmarks
|
|
42
|
+
|
|
43
|
+
Measured end-to-end against two popular real-world MCP servers. Each run fires a fixed script of tool calls twice — once direct, once through jmunch-mcp — with three follow-up `jmunch.*` verb calls on the proxied side to model an agent drilling into a large result rather than slurping it whole.
|
|
44
|
+
|
|
45
|
+
| suite | upstream | direct tokens | via jmunch-mcp | saved |
|
|
46
|
+
|---|---|---:|---:|---:|
|
|
47
|
+
| GitHub (`facebook/react` issues/PRs/commits) | `@modelcontextprotocol/server-github` | 379,878 | 44,328 | **335,550 (88.3%)** |
|
|
48
|
+
| Firecrawl (Wikipedia scrapes + site map + search) | `firecrawl-mcp` | 259,574 | 2,928 | **256,646 (98.9%)** |
|
|
49
|
+
|
|
50
|
+
Wall-clock time was also faster with the proxy on both suites, despite the extra verb calls — the agent never has to page through the fat payload:
|
|
51
|
+
|
|
52
|
+
| suite | direct | via jmunch-mcp | delta |
|
|
53
|
+
|---|---:|---:|---:|
|
|
54
|
+
| GitHub | 8.4s | 6.8s | **−1.6s (−19.0%)** |
|
|
55
|
+
| Firecrawl | 16.4s | 9.2s | **−7.2s (−43.9%)** |
|
|
56
|
+
|
|
57
|
+
Tabular content (GitHub) routes to the SQLite backend and answers `peek`/`slice`/`aggregate`; JSON content (Firecrawl scrape/map) routes to the JSON-tree backend and answers `peek`/`slice` (JSONPath)/`search`. See [bench/README.md](bench/README.md) to reproduce.
|
|
58
|
+
|
|
59
|
+
## Quickstart
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install -e .
|
|
63
|
+
jmunch-mcp init
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`init` scans three sources — your MCP client configs (Claude Desktop, Claude Code, Cursor, Windsurf, Continue), running processes, and a small catalog of popular upstreams (GitHub, Firecrawl, filesystem, fetch, Brave Search, Slack) — and renders a checklist. Tick the upstreams you want wrapped, and it writes one `<name>.toml` per selection into `./configs/`. Non-interactive flags: `--yes` (pick everything already registered in a client), `--dry-run`, `--overwrite`, `--out <dir>`, `--no-running`, `--no-catalog`.
|
|
67
|
+
|
|
68
|
+
### Manual
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
jmunch-mcp --config examples/config.toml
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Configure your MCP client to launch `jmunch-mcp --config <path>` instead of the upstream server directly. Add `--report` to print a session summary on shutdown.
|
|
75
|
+
|
|
76
|
+
## Dashboard
|
|
77
|
+
|
|
78
|
+
A read-only local web UI over the metrics DB each proxy writes to. Shows cumulative totals, per-upstream breakdowns, and a time series of forwarded calls.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
jmunch-mcp dashboard # http://127.0.0.1:7878
|
|
82
|
+
jmunch-mcp dashboard --open # also open in your default browser
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Flags: `--port` (default `7878`), `--host` (default `127.0.0.1`), `--db <path>` to point at a non-default metrics DB, `--open` to launch the browser. Metrics only populate once proxies have recorded calls, so run your client against a wrapped upstream first.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
jmunch-mcp is released under the [MIT License](LICENSE) — free to use, modify, distribute, and embed in commercial products.
|
|
90
|
+
|
|
91
|
+
Note that licensing of **upstream MCP services** you proxy through jmunch-mcp is governed by those services' own terms. This applies to third-party MCP servers (GitHub, filesystem providers, vendor APIs) and to any sibling tools in the broader retrieval ecosystem you may compose with — check each upstream's license before redistribution.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# jmunch-mcp
|
|
2
|
+
|
|
3
|
+
Transparent MCP proxy that reduces the token cost of large upstream tool responses. Wraps a single upstream MCP, forwards every call, and handle-ifies fat payloads into content-aware backends the agent can query with a small set of universal verbs (`peek`, `slice`, `search`, `aggregate`, `describe`, `list_handles`).
|
|
4
|
+
|
|
5
|
+
## Benchmarks
|
|
6
|
+
|
|
7
|
+
Measured end-to-end against two popular real-world MCP servers. Each run fires a fixed script of tool calls twice — once direct, once through jmunch-mcp — with three follow-up `jmunch.*` verb calls on the proxied side to model an agent drilling into a large result rather than slurping it whole.
|
|
8
|
+
|
|
9
|
+
| suite | upstream | direct tokens | via jmunch-mcp | saved |
|
|
10
|
+
|---|---|---:|---:|---:|
|
|
11
|
+
| GitHub (`facebook/react` issues/PRs/commits) | `@modelcontextprotocol/server-github` | 379,878 | 44,328 | **335,550 (88.3%)** |
|
|
12
|
+
| Firecrawl (Wikipedia scrapes + site map + search) | `firecrawl-mcp` | 259,574 | 2,928 | **256,646 (98.9%)** |
|
|
13
|
+
|
|
14
|
+
Wall-clock time was also faster with the proxy on both suites, despite the extra verb calls — the agent never has to page through the fat payload:
|
|
15
|
+
|
|
16
|
+
| suite | direct | via jmunch-mcp | delta |
|
|
17
|
+
|---|---:|---:|---:|
|
|
18
|
+
| GitHub | 8.4s | 6.8s | **−1.6s (−19.0%)** |
|
|
19
|
+
| Firecrawl | 16.4s | 9.2s | **−7.2s (−43.9%)** |
|
|
20
|
+
|
|
21
|
+
Tabular content (GitHub) routes to the SQLite backend and answers `peek`/`slice`/`aggregate`; JSON content (Firecrawl scrape/map) routes to the JSON-tree backend and answers `peek`/`slice` (JSONPath)/`search`. See [bench/README.md](bench/README.md) to reproduce.
|
|
22
|
+
|
|
23
|
+
## Quickstart
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install -e .
|
|
27
|
+
jmunch-mcp init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`init` scans three sources — your MCP client configs (Claude Desktop, Claude Code, Cursor, Windsurf, Continue), running processes, and a small catalog of popular upstreams (GitHub, Firecrawl, filesystem, fetch, Brave Search, Slack) — and renders a checklist. Tick the upstreams you want wrapped, and it writes one `<name>.toml` per selection into `./configs/`. Non-interactive flags: `--yes` (pick everything already registered in a client), `--dry-run`, `--overwrite`, `--out <dir>`, `--no-running`, `--no-catalog`.
|
|
31
|
+
|
|
32
|
+
### Manual
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
jmunch-mcp --config examples/config.toml
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Configure your MCP client to launch `jmunch-mcp --config <path>` instead of the upstream server directly. Add `--report` to print a session summary on shutdown.
|
|
39
|
+
|
|
40
|
+
## Dashboard
|
|
41
|
+
|
|
42
|
+
A read-only local web UI over the metrics DB each proxy writes to. Shows cumulative totals, per-upstream breakdowns, and a time series of forwarded calls.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
jmunch-mcp dashboard # http://127.0.0.1:7878
|
|
46
|
+
jmunch-mcp dashboard --open # also open in your default browser
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Flags: `--port` (default `7878`), `--host` (default `127.0.0.1`), `--db <path>` to point at a non-default metrics DB, `--open` to launch the browser. Metrics only populate once proxies have recorded calls, so run your client against a wrapped upstream first.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
jmunch-mcp is released under the [MIT License](LICENSE) — free to use, modify, distribute, and embed in commercial products.
|
|
54
|
+
|
|
55
|
+
Note that licensing of **upstream MCP services** you proxy through jmunch-mcp is governed by those services' own terms. This applies to third-party MCP servers (GitHub, filesystem providers, vendor APIs) and to any sibling tools in the broader retrieval ecosystem you may compose with — check each upstream's license before redistribution.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# jmunch-mcp benchmarks
|
|
2
|
+
|
|
3
|
+
Reproduce the headline numbers from the top-level README. Each suite fires a fixed script of `tools/call` frames at an upstream MCP server twice — once direct, once through `jmunch-mcp` — with three follow-up `jmunch.*` verb calls on the proxied side to model an agent drilling into a large result.
|
|
4
|
+
|
|
5
|
+
## Run
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m bench.run_bench --config bench/github.toml --suite github
|
|
9
|
+
python -m bench.run_bench --config bench/firecrawl.toml --suite firecrawl
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Requires `GITHUB_PERSONAL_ACCESS_TOKEN` and `FIRECRAWL_API_KEY` in your environment, respectively. Write the markdown output to a file with `--out <path>`.
|
|
13
|
+
|
|
14
|
+
## Files
|
|
15
|
+
|
|
16
|
+
- `run_bench.py` — minimal stdio MCP client + direct/proxied runner + markdown renderer.
|
|
17
|
+
- `scripts.py` — the call sequences (`GITHUB_CALLS`, `FIRECRAWL_CALLS`) and the follow-up verbs (`JMUNCH_FOLLOWUPS`, `JMUNCH_FOLLOWUPS_JSON`).
|
|
18
|
+
- `github.toml`, `firecrawl.toml` — upstream configs reused by both the direct baseline and the proxied run, so there's no drift between the two legs.
|
|
19
|
+
- `RESULTS_github.md`, `RESULTS_firecrawl.md` — the exact reports rendered from the last run.
|
|
20
|
+
|
|
21
|
+
## Methodology
|
|
22
|
+
|
|
23
|
+
- **Token accounting:** raw JSON-RPC response bytes divided by 4 (jMRI convention). No LLM in the loop.
|
|
24
|
+
- **Wall-clock:** `time.perf_counter()` around each `asyncio.run()` leg.
|
|
25
|
+
- **No caching:** the proxy starts fresh per run; no disk-backed handle persistence is in play.
|
|
26
|
+
- **Fair baseline:** the direct leg uses the *same* upstream config the proxy wraps, so the upstream launch path is identical.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# jmunch-mcp benchmark
|
|
2
|
+
|
|
3
|
+
## direct (no proxy)
|
|
4
|
+
|
|
5
|
+
| call | response bytes | ~tokens |
|
|
6
|
+
|---|---:|---:|
|
|
7
|
+
| scrape(en.wikipedia.org/wiki/Artificial_intelligence) | 634,333 | 158,583 |
|
|
8
|
+
| scrape(en.wikipedia.org/wiki/Machine_learning) | 301,187 | 75,296 |
|
|
9
|
+
| map(docs.python.org) | 98,983 | 24,745 |
|
|
10
|
+
| search(large language models, limit=10) | 3,796 | 949 |
|
|
11
|
+
| **total** | **1,038,299** | **259,574** |
|
|
12
|
+
|
|
13
|
+
## through jmunch-mcp
|
|
14
|
+
|
|
15
|
+
| call | response bytes | ~tokens |
|
|
16
|
+
|---|---:|---:|
|
|
17
|
+
| scrape(en.wikipedia.org/wiki/Artificial_intelligence) | 1,007 | 251 |
|
|
18
|
+
| scrape(en.wikipedia.org/wiki/Machine_learning) | 1,005 | 251 |
|
|
19
|
+
| map(docs.python.org) | 2,043 | 510 |
|
|
20
|
+
| search(large language models, limit=10) | 3,796 | 949 |
|
|
21
|
+
| jmunch.describe($LAST_HANDLE) | 953 | 238 |
|
|
22
|
+
| jmunch.peek($LAST_HANDLE, n=5) | 2,278 | 569 |
|
|
23
|
+
| jmunch.search($LAST_HANDLE, 'neural') | 631 | 157 |
|
|
24
|
+
| **total** | **11,713** | **2,928** |
|
|
25
|
+
|
|
26
|
+
## delta
|
|
27
|
+
|
|
28
|
+
- bytes saved: **1,026,586** (98.9%)
|
|
29
|
+
- tokens saved: **~256,646** (bytes / 4)
|
|
30
|
+
|
|
31
|
+
_timings: direct=16.4s, proxied=9.2s_
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# jmunch-mcp benchmark
|
|
2
|
+
|
|
3
|
+
## direct (no proxy)
|
|
4
|
+
|
|
5
|
+
| call | response bytes | ~tokens |
|
|
6
|
+
|---|---:|---:|
|
|
7
|
+
| list_issues(facebook/react, state=all, per_page=100) | 172,496 | 43,124 |
|
|
8
|
+
| list_pull_requests(facebook/react, state=all, per_page=100) | 222,958 | 55,739 |
|
|
9
|
+
| list_commits(facebook/react, per_page=100) | 769,047 | 192,261 |
|
|
10
|
+
| search_issues(language:python label:bug, per_page=100) | 355,013 | 88,753 |
|
|
11
|
+
| **total** | **1,519,514** | **379,878** |
|
|
12
|
+
|
|
13
|
+
## through jmunch-mcp
|
|
14
|
+
|
|
15
|
+
| call | response bytes | ~tokens |
|
|
16
|
+
|---|---:|---:|
|
|
17
|
+
| list_issues(facebook/react, state=all, per_page=100) | 17,150 | 4,287 |
|
|
18
|
+
| list_pull_requests(facebook/react, state=all, per_page=100) | 20,697 | 5,174 |
|
|
19
|
+
| list_commits(facebook/react, per_page=100) | 19,295 | 4,823 |
|
|
20
|
+
| search_issues(language:python label:bug, per_page=100) | 19,764 | 4,941 |
|
|
21
|
+
| jmunch.describe($LAST_HANDLE) | 3,425 | 856 |
|
|
22
|
+
| jmunch.peek($LAST_HANDLE, n=5) | 32,023 | 8,005 |
|
|
23
|
+
| jmunch.slice($LAST_HANDLE, state='open', max_rows=10) | 64,959 | 16,239 |
|
|
24
|
+
| **total** | **177,313** | **44,328** |
|
|
25
|
+
|
|
26
|
+
## delta
|
|
27
|
+
|
|
28
|
+
- bytes saved: **1,342,201** (88.3%)
|
|
29
|
+
- tokens saved: **~335,550** (bytes / 4)
|
|
30
|
+
|
|
31
|
+
_timings: direct=8.4s, proxied=6.8s_
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Benchmark config: wraps the Firecrawl MCP server.
|
|
2
|
+
#
|
|
3
|
+
# Requires FIRECRAWL_API_KEY in your environment (free tier at firecrawl.dev).
|
|
4
|
+
|
|
5
|
+
[upstream]
|
|
6
|
+
command = "npx"
|
|
7
|
+
args = ["-y", "firecrawl-mcp"]
|
|
8
|
+
|
|
9
|
+
threshold_tokens = 2000
|
|
10
|
+
log_level = "WARNING"
|
|
11
|
+
report = false
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Benchmark config: wraps the official GitHub MCP server.
|
|
2
|
+
#
|
|
3
|
+
# Requires GITHUB_PERSONAL_ACCESS_TOKEN in your environment (a fine-grained PAT
|
|
4
|
+
# with public-repo read is sufficient — the benchmark only hits facebook/react).
|
|
5
|
+
|
|
6
|
+
[upstream]
|
|
7
|
+
command = "npx"
|
|
8
|
+
args = ["-y", "@modelcontextprotocol/server-github"]
|
|
9
|
+
|
|
10
|
+
[upstream.env]
|
|
11
|
+
# inherited from os.environ; uncomment to pin
|
|
12
|
+
# GITHUB_PERSONAL_ACCESS_TOKEN = "ghp_..."
|
|
13
|
+
|
|
14
|
+
threshold_tokens = 2000
|
|
15
|
+
log_level = "WARNING"
|
|
16
|
+
report = false
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Minimal handshake probe — spawns upstream, does initialize, prints response."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import asyncio
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "src"))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async def main() -> int:
|
|
14
|
+
env = {k: v for k, v in os.environ.items() if isinstance(v, str)}
|
|
15
|
+
proc = await asyncio.create_subprocess_exec(
|
|
16
|
+
"npx.cmd",
|
|
17
|
+
"-y",
|
|
18
|
+
"@modelcontextprotocol/server-github",
|
|
19
|
+
stdin=asyncio.subprocess.PIPE,
|
|
20
|
+
stdout=asyncio.subprocess.PIPE,
|
|
21
|
+
stderr=sys.stderr,
|
|
22
|
+
env=env,
|
|
23
|
+
)
|
|
24
|
+
print(f"spawned pid={proc.pid}", file=sys.stderr, flush=True)
|
|
25
|
+
|
|
26
|
+
frame = json.dumps({
|
|
27
|
+
"jsonrpc": "2.0", "id": 1, "method": "initialize",
|
|
28
|
+
"params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "probe", "version": "0"}},
|
|
29
|
+
}) + "\n"
|
|
30
|
+
proc.stdin.write(frame.encode())
|
|
31
|
+
await proc.stdin.drain()
|
|
32
|
+
print("sent initialize", file=sys.stderr, flush=True)
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
line = await asyncio.wait_for(proc.stdout.readline(), timeout=30)
|
|
36
|
+
print(f"got line ({len(line)} bytes):", file=sys.stderr, flush=True)
|
|
37
|
+
print(line.decode(errors="replace")[:500])
|
|
38
|
+
except asyncio.TimeoutError:
|
|
39
|
+
print("TIMEOUT waiting for initialize response", file=sys.stderr, flush=True)
|
|
40
|
+
finally:
|
|
41
|
+
try:
|
|
42
|
+
proc.stdin.close()
|
|
43
|
+
except Exception:
|
|
44
|
+
pass
|
|
45
|
+
try:
|
|
46
|
+
await asyncio.wait_for(proc.wait(), timeout=3)
|
|
47
|
+
except asyncio.TimeoutError:
|
|
48
|
+
proc.kill()
|
|
49
|
+
await proc.wait()
|
|
50
|
+
return 0
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if __name__ == "__main__":
|
|
54
|
+
raise SystemExit(asyncio.run(main()))
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Probe a single tools/call to GitHub MCP."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import asyncio
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
async def main() -> int:
|
|
11
|
+
env = {k: v for k, v in os.environ.items() if isinstance(v, str)}
|
|
12
|
+
proc = await asyncio.create_subprocess_exec(
|
|
13
|
+
"npx.cmd", "-y", "@modelcontextprotocol/server-github",
|
|
14
|
+
stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
|
|
15
|
+
stderr=sys.stderr, env=env,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
async def send(msg):
|
|
19
|
+
proc.stdin.write((json.dumps(msg) + "\n").encode())
|
|
20
|
+
await proc.stdin.drain()
|
|
21
|
+
|
|
22
|
+
async def recv(want_id):
|
|
23
|
+
while True:
|
|
24
|
+
line = await asyncio.wait_for(proc.stdout.readline(), timeout=45)
|
|
25
|
+
if not line:
|
|
26
|
+
raise RuntimeError("EOF")
|
|
27
|
+
try:
|
|
28
|
+
m = json.loads(line)
|
|
29
|
+
except json.JSONDecodeError:
|
|
30
|
+
continue
|
|
31
|
+
if m.get("id") == want_id:
|
|
32
|
+
return line, m
|
|
33
|
+
|
|
34
|
+
await send({"jsonrpc": "2.0", "id": 1, "method": "initialize",
|
|
35
|
+
"params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "p", "version": "0"}}})
|
|
36
|
+
await recv(1)
|
|
37
|
+
await send({"jsonrpc": "2.0", "method": "notifications/initialized", "params": {}})
|
|
38
|
+
|
|
39
|
+
call = {"jsonrpc": "2.0", "id": 2, "method": "tools/call",
|
|
40
|
+
"params": {"name": "list_issues", "arguments": {"owner": "facebook", "repo": "react", "state": "all", "perPage": 100}}}
|
|
41
|
+
await send(call)
|
|
42
|
+
print("sent list_issues, waiting...", file=sys.stderr, flush=True)
|
|
43
|
+
line, msg = await recv(2)
|
|
44
|
+
print(f"got {len(line)} bytes", file=sys.stderr, flush=True)
|
|
45
|
+
# Print first 400 chars of text content
|
|
46
|
+
try:
|
|
47
|
+
txt = msg["result"]["content"][0]["text"]
|
|
48
|
+
print(f"text len={len(txt)}")
|
|
49
|
+
print(txt[:300])
|
|
50
|
+
except Exception as e:
|
|
51
|
+
print(f"unexpected shape: {e}")
|
|
52
|
+
print(json.dumps(msg)[:500])
|
|
53
|
+
|
|
54
|
+
proc.stdin.close()
|
|
55
|
+
try:
|
|
56
|
+
await asyncio.wait_for(proc.wait(), timeout=3)
|
|
57
|
+
except asyncio.TimeoutError:
|
|
58
|
+
proc.kill()
|
|
59
|
+
return 0
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
raise SystemExit(asyncio.run(main()))
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""List tools from GitHub MCP to confirm names."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import asyncio
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
async def main() -> int:
|
|
11
|
+
env = {k: v for k, v in os.environ.items() if isinstance(v, str)}
|
|
12
|
+
proc = await asyncio.create_subprocess_exec(
|
|
13
|
+
"npx.cmd", "-y", "@modelcontextprotocol/server-github",
|
|
14
|
+
stdin=asyncio.subprocess.PIPE,
|
|
15
|
+
stdout=asyncio.subprocess.PIPE,
|
|
16
|
+
stderr=sys.stderr,
|
|
17
|
+
env=env,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
async def send(msg):
|
|
21
|
+
proc.stdin.write((json.dumps(msg) + "\n").encode())
|
|
22
|
+
await proc.stdin.drain()
|
|
23
|
+
|
|
24
|
+
async def recv(want_id):
|
|
25
|
+
while True:
|
|
26
|
+
line = await asyncio.wait_for(proc.stdout.readline(), timeout=30)
|
|
27
|
+
if not line:
|
|
28
|
+
raise RuntimeError("EOF")
|
|
29
|
+
try:
|
|
30
|
+
m = json.loads(line)
|
|
31
|
+
except json.JSONDecodeError:
|
|
32
|
+
continue
|
|
33
|
+
if m.get("id") == want_id:
|
|
34
|
+
return m
|
|
35
|
+
|
|
36
|
+
await send({"jsonrpc": "2.0", "id": 1, "method": "initialize",
|
|
37
|
+
"params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "p", "version": "0"}}})
|
|
38
|
+
await recv(1)
|
|
39
|
+
await send({"jsonrpc": "2.0", "method": "notifications/initialized", "params": {}})
|
|
40
|
+
await send({"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}})
|
|
41
|
+
resp = await recv(2)
|
|
42
|
+
tools = resp.get("result", {}).get("tools", [])
|
|
43
|
+
print(f"{len(tools)} tools:")
|
|
44
|
+
for t in tools[:50]:
|
|
45
|
+
print(f" {t['name']}")
|
|
46
|
+
|
|
47
|
+
proc.stdin.close()
|
|
48
|
+
try:
|
|
49
|
+
await asyncio.wait_for(proc.wait(), timeout=3)
|
|
50
|
+
except asyncio.TimeoutError:
|
|
51
|
+
proc.kill()
|
|
52
|
+
return 0
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if __name__ == "__main__":
|
|
56
|
+
raise SystemExit(asyncio.run(main()))
|