tare-mcp 0.2.0
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.
- package/LICENSE +21 -0
- package/README.md +668 -0
- package/dist/cli.js +2401 -0
- package/dist/index.js +2199 -0
- package/examples/live-stdio/.mcp.json +8 -0
- package/examples/live-stdio/README.md +28 -0
- package/examples/live-stdio/server.mjs +58 -0
- package/examples/live-streamable-http/.mcp.json +7 -0
- package/examples/live-streamable-http/README.md +40 -0
- package/examples/live-streamable-http/server.mjs +106 -0
- package/examples/scenarios/README.md +44 -0
- package/examples/scenarios/hosted-streamable-http.mcp.json +11 -0
- package/examples/scenarios/local-stdio.mcp.json +8 -0
- package/examples/stdio.mcp.json +11 -0
- package/examples/streamable-http.mcp.json +10 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nishant Modak
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
# tare-mcp
|
|
2
|
+
|
|
3
|
+
[](https://github.com/nishantmodak/tare-mcp/actions/workflows/publish-npm.yml)
|
|
4
|
+
[](package.json)
|
|
5
|
+
[](https://www.npmjs.com/package/tare-mcp)
|
|
6
|
+
|
|
7
|
+
See what your MCP tools weigh before your agent does anything.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm install
|
|
11
|
+
pnpm build
|
|
12
|
+
node dist/cli.js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
MCP made tools easy to connect.
|
|
16
|
+
It did not make them cheap to carry.
|
|
17
|
+
|
|
18
|
+
`tare-mcp` inspects your MCP setup and shows:
|
|
19
|
+
|
|
20
|
+
- how many tools your agent sees
|
|
21
|
+
- how much context those tools consume
|
|
22
|
+
- which servers dominate the budget
|
|
23
|
+
- which tools overlap and compete for model attention
|
|
24
|
+
- whether your setup exceeds a context budget
|
|
25
|
+
|
|
26
|
+
Think of it as:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
du -sh node_modules
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
but for agent tool context.
|
|
33
|
+
|
|
34
|
+
## Table of Contents
|
|
35
|
+
|
|
36
|
+
- [Why This Matters](#why-this-matters)
|
|
37
|
+
- [Why Token Count Is Not the Whole Problem](#why-token-count-is-not-the-whole-problem)
|
|
38
|
+
- [Current Status](#current-status)
|
|
39
|
+
- [Quickstart](#quickstart)
|
|
40
|
+
- [Hosted MCP Quickstart](#hosted-mcp-quickstart)
|
|
41
|
+
- [Scenario Examples](#scenario-examples)
|
|
42
|
+
- [Example Output](#example-output)
|
|
43
|
+
- [Supported Transports](#supported-transports)
|
|
44
|
+
- [Static vs Live Inspection](#static-vs-live-inspection)
|
|
45
|
+
- [Accuracy](#accuracy)
|
|
46
|
+
- [Security Model](#security-model)
|
|
47
|
+
- [Config Discovery](#config-discovery)
|
|
48
|
+
- [JSON Usage](#json-usage)
|
|
49
|
+
- [PR Regression Checks](#pr-regression-checks)
|
|
50
|
+
- [CI Usage](#ci-usage)
|
|
51
|
+
- [Publishing to npm](#publishing-to-npm)
|
|
52
|
+
- [CLI](#cli)
|
|
53
|
+
- [Roadmap](#roadmap)
|
|
54
|
+
- [License](#license)
|
|
55
|
+
|
|
56
|
+
## Why this matters
|
|
57
|
+
|
|
58
|
+
Every MCP tool is context the model has to carry before it can act. Large tool lists and verbose schemas reduce the room left for the actual task, and they can make routing decisions noisier.
|
|
59
|
+
|
|
60
|
+
`tare-mcp` makes that weight visible locally, before a coding agent or assistant spends any of its working context on it.
|
|
61
|
+
|
|
62
|
+
## Why token count is not the whole problem
|
|
63
|
+
|
|
64
|
+
A bloated MCP setup hurts in two ways.
|
|
65
|
+
|
|
66
|
+
First, it consumes context.
|
|
67
|
+
|
|
68
|
+
Second, it creates ambiguity.
|
|
69
|
+
|
|
70
|
+
If three servers all expose tools that look like "search", the model has to choose between them before it can do useful work.
|
|
71
|
+
|
|
72
|
+
`tare-mcp` shows both:
|
|
73
|
+
|
|
74
|
+
- what your tools weigh
|
|
75
|
+
- where your tools overlap
|
|
76
|
+
|
|
77
|
+
## Current status
|
|
78
|
+
|
|
79
|
+
Current repository version: `0.2.0`.
|
|
80
|
+
|
|
81
|
+
The CLI is implemented as `tare-mcp`, and the package is configured for npm as `tare-mcp`. Until the first npm release is published, run it from this repository with `node dist/cli.js` after building. Once published, the same commands work through `npx tare-mcp` or an npm install.
|
|
82
|
+
|
|
83
|
+
Most examples below use `npx tare-mcp` because that is the intended published interface. Before the first npm release, replace `npx tare-mcp` with `node /path/to/tare-mcp/dist/cli.js`.
|
|
84
|
+
|
|
85
|
+
## Quickstart
|
|
86
|
+
|
|
87
|
+
Run from source:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pnpm install
|
|
91
|
+
pnpm build
|
|
92
|
+
node dist/cli.js
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
After the npm package is published:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx tare-mcp
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
On the first run you should see something like:
|
|
102
|
+
|
|
103
|
+
```txt
|
|
104
|
+
tare-mcp — MCP context weight
|
|
105
|
+
|
|
106
|
+
Config files found: 1
|
|
107
|
+
Servers analyzed: 2
|
|
108
|
+
Inspection mode: live default
|
|
109
|
+
Tools exposed: 47
|
|
110
|
+
|
|
111
|
+
Estimated context weight:
|
|
112
|
+
- Claude estimate: ~18,400 tokens
|
|
113
|
+
- OpenAI cl100k estimate: ~17,800 tokens
|
|
114
|
+
|
|
115
|
+
Context window usage:
|
|
116
|
+
- 200k window: 9%
|
|
117
|
+
- 128k window: 14%
|
|
118
|
+
- 64k window: 29%
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If the output is empty or shows "Config files found: 0", see [Config discovery](#config-discovery).
|
|
122
|
+
|
|
123
|
+
Install it in a project after the npm release:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm install --save-dev tare-mcp
|
|
127
|
+
npx tare-mcp
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Install it globally after the npm release:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npm install --global tare-mcp
|
|
134
|
+
tare-mcp
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
For local development, keep using the source command:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pnpm dev
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Static-only mode parses config without starting servers or calling hosted endpoints:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npx tare-mcp --no-exec
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Set a budget:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npx tare-mcp --budget 40000
|
|
153
|
+
npx tare-mcp --budget 40000 --tokenizer openai
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Emit JSON for CI or other tools:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npx tare-mcp --json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Hosted MCP Quickstart
|
|
163
|
+
|
|
164
|
+
Use this when you want to inspect a real hosted MCP endpoint.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
mkdir -p /tmp/tare-mcp-hosted
|
|
168
|
+
cd /tmp/tare-mcp-hosted
|
|
169
|
+
cp /path/to/tare-mcp/examples/scenarios/hosted-streamable-http.mcp.json .mcp.json
|
|
170
|
+
export LAST9_MCP_TOKEN="..."
|
|
171
|
+
npx tare-mcp --timeout 10000
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The hosted example config points at Last9's observability MCP endpoint:
|
|
175
|
+
|
|
176
|
+
```txt
|
|
177
|
+
https://mcp.last9.io/mcp
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
To use a different hosted MCP server, edit the `url` and `headers` in `.mcp.json`. Any Streamable HTTP MCP server works here.
|
|
181
|
+
|
|
182
|
+
If the token is missing or invalid, `tare-mcp` reports a `401 Unauthorized` fallback instead of crashing.
|
|
183
|
+
|
|
184
|
+
Expected shape with valid credentials:
|
|
185
|
+
|
|
186
|
+
```txt
|
|
187
|
+
Inspecting last9 via streamable-http...
|
|
188
|
+
|
|
189
|
+
tare-mcp — MCP context weight
|
|
190
|
+
|
|
191
|
+
Config files found: 1
|
|
192
|
+
Servers analyzed: 1
|
|
193
|
+
Inspection mode: live default
|
|
194
|
+
Tools exposed: ...
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Scenario Examples
|
|
198
|
+
|
|
199
|
+
Scenario files live in [`examples/scenarios`](examples/scenarios):
|
|
200
|
+
|
|
201
|
+
- [`hosted-streamable-http.mcp.json`](examples/scenarios/hosted-streamable-http.mcp.json): hosted Streamable HTTP MCP with bearer-token auth.
|
|
202
|
+
- [`local-stdio.mcp.json`](examples/scenarios/local-stdio.mcp.json): packaged stdio MCP server.
|
|
203
|
+
- [`examples/scenarios/README.md`](examples/scenarios/README.md): copy-paste commands for each scenario.
|
|
204
|
+
|
|
205
|
+
For a no-credentials local Streamable HTTP smoke test, use [`examples/live-streamable-http`](examples/live-streamable-http):
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
pnpm install
|
|
209
|
+
pnpm build
|
|
210
|
+
cd examples/live-streamable-http
|
|
211
|
+
node server.mjs
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Then in another terminal:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
cd examples/live-streamable-http
|
|
218
|
+
mkdir -p .home
|
|
219
|
+
HOME="$PWD/.home" node ../../dist/cli.js
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The temporary `HOME` keeps local smoke tests focused on the example `.mcp.json` instead of mixing in your real Claude or editor MCP configs.
|
|
223
|
+
|
|
224
|
+
Expected local smoke-test shape:
|
|
225
|
+
|
|
226
|
+
```txt
|
|
227
|
+
Inspecting tare-live-http-example via streamable-http...
|
|
228
|
+
|
|
229
|
+
tare-mcp — MCP context weight
|
|
230
|
+
|
|
231
|
+
Config files found: 1
|
|
232
|
+
Servers analyzed: 1
|
|
233
|
+
Inspection mode: live default
|
|
234
|
+
Tools exposed: 2
|
|
235
|
+
|
|
236
|
+
Worst servers:
|
|
237
|
+
1. tare-live-http-example ...
|
|
238
|
+
|
|
239
|
+
Worst tools:
|
|
240
|
+
1. tare-live-http-example.search_docs ...
|
|
241
|
+
2. tare-live-http-example.read_doc ...
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Example output
|
|
245
|
+
|
|
246
|
+
```txt
|
|
247
|
+
tare-mcp — MCP context weight
|
|
248
|
+
|
|
249
|
+
MCP made tools easy to connect. It did not make them cheap to carry.
|
|
250
|
+
|
|
251
|
+
Config files found: 2
|
|
252
|
+
Servers analyzed: 3
|
|
253
|
+
Inspection mode: live default
|
|
254
|
+
Tools exposed: 418
|
|
255
|
+
|
|
256
|
+
Estimated context weight:
|
|
257
|
+
- Claude estimate: ~143,200 tokens
|
|
258
|
+
- OpenAI cl100k estimate: ~138,400 tokens
|
|
259
|
+
|
|
260
|
+
Context window usage:
|
|
261
|
+
- 200k window: 72%
|
|
262
|
+
- 128k window: 112%
|
|
263
|
+
- 64k window: 224%
|
|
264
|
+
|
|
265
|
+
Worst servers:
|
|
266
|
+
1. github ~67,410 Claude tokens 188 tools
|
|
267
|
+
2. notion ~41,800 Claude tokens 96 tools
|
|
268
|
+
3. linear ~34,010 Claude tokens 134 tools
|
|
269
|
+
|
|
270
|
+
Worst tools:
|
|
271
|
+
1. github.create_pull_request ~3,912 Claude tokens
|
|
272
|
+
2. notion.query_database ~3,110 Claude tokens
|
|
273
|
+
3. linear.create_issue ~2,440 Claude tokens
|
|
274
|
+
|
|
275
|
+
Overlap warnings: 3 clusters
|
|
276
|
+
|
|
277
|
+
1. search intent
|
|
278
|
+
github.search_code
|
|
279
|
+
filesystem.grep
|
|
280
|
+
linear.search_issues
|
|
281
|
+
→ Prefer one search surface per workflow.
|
|
282
|
+
|
|
283
|
+
2. file write
|
|
284
|
+
filesystem.write_file
|
|
285
|
+
github.create_or_update_file
|
|
286
|
+
→ Disable duplicate write paths unless explicitly needed.
|
|
287
|
+
|
|
288
|
+
3. issue creation
|
|
289
|
+
github.create_issue
|
|
290
|
+
linear.create_issue
|
|
291
|
+
jira.create_issue
|
|
292
|
+
→ Create task-specific profiles.
|
|
293
|
+
|
|
294
|
+
Recommendations:
|
|
295
|
+
- Split large MCP servers into task-specific profiles.
|
|
296
|
+
- Prefer read-only profiles for common workflows.
|
|
297
|
+
- Avoid exposing multiple tools for the same intent unless needed.
|
|
298
|
+
- Disable rarely used write/admin tools.
|
|
299
|
+
- Use `tare-mcp --budget 40000` to enforce a context budget.
|
|
300
|
+
- Use `tare-mcp --json` to track this in CI.
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Supported transports
|
|
304
|
+
|
|
305
|
+
v0.2 supports live inspection for:
|
|
306
|
+
|
|
307
|
+
- stdio MCP servers
|
|
308
|
+
- Streamable HTTP MCP servers
|
|
309
|
+
|
|
310
|
+
SSE may be supported best-effort later.
|
|
311
|
+
|
|
312
|
+
If a server cannot be inspected because credentials are missing, the endpoint is wrong, or the transport is unsupported, `tare-mcp` falls back to static-insufficient mode and says so clearly.
|
|
313
|
+
|
|
314
|
+
## Static vs live inspection
|
|
315
|
+
|
|
316
|
+
Live inspection is the default because it asks MCP servers for the tool definitions they actually expose through `tools/list`.
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
npx tare-mcp
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Static-only mode does not spawn stdio MCP servers and does not call hosted MCP URLs:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
npx tare-mcp --no-exec
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Static-only mode is insufficient for packaged or hosted MCP servers because config files usually contain only commands, args, URLs, and headers. They do not contain the tool schemas the model receives.
|
|
329
|
+
|
|
330
|
+
## Accuracy
|
|
331
|
+
|
|
332
|
+
`tare-mcp` reports estimates, not exact truth.
|
|
333
|
+
|
|
334
|
+
Live inspection shows the actual tool definitions exposed by your MCP servers at inspection time.
|
|
335
|
+
|
|
336
|
+
Token counts are still model-dependent. `tare-mcp` shows both Claude and OpenAI cl100k estimates where possible.
|
|
337
|
+
|
|
338
|
+
By default, Claude token counts are local approximations. API-backed Claude token counting is optional and must be explicitly enabled:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
npx tare-mcp --claude-tokenizer api
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
That mode requires `ANTHROPIC_API_KEY` and uses Anthropic's `POST /v1/messages/count_tokens` endpoint.
|
|
345
|
+
|
|
346
|
+
Environment variables that control tokenization:
|
|
347
|
+
|
|
348
|
+
| Variable | Values | Default | Description |
|
|
349
|
+
|---|---|---|---|
|
|
350
|
+
| `ANTHROPIC_API_KEY` | string | — | Required for `--claude-tokenizer api` |
|
|
351
|
+
| `TARE_CLAUDE_TOKENIZER` | `local`, `api` | `local` | Override `--claude-tokenizer` via env |
|
|
352
|
+
| `TARE_ANTHROPIC_MODEL` | model ID | `claude-sonnet-4-6` | Model used for API-backed token counting |
|
|
353
|
+
| `TARE_DISABLE_ANTHROPIC_TOKEN_API` | `1` | unset | Disable API-backed counting even when requested |
|
|
354
|
+
|
|
355
|
+
## Security model
|
|
356
|
+
|
|
357
|
+
`tare-mcp` is local-first.
|
|
358
|
+
|
|
359
|
+
By default, it does not call cloud tokenization APIs.
|
|
360
|
+
|
|
361
|
+
Live inspection does execute configured stdio MCP server commands and calls configured hosted MCP URLs so it can ask them for their actual tool definitions.
|
|
362
|
+
|
|
363
|
+
Use `--no-exec` for static-only mode, but note that static-only mode is insufficient for packaged or hosted MCP servers because it cannot see exposed tool schemas.
|
|
364
|
+
|
|
365
|
+
`tare-mcp` redacts environment variable values and header values in logs, warnings, JSON, and errors.
|
|
366
|
+
|
|
367
|
+
## Config discovery
|
|
368
|
+
|
|
369
|
+
`tare-mcp` discovers MCP configs from common locations:
|
|
370
|
+
|
|
371
|
+
```txt
|
|
372
|
+
./.mcp.json
|
|
373
|
+
./mcp.json
|
|
374
|
+
./.cursor/mcp.json
|
|
375
|
+
./.vscode/mcp.json
|
|
376
|
+
~/.claude/mcp.json
|
|
377
|
+
~/Library/Application Support/Claude/claude_desktop_config.json
|
|
378
|
+
~/.config/Claude/claude_desktop_config.json
|
|
379
|
+
~/.config/claude/claude_desktop_config.json
|
|
380
|
+
~/.config/tare/mcp.json
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
Supported server maps:
|
|
384
|
+
|
|
385
|
+
```json
|
|
386
|
+
{
|
|
387
|
+
"mcpServers": {}
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
```json
|
|
392
|
+
{
|
|
393
|
+
"servers": {}
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
```json
|
|
398
|
+
{
|
|
399
|
+
"mcp": {
|
|
400
|
+
"servers": {}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
See [`examples/stdio.mcp.json`](examples/stdio.mcp.json) and [`examples/streamable-http.mcp.json`](examples/streamable-http.mcp.json).
|
|
406
|
+
|
|
407
|
+
## JSON usage
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
npx tare-mcp --json > tare-report.json
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
The JSON report includes:
|
|
414
|
+
|
|
415
|
+
- version and generation time
|
|
416
|
+
- summary counts
|
|
417
|
+
- per-server inspection mode and confidence
|
|
418
|
+
- both Claude and OpenAI cl100k estimates
|
|
419
|
+
- per-tool estimates
|
|
420
|
+
- overlap clusters
|
|
421
|
+
- recommendations
|
|
422
|
+
- warnings
|
|
423
|
+
|
|
424
|
+
Secrets from env vars and headers are redacted.
|
|
425
|
+
|
|
426
|
+
## PR regression checks
|
|
427
|
+
|
|
428
|
+
`tare-mcp diff` compares two `tare-mcp --json` reports. It is built for pull requests: generate a fresh report in CI, compare it to a committed baseline, and fail when the MCP surface grows beyond a threshold.
|
|
429
|
+
|
|
430
|
+
Diff mode only reads JSON files. It does not spawn stdio servers, call hosted MCP URLs, or re-run live inspection.
|
|
431
|
+
|
|
432
|
+
Create an auditable baseline and commit it:
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
mkdir -p .tare
|
|
436
|
+
npx tare-mcp --json > .tare/baseline.json
|
|
437
|
+
git add .tare/baseline.json
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Compare the current branch against that baseline:
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
npx tare-mcp --json > tare-report.json
|
|
444
|
+
npx tare-mcp diff --base .tare/baseline.json --head tare-report.json
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
Example output:
|
|
448
|
+
|
|
449
|
+
```txt
|
|
450
|
+
tare-mcp diff - MCP context regression
|
|
451
|
+
|
|
452
|
+
Base: .tare/baseline.json (0.2.0)
|
|
453
|
+
Head: tare-report.json (0.2.0)
|
|
454
|
+
|
|
455
|
+
Summary:
|
|
456
|
+
- Servers: 3 -> 4 (+1)
|
|
457
|
+
- Tools: 418 -> 443 (+25)
|
|
458
|
+
- Claude tokens: ~143,200 -> ~151,620 (~+8,420)
|
|
459
|
+
- OpenAI cl100k tokens: ~138,400 -> ~146,310 (~+7,910)
|
|
460
|
+
- Overlap clusters: 2 -> 3 (+1)
|
|
461
|
+
|
|
462
|
+
New servers:
|
|
463
|
+
- notion: 96 tools, ~41,800 Claude tokens
|
|
464
|
+
|
|
465
|
+
Largest changes to existing servers:
|
|
466
|
+
- github: 188 -> 200 (+12) tools, ~+8,420 Claude tokens
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
Fail a PR when context weight or tool surface grows too much:
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
npx tare-mcp diff \
|
|
473
|
+
--base .tare/baseline.json \
|
|
474
|
+
--head tare-report.json \
|
|
475
|
+
--max-token-increase 5000 \
|
|
476
|
+
--max-tool-increase 20 \
|
|
477
|
+
--max-server-increase 1 \
|
|
478
|
+
--max-overlap-increase 0
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Token thresholds use the Claude estimate by default. Use OpenAI cl100k estimates when that is the budget you care about:
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
npx tare-mcp diff \
|
|
485
|
+
--base .tare/baseline.json \
|
|
486
|
+
--head tare-report.json \
|
|
487
|
+
--max-token-increase 5000 \
|
|
488
|
+
--tokenizer openai
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
The selected tokenizer applies to threshold math and to the server/tool detail sections in human output. Token values are always rendered as estimates with `~`.
|
|
492
|
+
|
|
493
|
+
Human output shows new servers, removed servers, largest changes to existing servers, new tools, removed tools, changed tools, and overlap-cluster changes. JSON output is available for automation:
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
npx tare-mcp diff --base .tare/baseline.json --head tare-report.json --json
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
When a growth is intentional, regenerate `.tare/baseline.json` on the accepted setup and commit that change in the same PR.
|
|
500
|
+
|
|
501
|
+
Exit codes:
|
|
502
|
+
|
|
503
|
+
| Code | Meaning |
|
|
504
|
+
|---:|---|
|
|
505
|
+
| `0` | Diff completed and thresholds passed, or no thresholds were set. |
|
|
506
|
+
| `1` | A configured regression threshold was exceeded. |
|
|
507
|
+
| `2` | Invalid usage or invalid input, including missing files, invalid JSON, or missing report fields. |
|
|
508
|
+
|
|
509
|
+
Estimates are still estimates. The value of the baseline workflow is consistency: the same tool estimates are compared over time, so accidental MCP bloat becomes visible during review.
|
|
510
|
+
|
|
511
|
+
## CI usage
|
|
512
|
+
|
|
513
|
+
```yaml
|
|
514
|
+
name: MCP context budget
|
|
515
|
+
|
|
516
|
+
on:
|
|
517
|
+
pull_request:
|
|
518
|
+
|
|
519
|
+
jobs:
|
|
520
|
+
tare:
|
|
521
|
+
runs-on: ubuntu-latest
|
|
522
|
+
|
|
523
|
+
steps:
|
|
524
|
+
- uses: actions/checkout@v4
|
|
525
|
+
- uses: actions/setup-node@v4
|
|
526
|
+
with:
|
|
527
|
+
node-version: 20
|
|
528
|
+
- run: npx tare-mcp --budget 40000
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
For PR regression checks, commit `.tare/baseline.json` and compare the generated report in CI:
|
|
532
|
+
|
|
533
|
+
```yaml
|
|
534
|
+
name: MCP context regression
|
|
535
|
+
|
|
536
|
+
on:
|
|
537
|
+
pull_request:
|
|
538
|
+
|
|
539
|
+
jobs:
|
|
540
|
+
tare-mcp:
|
|
541
|
+
runs-on: ubuntu-latest
|
|
542
|
+
|
|
543
|
+
steps:
|
|
544
|
+
- uses: actions/checkout@v4
|
|
545
|
+
|
|
546
|
+
- uses: actions/setup-node@v4
|
|
547
|
+
with:
|
|
548
|
+
node-version: 20
|
|
549
|
+
|
|
550
|
+
- run: npx tare-mcp --json > tare-report.json
|
|
551
|
+
|
|
552
|
+
- run: |
|
|
553
|
+
npx tare-mcp diff \
|
|
554
|
+
--base .tare/baseline.json \
|
|
555
|
+
--head tare-report.json \
|
|
556
|
+
--max-token-increase 5000 \
|
|
557
|
+
--max-tool-increase 20 \
|
|
558
|
+
--max-overlap-increase 0
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
For CI systems that should not execute local MCP server commands, use static-only mode and treat the result as insufficient:
|
|
562
|
+
|
|
563
|
+
```bash
|
|
564
|
+
npx tare-mcp --no-exec --json
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
## Publishing to npm
|
|
568
|
+
|
|
569
|
+
This repository includes [`.github/workflows/publish-npm.yml`](.github/workflows/publish-npm.yml).
|
|
570
|
+
|
|
571
|
+
To publish from GitHub Actions:
|
|
572
|
+
|
|
573
|
+
1. Create an npm automation token.
|
|
574
|
+
2. Add it to the repository as `NPM_TOKEN`.
|
|
575
|
+
3. Publish a GitHub release or run the workflow manually.
|
|
576
|
+
|
|
577
|
+
The workflow runs:
|
|
578
|
+
|
|
579
|
+
```bash
|
|
580
|
+
pnpm install --frozen-lockfile
|
|
581
|
+
pnpm test
|
|
582
|
+
pnpm run lint
|
|
583
|
+
pnpm build
|
|
584
|
+
npm pack --dry-run
|
|
585
|
+
npm publish --access public --provenance
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
The npm package is named `tare-mcp` because the unscoped `tare` package name is already occupied on npm.
|
|
589
|
+
|
|
590
|
+
After the first npm release, users can install it with:
|
|
591
|
+
|
|
592
|
+
```bash
|
|
593
|
+
npm install --save-dev tare-mcp
|
|
594
|
+
npx tare-mcp
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
For one-off usage:
|
|
598
|
+
|
|
599
|
+
```bash
|
|
600
|
+
npx tare-mcp
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
The installed binary is named `tare-mcp`, so global installs work as `tare-mcp`:
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
npm install --global tare-mcp
|
|
607
|
+
tare-mcp
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
## CLI
|
|
611
|
+
|
|
612
|
+
```txt
|
|
613
|
+
Usage: tare-mcp [options]
|
|
614
|
+
|
|
615
|
+
Analyze MCP context weight and tool ambiguity.
|
|
616
|
+
|
|
617
|
+
MCP made tools easy to connect. It did not make them cheap to carry.
|
|
618
|
+
|
|
619
|
+
Options:
|
|
620
|
+
--no-exec Static-only mode. Does not spawn MCP servers or call hosted MCP URLs.
|
|
621
|
+
--timeout <ms> Live inspection timeout per server. Default: 5000.
|
|
622
|
+
--budget <tokens> Fail if estimated context weight exceeds budget.
|
|
623
|
+
--tokenizer <name> Budget tokenizer: claude or openai. Default: claude.
|
|
624
|
+
--json Output JSON report.
|
|
625
|
+
--claude-tokenizer <mode> Claude tokenizer mode: local or api. Default: local.
|
|
626
|
+
-h, --help Display help.
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
```txt
|
|
630
|
+
Usage: tare-mcp diff [options] [base-report] [head-report]
|
|
631
|
+
|
|
632
|
+
Compare two tare-mcp JSON reports without inspecting MCP servers.
|
|
633
|
+
|
|
634
|
+
Options:
|
|
635
|
+
--base <path> Baseline JSON report from tare-mcp --json.
|
|
636
|
+
--head <path> Head JSON report from tare-mcp --json.
|
|
637
|
+
--json Output JSON diff report.
|
|
638
|
+
--max-token-increase <tokens> Fail if token increase exceeds this value.
|
|
639
|
+
--max-tool-increase <tools> Fail if tool count increase exceeds this value.
|
|
640
|
+
--max-server-increase <servers> Fail if server count increase exceeds this value.
|
|
641
|
+
--max-overlap-increase <clusters> Fail if new overlap cluster count exceeds this value.
|
|
642
|
+
--tokenizer <name> Tokenizer for --max-token-increase: claude or openai. Default: claude.
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
## Roadmap
|
|
646
|
+
|
|
647
|
+
v0.2:
|
|
648
|
+
- [x] PR diff/regression mode for JSON reports
|
|
649
|
+
- [x] Threshold flags for token, tool, server, and overlap growth
|
|
650
|
+
|
|
651
|
+
Next:
|
|
652
|
+
- [ ] Per-tool schema breakdown
|
|
653
|
+
- [ ] Context budget config file (`tare.config.json`)
|
|
654
|
+
|
|
655
|
+
Later:
|
|
656
|
+
- [ ] Better SSE fallback
|
|
657
|
+
- [ ] Improved Claude local token estimator
|
|
658
|
+
- [ ] Opt-in API-backed token counting improvements
|
|
659
|
+
- [ ] Dedicated GitHub Action wrapper
|
|
660
|
+
- [ ] HTML reports
|
|
661
|
+
- [ ] MCP profile generator
|
|
662
|
+
- [ ] `tare-mcp --fix` to generate lean MCP profiles
|
|
663
|
+
|
|
664
|
+
Dashboards, profile generation, and auto-fix are intentionally not part of v0.2.
|
|
665
|
+
|
|
666
|
+
## License
|
|
667
|
+
|
|
668
|
+
MIT
|