blockchain-pattern MCP
Blockchain design pipeline exposed by the blockchain-pattern MCP server on this host:
- Analyse requirements + domain → recommended style, top-k patterns with requirements-weighted scores, the selected patterns' aggregate quality profile, matched domain slugs
- Generate the design: overview, components, relationships, quality attributes, API contracts, shared data models, event contracts
- Evaluate against quality attributes → per-metric scores, findings, recommendations keyed by area
- Refine — regenerates while the best score stays below 50, up to
retrieval.max_triesattempts (config default 3)
109 built-in patterns (one JSON file each in the server's pattern directory), 24 BlockchainDomain slugs, 16 pattern categories, 4 workflow prompts, 11 tools.
OMP constraints (read first)
1. OMP is a short-timeout client → the async job trio is the default design entry point
OMP applies one MCP request deadline, resolved in this order: OMP_MCP_TIMEOUT_MS env → the server's timeout field (milliseconds) in ~/.omp/agent/mcp.json → 30 000 ms default. It is a single timer per request (src/mcp/timeout.ts, src/mcp/transports/http.ts); server progress notifications do not extend it, so the server's 30 s heartbeat buys nothing here.
If the blockchain-pattern entry in ~/.omp/agent/mcp.json sets no timeout, the 30 s deadline applies. Every LLM-backed tool exceeds it — the pipeline shape is the same one measured on the sibling pattern server from the other catalogue, where analyse took ~66 s, generate ~211 s, evaluate ~197 s, and the full design 5–10 minutes:
| Call | Device | Latency |
|---|---|---|
submit_blockchain_design_job | xd://mcp__blockchain_pattern_submit_blockchain_design_job | milliseconds |
get_blockchain_design_status | xd://mcp__blockchain_pattern_get_blockchain_design_status | milliseconds |
cancel_blockchain_design | xd://mcp__blockchain_pattern_cancel_blockchain_design | milliseconds |
list_blockchain_patterns / get_blockchain_pattern | catalog devices | milliseconds |
analyze_blockchain | xd://mcp__blockchain_pattern_analyze_blockchain | ~1 min → aborted at 30 s by OMP |
generate_blockchain | xd://mcp__blockchain_pattern_generate_blockchain | ~3.5 min → aborts |
evaluate_blockchain | xd://mcp__blockchain_pattern_evaluate_blockchain | ~3 min → aborts |
design_blockchain | xd://mcp__blockchain_pattern_design_blockchain | 5–10 min → aborts |
Attempting the one-shot call under the default deadline yields, verbatim:
MCP failure
server: blockchain-pattern
tool: analyze_blockchain
transport: http
stage: receive
failure: timeout
retryable: no
message: Request timeout after 30000ms
next: Check server health or increase the MCP timeout; the request outcome is unknown.
The timeout does not stop the server: the aborted call keeps running and its result goes nowhere. The outcome is unknown — a background job submitted before the timeout keeps running and can still be polled. The server's own tool descriptions call design_blockchain the default for callers that want the design artifact and the job trio "only for clients with short request timeouts (Cursor, Claude Desktop)"; under OMP's 30 s deadline OMP is that client — use the job trio for designs, whose result survives in the server's job store. analyze_blockchain (the guidance-only path for coding agents that write their own code) has no async job: raise the deadline first, as described below.
To run the blocking one-shot pipeline instead, add the server (or raise the deadline on the existing entry) under mcpServers in ~/.omp/agent/mcp.json:
"mcpServers": {
"blockchain-pattern": {
"type": "http",
"url": "http://localhost:8823/mcp",
"timeout": 900000
}
}
Port 8823 is the dev compose stack (README Path A, default); use 8813 for the persistent systemd stack (Path B) — match the stack you actually run (see README.md / INSTALL.md).
"timeout": 0 disables client-side MCP timeouts for the server. Then /mcp reload. A project .omp/mcp.json entry shadows the user entry; the user file's disabledServers/enabledServers win over both.
For non-OMP clients: the job trio works everywhere; the blocking tools need a request deadline of ≥ 10 minutes (or progress-heartbeat support, which this server emits every 30 s).
2. Tools are xd:// devices
write xd://mcp__blockchain_pattern_<tool> JSON args object → tool result
read xd://mcp__blockchain_pattern_<tool> device doc + current input schema
Device prefix = server name lowercased with - → _ (blockchain-pattern → mcp__blockchain_pattern). Invalid args echo the schema — fix the JSON and retry, do not switch tools.
3. domain and style are separate arguments — never embed them in requirements
requirements— free text of what the system must do (1–100 000 chars, printable; control/format characters are rejected)domain— problem-space tag (1–200 chars, e.g.bridge,defi-trading,l2-scaling,wallet); drives BM25 + dense + cross-encoder pattern retrieval over 24 category/layer slugs. Results are{slug, fusion_score, rerank_score}inmatched_domains. A pattern matches when the slug equals itscategoryor itslayer.style/override_style— blockchain design decision (1–100 000 chars), one of the 109BlockchainStylenames; the same vocabulary as pattern names, e.g.zk-rollup,optimistic-rollup,state-channel,constant-product-amm,erc4337.override_style(design/submit) andstyle(generate) win over the analyse-derived style.
An unknown style string is not rejected: guidance falls back to a generic default and the override flows into generation. If the top requirements-weighted analysis_score is below retrieval.style_score_threshold (default 50), recommended_style is substituted with state-channel and style_fallback: true is set (selected_patterns still holds the real scored candidates). is_fallback: true is the separate, rarer case where stage-1 recall found no real candidate at all — expected behaviour, not an error, in both cases.
4. Do not read patterns through mcp://pattern://… on this host
The server advertises pattern://, pattern://{name}, template://{name}, component://{type}, and OMP reads MCP resources with read mcp://<resource-uri>. But the other pattern servers connected on this host register the same three schemes, and OMP resolves a resource URI by server order (src/internal-urls/mcp-protocol.ts), not by which server owns the resource — the sibling wins and returns its own catalogue or a Pattern not found error even when this server serves the name. Use get_blockchain_pattern / list_blockchain_patterns — the tool route is authoritative and unambiguous.
5. Job ids are the only durable handle
submit_blockchain_design_job returns a job_id and the server persists jobs in SQLite (~/.config/blockchain-pattern-mcp/jobs.db, override BLOCKCHAIN_PATTERN_JOBS_DB) — there is no job-listing tool. A job_id survives a turn boundary, a client restart, or an OMP timeout, but only if you keep it: write it to a scratch file (e.g. .omp/blockchain-pattern-job.txt) when the poll loop may outlive the turn.
Entry-point decision guide
Existing design to score?
├── YES → evaluate_blockchain (device mcp__blockchain_pattern_evaluate_blockchain)
└── NO
├── Coding agent will write the implementation itself
│ → analyze_blockchain: recommended style, pattern cards, pattern quality profile — no design artifact
│ (one lightweight LLM call ~1 min; raise the server timeout first, there is no analyze-only job)
├── Explore the catalog first → list_blockchain_patterns (category?/domain?) → get_blockchain_pattern(name)
├── Caller wants the design artifact → job trio: submit_blockchain_design_job → get_blockchain_design_status
│ (use design_blockchain directly only when the server timeout in
│ ~/.omp/agent/mcp.json is >= 600000 or 0)
└── Known style + patterns → generate_blockchain (skips the analyse leg)
Device quick reference
| Device suffix | Purpose | Latency | Notes |
|---|---|---|---|
design_blockchain | Finished design artifact + evaluation, one call | 5–10 min | for callers that want the design; needs a raised MCP timeout |
analyze_blockchain | Style + pattern cards for agents that write their own code; no design artifact | ~1 min | guidance-only path; aborts under the 30 s deadline — raise the timeout first |
generate_blockchain | Design from explicit style + selected_patterns | ~3.5 min | aborts under the 30 s deadline |
evaluate_blockchain | Score an existing design dict | ~3 min | aborts under the 30 s deadline |
submit_blockchain_design_job | Start pipeline, returns job_id | ms | default design entry point |
get_blockchain_design_status | Poll job; result when completed | ms | idempotent |
cancel_blockchain_design | Best-effort cancel at stage boundary | ms | not idempotent |
list_blockchain_patterns | Minimal pattern view (name, description) | ms | idempotent; unknown category returns [] |
get_blockchain_pattern | Full pattern JSON by exact name | ms | idempotent; unknown name raises Pattern not found: <name> |
list_prompts, get_prompt | Workflow prompt templates | fast | tool route for prompt clients |
Job trio recipe
- Submit —
write xd://mcp__blockchain_pattern_submit_blockchain_design_jobwith{"requirements": "...", "domain": "...", "override_style": null}→{"job_id": "<uuid>", "status": "pending", "message": "Job <uuid> created. Poll get_blockchain_design_status('<uuid>') until status is 'completed', 'failed', or 'cancelled'."} - Persist the
job_id(see constraint 5) before polling. - Poll —
write xd://mcp__blockchain_pattern_get_blockchain_design_statuswith{"job_id": "..."}every 10–30 s (interleave other work orbash sleep 15); branch onstatus:
| Status | message | Action |
|---|---|---|
pending | Job is queued, not yet started. | poll again after 10–30 s |
running | Job is actively running the design pipeline. | poll again after 10–30 s |
completed | Job completed successfully. | read result (same schema as design_blockchain) |
failed | Job failed — see the error field. | report error |
cancelled | Job was cancelled by a cancel_blockchain_design call. | report; offer to resubmit |
- Cancel —
write xd://mcp__blockchain_pattern_cancel_blockchain_designwith{"job_id": "..."}→{"job_id": "...", "status": "cancelled", "cancelled": true, "task_was_running": true, "message": "..."}. Best-effort: the pipeline checks the flag at stage boundaries, so up to one LLM call may still land. Jobs alreadycompleted/failed/cancelledreturncancelled: false; unknown ids raiseERR_404.
Interpreting results
final_quality_score(0–100): ≥ 75 strong, 50–74 workable with named tradeoffs, < 50 means the pipeline regenerated and still returned its best attemptattempts(1–3 with the defaultmax_tries): > 1 means the pipeline self-healed — readevaluation.recommendationsto see what changedevaluation.summary.overall_score(0–100),strengths,weaknesses,critical_findings;evaluation.metrics[]carries{name, score 0–100, description, findings, recommendations, reasoning}per attribute- The quality attributes are the eight keys attested in
docs/pattern-schema.json:security,cost_efficiency,scalability,decentralization,composability,liquidity,simplicity,privacy evaluation.recommendationsis a map keyed by area ({"security": [...], "decentralization": [...]});evaluate_blockchainflattens it to a list and scores 0–10final_style+alternative_styles({name, score}runner-ups, excluding the delivered style; empty on fallback) — present a genuine second option instead of an invented comparisonmatched_domains: retrieval slugs withfusion_score/rerank_score; a low topanalysis_score(→style_fallback: true) or empty recall (is_fallback: true) explains thestate-channelsubstitutionanalyze_blockchainextras:requirement_weights(0.0–1.0 per attribute; drove the deterministic ranking) andstyle_fallback(true whenrecommended_styleis the fallback);evaluate_blockchainaddsintegrity_findings(advisory DIV-N notes, never blocking)
Prompts (workflow templates)
Interactive OMP sessions expose each server prompt as a slash command named <server>:<prompt>, with key=value arguments:
/blockchain-pattern:design_blockchain_workflow requirements="..." domain="bridge" style="optimistic-rollup"
/blockchain-pattern:explore_pattern_catalog domain="defi-trading" category="mev"
/blockchain-pattern:evaluate_my_blockchain focus="security"
/blockchain-pattern:compare_blockchain_styles style_a="zk-rollup" style_b="optimistic-rollup" requirements="..."
/mcp prompts lists what is connected. Outside the interactive TUI, call the tool route instead: write xd://mcp__blockchain_pattern_get_prompt with {"name": "design_blockchain_workflow", "arguments": {"requirements": "...", "domain": "..."}} (arguments: requirements*, domain, style for the design workflow; style_a*, style_b*, requirements* for the comparison — that one costs two generate_blockchain calls).
Reference files
skill://blockchain-pattern-mcp/references/tools.md— per-tool schemas, exact output fields, error codes, the deadline-failure format, tool annotations, and the design-dict shapeskill://blockchain-pattern-mcp/references/workflows.md— recipes (job trio, raised-timeout one-shot, catalog → generate, evaluate, prompts), result interpretation, and OMP troubleshooting
skill://blockchain-pattern-mcp/... URIs resolve to files beside this SKILL.md; bare references/... paths resolve against the session cwd and will dangle.