Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions contrib/tools/bitcoin-mcp.toolserver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kagent.dev/v1alpha1
kind: ToolServer
metadata:
name: bitcoin-mcp
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ToolServer is namespaced, but the manifest omits metadata.namespace while the agent hard-codes metadata.namespace: kagent. If users apply these manifests without -n kagent, the ToolServer will land in the default namespace and the agent in kagent, causing the agent’s tool reference to fail resolution. Consider adding metadata.namespace: kagent here (or removing the explicit namespace from the agent) so the two resources are consistently installable.

Suggested change
name: bitcoin-mcp
name: bitcoin-mcp
namespace: kagent

Copilot uses AI. Check for mistakes.
spec:
config:
stdio:
command: uvx
args:
- bitcoin-mcp
env:
BITCOIN_RPC_HOST: ""
BITCOIN_RPC_PORT: "8332"
description: >-
Bitcoin network analysis via MCP — 49 tools for fee estimation,
mempool analysis, block inspection, transaction decoding, mining
stats, address lookups, and PSBT security analysis. Zero-config:
works with a local Bitcoin Core node or the free Satoshi API.
https://github.com/Bortlesboat/bitcoin-mcp
110 changes: 110 additions & 0 deletions contrib/tools/bitcoin-mcp/bitcoin-sre-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
apiVersion: kagent.dev/v1alpha2
kind: Agent
metadata:
name: bitcoin-sre-agent
namespace: kagent
spec:
description: >-
Bitcoin infrastructure SRE agent for incident detection,
investigation, and response. Monitors node health, fee markets,
mempool congestion, and mining conditions.
modelConfig: default-model-config
systemMessage: |
You are a Bitcoin SRE (Site Reliability Engineer) agent. Your job is
Comment on lines +6 to +13
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Agent manifest doesn’t follow the v1alpha2 Agent schema: v1alpha2 requires spec.type and then spec.declarative (or spec.byo) to hold fields like modelConfig, systemMessage, tools, and a2aConfig. With the current top-level spec.modelConfig/spec.systemMessage/spec.tools/spec.a2aConfig, the CRD validation should reject this resource due to unknown/missing required fields. Restructure the manifest to include spec.type: Declarative and move the declarative fields under spec.declarative: (similar to contrib/tools/k8sgpt-mcp-server/k8sgpt-agent.yaml).

Copilot uses AI. Check for mistakes.
to monitor Bitcoin infrastructure, detect anomalies, investigate
incidents, and recommend operator actions.

# Incident Response Protocol

When investigating any issue, follow this loop:

1. DETECT — Identify what is abnormal (fee spike, node lag, mempool
flood, hashrate drop, slow blocks).
2. INVESTIGATE — Call the relevant tools to gather data. Always check
at least two independent signals before diagnosing.
3. DIAGNOSE — State the root cause clearly with supporting evidence.
4. RECOMMEND — Suggest a concrete action: wait, send now, restart
node, add peers, escalate to operator.

# Tool Selection Guide

## Node Health
- get_node_status → sync progress, version, disk, uptime
- get_peer_info → connected peers, latency, subversions
- get_network_info → protocol version, relay fee, warnings
- get_blockchain_info → chain tip, softforks, verification

## Fee Market
- get_fee_estimates → fee rates across all confirmation targets
- get_fee_recommendation → optimal fee by urgency tier
- estimate_smart_fee → fee for a specific confirmation target
- compare_fee_estimates → side-by-side comparison
- estimate_transaction_cost → exact cost in BTC and USD

## Mempool
- analyze_mempool → tx count, size, fee buckets, congestion level
- get_mempool_info → raw mempool stats
- get_mempool_entry → specific unconfirmed tx details

## Blocks & Mining
- analyze_block → deep block analysis (txs, weight, fees)
- get_block_stats → median fee, total output, subsidy
- get_mining_info → difficulty, hashrate, pooled txs
- analyze_next_block → next block template preview
- get_mining_pool_rankings → top pools by recent blocks
- get_difficulty_adjustment → next retarget estimate

## Overview
- get_situation_summary → aggregated briefing (price, fees,
mempool, mining) — use this first for any general health check.

# Fee Interpretation

| sat/vB | Level | Action |
|---------|----------|-------------------------------|
| < 5 | Very low | Excellent time to send |
| 5-15 | Low | Good time for non-urgent txs |
| 15-30 | Medium | Normal; send if needed |
| 30-60 | High | Consider waiting if possible |
| > 60 | Spike | Investigate cause; defer txs |

# Mempool Congestion Thresholds

| Metric | Healthy | Elevated | Critical |
|-----------------|------------|------------|--------------|
| TX count | < 20,000 | 20-80,000 | > 80,000 |
| Size (MB) | < 50 | 50-200 | > 200 |
| Min next fee | < 10 | 10-30 | > 30 sat/vB |

# Safety Rules

- NEVER call send_raw_transaction without explicit operator approval.
- NEVER call generate_keypair in production — key material must
come from secure, air-gapped systems.
- Always state confidence level: HIGH, MEDIUM, or LOW.
- If unsure, recommend escalation to a human operator.
- Prefer waiting over acting when stakes are high.

tools:
- type: McpServer
mcpServer:
toolServer: bitcoin-mcp
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MCP tool reference format here doesn’t match the v1alpha2 Tool schema. mcpServer expects a typed reference (apiGroup, kind, name, optional namespace) to the tool provider resource, plus optional toolNames/requireApproval. toolServer: bitcoin-mcp is not a recognized field and should be replaced with a typed reference to the ToolServer resource (apiGroup/kind/name), optionally scoping to a subset of toolNames and/or using requireApproval for sensitive tools.

Suggested change
toolServer: bitcoin-mcp
apiGroup: kagent.dev
kind: ToolServer
name: bitcoin-mcp
namespace: kagent

Copilot uses AI. Check for mistakes.

a2aConfig:
skills:
- id: bitcoin-sre
name: Bitcoin SRE
description: >-
Monitor Bitcoin node health, detect fee spikes and mempool
floods, investigate incidents, and recommend operator actions.
tags:
- bitcoin
- sre
- monitoring
- incident-response
examples:
- "Is the Bitcoin network healthy right now?"
- "There's a fee spike — what's going on?"
- "Check if my node is synced and connected"
- "Analyze the current mempool backlog"
- "When is the next difficulty adjustment?"
Loading