@crabeye-ai/crabeye-mcp-bridge 0.3.0 → 0.5.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/README.md CHANGED
@@ -47,7 +47,13 @@ Say your MCP client config looks like this today:
47
47
  }
48
48
  ```
49
49
 
50
- To use the bridge, rename `mcpServers` to `upstreamMcpServers` and add the bridge as the only entry in `mcpServers`:
50
+ First, store your secrets in the encrypted credential store:
51
+
52
+ ```bash
53
+ crabeye-mcp-bridge credential set github-pat ghp_abc123
54
+ ```
55
+
56
+ Then rename `mcpServers` to `upstreamMcpServers`, add the bridge, and replace hardcoded tokens with `${credential:key}` references:
51
57
 
52
58
  ```json
53
59
  {
@@ -66,7 +72,7 @@ To use the bridge, rename `mcpServers` to `upstreamMcpServers` and add the bridg
66
72
  "command": "npx",
67
73
  "args": ["-y", "@anthropic/github-mcp-server"],
68
74
  "env": {
69
- "GITHUB_TOKEN": "ghp_..."
75
+ "GITHUB_TOKEN": "${credential:github-pat}"
70
76
  }
71
77
  }
72
78
  }
@@ -94,7 +100,7 @@ Alternatively, you can add the bridge alongside your existing `mcpServers` entri
94
100
  "command": "npx",
95
101
  "args": ["-y", "@anthropic/github-mcp-server"],
96
102
  "env": {
97
- "GITHUB_TOKEN": "ghp_..."
103
+ "GITHUB_TOKEN": "${credential:github-pat}"
98
104
  }
99
105
  }
100
106
  }
@@ -118,6 +124,25 @@ The AI assistant calls `search_tools` automatically when it detects a relevant i
118
124
 
119
125
  When `search_tools` is called, the assistant receives the matching tools and their input schemas. The bridge also directly exposes the searched tools to the assistant so they can be called natively. Some assistants don't refresh their tool list mid-session, so they may not see the newly exposed tools — but they can still call them through `run_tool` and the call is executed exactly as if made directly on the original tool.
120
126
 
127
+ Every `search_tools` response includes a `session_stats` object showing how many tokens the bridge is saving compared to exposing all upstream tool definitions directly:
128
+
129
+ ```json
130
+ {
131
+ "session_stats": {
132
+ "tokens_saved": 11200,
133
+ "baseline_tokens": 14200,
134
+ "bridge_tokens": 3000
135
+ },
136
+ "results": [...]
137
+ }
138
+ ```
139
+
140
+ - **`baseline_tokens`** — estimated tokens if all upstream tool definitions were injected into context without the bridge
141
+ - **`bridge_tokens`** — cumulative tokens used by the bridge's two meta-tools plus all search results returned so far
142
+ - **`tokens_saved`** — the difference (baseline − bridge)
143
+
144
+ Token counts are estimated using a chars/4 heuristic. Suppress this with `--no-stats`.
145
+
121
146
  ## Examples
122
147
 
123
148
  ### Discovering providers
@@ -366,7 +391,46 @@ The assistant can then search by category: `{ "queries": [{ "category": "design"
366
391
 
367
392
  ### Authentication
368
393
 
369
- Static credentials (API keys, tokens) can be passed via `env` or `headers` in the server config. OAuth is not yet supported.
394
+ Secrets belong in the encrypted credential store, not in config files. Store a secret once, then reference it with `${credential:key}` in `env` or `headers`:
395
+
396
+ ```bash
397
+ # Store credentials
398
+ crabeye-mcp-bridge credential set github-pat ghp_abc123
399
+ crabeye-mcp-bridge credential set remote-api-key sk_live_xyz
400
+ ```
401
+
402
+ ```json
403
+ {
404
+ "upstreamMcpServers": {
405
+ "github": {
406
+ "command": "npx",
407
+ "args": ["-y", "@anthropic/github-mcp-server"],
408
+ "env": { "GITHUB_TOKEN": "${credential:github-pat}" }
409
+ },
410
+ "remote-api": {
411
+ "url": "https://mcp.example.com/sse",
412
+ "type": "sse",
413
+ "headers": { "Authorization": "Bearer ${credential:remote-api-key}" }
414
+ }
415
+ }
416
+ }
417
+ ```
418
+
419
+ Templates are resolved on every connect and reconnect, so rotating a credential takes effect without restarting the bridge.
420
+
421
+ **How it works:** Credentials are encrypted with AES-256-GCM. The master key is stored in your OS keychain (macOS Keychain, Linux secret-tool, Windows Credential Manager). Set `MCP_BRIDGE_MASTER_KEY` (64 hex chars) to use a static key instead.
422
+
423
+ **CLI commands:**
424
+
425
+ | Command | Description |
426
+ |---------|-------------|
427
+ | `credential set <key> [value]` | Store a plain string secret |
428
+ | `credential set <key> --json '<json>'` | Store a typed credential (bearer/oauth2/secret) |
429
+ | `credential get <key>` | Retrieve a credential (masked by default, `--show-secret` for full) |
430
+ | `credential delete <key>` | Delete a stored credential |
431
+ | `credential list` | List all stored credential keys |
432
+
433
+ Pipe-friendly: `echo "ghp_abc123" | crabeye-mcp-bridge credential set github-pat`
370
434
 
371
435
  ### Tool policies
372
436
 
@@ -406,17 +470,62 @@ Policies cascade in this order (first match wins):
406
470
 
407
471
  In this example, all Linear tools require confirmation except `list_issues` (runs freely) and `delete_issue` (blocked). Tools from other servers use the global default (`"always"`).
408
472
 
473
+ ### Rate limiting
474
+
475
+ Prevent the bridge from exceeding upstream API quotas by setting per-server rate limits. When the limit is hit, calls wait in a FIFO queue until the sliding window opens — the LLM just sees slightly higher latency instead of an error.
476
+
477
+ ```json
478
+ {
479
+ "upstreamMcpServers": {
480
+ "github": {
481
+ "command": "npx",
482
+ "args": ["-y", "@anthropic/github-mcp-server"],
483
+ "_bridge": {
484
+ "rateLimit": {
485
+ "maxCalls": 30,
486
+ "windowSeconds": 60
487
+ }
488
+ }
489
+ }
490
+ }
491
+ }
492
+ ```
493
+
494
+ In this example, the bridge allows at most 30 tool calls to the `github` server per 60-second sliding window. If a 31st call arrives before the window slides, it waits until a slot opens. If the wait exceeds 30 seconds, the call fails with an error.
495
+
496
+ Rate limit configuration is hot-reloadable — changes take effect without restarting the bridge.
497
+
409
498
  ## CLI
410
499
 
411
500
  ```
412
501
  npx @crabeye-ai/crabeye-mcp-bridge --config <path>
413
502
  ```
414
503
 
415
- | Flag | Description |
416
- |------|-------------|
504
+ | Flag / Subcommand | Description |
505
+ |-------------------|-------------|
417
506
  | `-c, --config <path>` | Path to config file (required, or set `MCP_BRIDGE_CONFIG`) |
507
+ | `--validate` | Validate config and list upstream servers, then exit |
508
+ | `--no-stats` | Suppress `session_stats` from `search_tools` responses |
418
509
  | `-V, --version` | Print version |
419
510
  | `-h, --help` | Print help |
511
+ | `credential set <key> [value]` | Store a credential (plain string, `--json` for typed, or pipe stdin) |
512
+ | `credential get <key>` | Retrieve a credential (`--show-secret` to unmask) |
513
+ | `credential delete <key>` | Delete a stored credential |
514
+ | `credential list` | List all stored credential keys |
515
+
516
+ ### Validating your config
517
+
518
+ Use `--validate` to check your config file without starting the bridge:
519
+
520
+ ```
521
+ $ npx @crabeye-ai/crabeye-mcp-bridge --config config.json --validate
522
+ Config OK — 3 upstream servers
523
+ linear (stdio) [project management]
524
+ github (stdio)
525
+ sentry (streamable-http)
526
+ ```
527
+
528
+ Exits with code 0 on success, code 1 on validation errors.
420
529
 
421
530
  ## License
422
531