xBridge MCP v3.0.0 — Pre-Shipment Review
Reviewer: pre-shipment-reviewer
Date: 2026-06-30
Scope: usability, security, bugs, code quality, possible upgrades
BUG: Chain operations produce garbled output
Severity: High (functional)
File: xbridge_mcp/server.py:1430-1432, xbridge_mcp/tool_chains.py:127-136
Chain step 2 references {last_result} in its template. ToolChain._prepare_arguments resolves it via str() on a CallToolResult MCP object, yielding something like <mcp.types.CallToolResult at 0x...> instead of actual response text.
execute_chain_with_extraction only unwraps CallToolResult after all steps complete — too late for template resolution. All three chain tools are affected:
grok-chain-search-summarize (step 2 feeds search results into summarizer)
grok-chain-research (step 3 synthesises web + X results)
grok-chain-debug (step 2 generates fix from X findings)
Fix: Extract text from each step's CallToolResult before storing in context, or unwrap inside _prepare_arguments.
BUG: Version mismatch
Severity: Low
File: xbridge_mcp/__init__.py:11
__version__ = "2.1.0" but pyproject.toml and server.json both say "3.0.0". Breaks __version__ introspection.
Security Findings
| # |
Issue |
File |
Severity |
Detail |
| S1 |
Free-limit check is per-process, in-memory |
tokenizer.py:71-82 |
Medium |
Restart resets counter. All anonymous users share one bucket (key "anon"). After 50 total calls server-wide, free tier is blocked for everyone. |
| S2 |
HTTP key endpoint has no rate limiting |
http_server.py:120-144 |
Medium |
/keys/free issues signed Ed25519 license keys with no throttling. LS_SIGNING_SECRET webhook verification is bypassed if env var unset. |
| S3 |
Session data at rest in plaintext |
session_manager.py |
Low |
.grok_sessions/*.json stores full conversation history unencrypted. Documented but worth noting for users handling sensitive data. |
| S4 |
No input validation on session_id |
session_manager.py:204-206 |
Low |
Server-generated UUIDs make path traversal unlikely, but session_id flows directly into file paths for read/delete. |
| S5 |
Usage tracker stores truncated API key prefix |
token_counter.py:108 |
Low |
First 12 chars of XAI_API_KEY written to .grok_usage/usage.json. |
Usability & Code Quality
| # |
Issue |
File |
Detail |
| Q1 |
server.py too large |
server.py (~1961 lines) |
Violates project convention of small focused functions. Hard to navigate. |
| Q2 |
Unpinned dependencies |
pyproject.toml:28-29 |
mcp>=1.0.0, httpx>=0.27.0 — no lockfile. Breaking upstream release could silently break production. |
| Q3 |
No conversation history limit |
session_manager.py |
Unbounded growth of session JSON files. Heavy users accumulate MB per session. |
| Q4 |
Template resolution in chains is fragile |
tool_chains.py:127-136 |
str.replace() on {last_result} — if a result contains {step_0_result}, it gets re-replaced. Low probability but fragile. |
| Q5 |
No integration tests for chain execution |
tests/test_tool_chains.py |
Only tests ChainBuilder construction (dataclass setup). No test exercises the full chain through execute_chain_with_extraction. |
| Q6 |
No __all__ in __init__.py |
__init__.py |
from xbridge_mcp import * is a no-op. |
Recommended Upgrades
- Split server.py into per-domain handler modules (chat, search, sessions, chains, image/video, docs).
- Add conversation history pruning — max N messages, TTL-based cleanup, or configurable limit.
- Add persistent rate limiting — file-backed counters, not in-memory dict that resets on restart.
- Pin dependency versions — generate a lockfile or switch to exact pins.
- Add streaming support — MCP SSE transport for chat responses.
- Expose structured output / JSON mode — Grok models support it; add parameter to
grok-chat.
- Add MCP resource support — currently only tools, no resources (e.g., health, session list).
- Rate-limit HTTP key endpoints before public launch of the license key infrastructure.
- Add health check as an MCP resource — currently only available via the separate HTTP server.
xBridge MCP v3.0.0 — Pre-Shipment Review
Reviewer: pre-shipment-reviewer
Date: 2026-06-30
Scope: usability, security, bugs, code quality, possible upgrades
BUG: Chain operations produce garbled output
Severity: High (functional)
File:
xbridge_mcp/server.py:1430-1432,xbridge_mcp/tool_chains.py:127-136Chain step 2 references
{last_result}in its template.ToolChain._prepare_argumentsresolves it viastr()on aCallToolResultMCP object, yielding something like<mcp.types.CallToolResult at 0x...>instead of actual response text.execute_chain_with_extractiononly unwraps CallToolResult after all steps complete — too late for template resolution. All three chain tools are affected:grok-chain-search-summarize(step 2 feeds search results into summarizer)grok-chain-research(step 3 synthesises web + X results)grok-chain-debug(step 2 generates fix from X findings)Fix: Extract text from each step's
CallToolResultbefore storing in context, or unwrap inside_prepare_arguments.BUG: Version mismatch
Severity: Low
File:
xbridge_mcp/__init__.py:11__version__ = "2.1.0"butpyproject.tomlandserver.jsonboth say"3.0.0". Breaks__version__introspection.Security Findings
tokenizer.py:71-82"anon"). After 50 total calls server-wide, free tier is blocked for everyone.http_server.py:120-144/keys/freeissues signed Ed25519 license keys with no throttling.LS_SIGNING_SECRETwebhook verification is bypassed if env var unset.session_manager.py.grok_sessions/*.jsonstores full conversation history unencrypted. Documented but worth noting for users handling sensitive data.session_manager.py:204-206session_idflows directly into file paths for read/delete.token_counter.py:108XAI_API_KEYwritten to.grok_usage/usage.json.Usability & Code Quality
server.py(~1961 lines)pyproject.toml:28-29mcp>=1.0.0,httpx>=0.27.0— no lockfile. Breaking upstream release could silently break production.session_manager.pytool_chains.py:127-136str.replace()on{last_result}— if a result contains{step_0_result}, it gets re-replaced. Low probability but fragile.tests/test_tool_chains.pyChainBuilderconstruction (dataclass setup). No test exercises the full chain throughexecute_chain_with_extraction.__all__in__init__.py__init__.pyfrom xbridge_mcp import *is a no-op.Recommended Upgrades
grok-chat.