Skip to content

Commit 82f6f70

Browse files
authored
Claude Desktop Extension build script (#201)
1 parent babb439 commit 82f6f70

File tree

5 files changed

+242
-4
lines changed

5 files changed

+242
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,21 @@ docker pull ghcr.io/blockscout/mcp-server:latest
257257
To run the Docker container in HTTP mode with port mapping:
258258

259259
```bash
260-
docker run --rm -p 8000:8000 ghcr.io/blockscout/mcp-server:latest --http --http-host 0.0.0.0
260+
docker run --rm -p 8000:8000 ghcr.io/blockscout/mcp-server:latest python -m blockscout_mcp_server --http --http-host 0.0.0.0
261261
```
262262

263263
With custom port:
264264

265265
```bash
266-
docker run --rm -p 8080:8080 ghcr.io/blockscout/mcp-server:latest --http --http-host 0.0.0.0 --http-port 8080
266+
docker run --rm -p 8080:8080 ghcr.io/blockscout/mcp-server:latest python -m blockscout_mcp_server --http --http-host 0.0.0.0 --http-port 8080
267267
```
268268

269269
**HTTP Mode with REST API:**
270270

271271
To run with the REST API enabled:
272272

273273
```bash
274-
docker run --rm -p 8000:8000 ghcr.io/blockscout/mcp-server:latest --http --rest --http-host 0.0.0.0
274+
docker run --rm -p 8000:8000 ghcr.io/blockscout/mcp-server:latest python -m blockscout_mcp_server --http --rest --http-host 0.0.0.0
275275
```
276276

277277
**Note:** When running in HTTP mode with Docker, use `--http-host 0.0.0.0` to bind to all interfaces so the server is accessible from outside the container.

dxt/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,35 @@ The reasons for this are:
2121

2222
## Packaging instructions
2323

24+
### Automated Build (Recommended)
25+
26+
For automated building using the provided build script:
27+
28+
**Production mode (default):**
29+
30+
```shell
31+
docker run --rm -it -v "$(pwd)"/dxt:/workspace -w /workspace node:20-slim bash -c "./build.sh"
32+
# or explicitly:
33+
docker run --rm -it -v "$(pwd)"/dxt:/workspace -w /workspace node:20-slim bash -c "./build.sh prod"
34+
```
35+
36+
**Development mode:**
37+
38+
```shell
39+
docker run --rm -it -v "$(pwd)"/dxt:/workspace -w /workspace node:20-slim bash -c "./build.sh dev"
40+
```
41+
42+
#### Build Modes
43+
44+
- **Production (`prod`)**: Uses `manifest.json` and connects to the official `https://mcp.blockscout.com/mcp/` server. Creates `blockscout-mcp.dxt`.
45+
- **Development (`dev`)**: Uses `manifest-dev.json` with configurable URL and creates `blockscout-mcp-dev.dxt`. Users can configure the Blockscout MCP server URL during installation in Claude Desktop.
46+
47+
This will automatically handle all the steps below and create the extension at `dxt/_build/blockscout-mcp[--dev].dxt`.
48+
49+
### Manual Build
50+
51+
For manual building or if you prefer step-by-step control:
52+
2453
1. This step is optional and required only if there is no local Node.js installation.
2554

2655
For the project directory run:

dxt/build.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/bash
2+
3+
# Build script for Blockscout MCP Server Desktop Extension
4+
# This script can be run inside the Docker container to build the extension automatically
5+
#
6+
# Usage: ./build.sh [mode]
7+
# mode: "prod" (default) or "dev"
8+
9+
set -e # Exit on any error
10+
11+
# Parse arguments
12+
MODE="${1:-prod}"
13+
14+
if [[ "$MODE" != "prod" && "$MODE" != "dev" ]]; then
15+
echo "❌ Error: Mode must be 'prod' or 'dev'"
16+
echo "Usage: $0 [prod|dev]"
17+
exit 1
18+
fi
19+
20+
echo "🚀 Building Blockscout MCP Server Desktop Extension (${MODE} mode)..."
21+
22+
# Step 1: Install system dependencies
23+
echo "📦 Installing system dependencies..."
24+
apt-get update -qq
25+
apt-get install -y openssl
26+
27+
# Step 2: Install DXT CLI
28+
echo "🔧 Installing DXT CLI..."
29+
npm install -g @anthropic-ai/dxt
30+
31+
# Step 3: Prepare build directory
32+
echo "📂 Preparing build directory..."
33+
if [ -d "_build" ]; then
34+
echo " Cleaning existing _build directory..."
35+
rm -rf _build
36+
fi
37+
38+
mkdir _build
39+
40+
# Step 4: Copy required files based on mode
41+
echo "📋 Copying manifest and assets..."
42+
if [[ "$MODE" == "dev" ]]; then
43+
echo " Using development manifest (manifest-dev.json)"
44+
cp manifest-dev.json _build/manifest.json
45+
else
46+
echo " Using production manifest (manifest.json)"
47+
cp manifest.json _build/
48+
fi
49+
cp blockscout.png _build/
50+
51+
# Step 5: Change to build directory and install dependencies
52+
echo "📦 Installing mcp-remote dependency..."
53+
cd _build
54+
npm install [email protected]
55+
56+
# Step 6: Package the extension
57+
echo "📦 Packaging extension..."
58+
if [[ "$MODE" == "dev" ]]; then
59+
DXT_FILENAME="blockscout-mcp-dev.dxt"
60+
else
61+
DXT_FILENAME="blockscout-mcp.dxt"
62+
fi
63+
dxt pack . "$DXT_FILENAME"
64+
65+
# Step 7: Sign the extension
66+
echo "✍️ Signing extension..."
67+
dxt sign "$DXT_FILENAME" --self-signed
68+
69+
# Step 8: Verify the extension
70+
echo "✅ Verifying extension..."
71+
if dxt verify "$DXT_FILENAME"; then
72+
echo " ✅ Extension signature verified successfully"
73+
else
74+
echo " ⚠️ Extension verification failed (expected for self-signed certificates)"
75+
echo " ℹ️ This is normal when using self-signed certificates and won't affect functionality"
76+
fi
77+
echo ""
78+
echo "ℹ️ Extension info:"
79+
dxt info "$DXT_FILENAME"
80+
81+
echo ""
82+
echo "🎉 Extension built successfully!"
83+
echo "📄 Output: dxt/_build/$DXT_FILENAME"
84+
echo "🔧 Mode: $MODE"
85+
if [[ "$MODE" == "dev" ]]; then
86+
echo "⚙️ Note: Dev mode requires manual configuration of Blockscout MCP server URL"
87+
fi
88+
echo ""
89+
echo "To use this extension:"
90+
echo "1. Copy the .dxt file from the container to your host system"
91+
echo "2. Install it in Claude Desktop"

dxt/manifest-dev.json

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"dxt_version": "0.1",
3+
"name": "blockscout-mcp-dev",
4+
"display_name": "Blockscout (dev)",
5+
"version": "0.2.0",
6+
"description": "Contextual blockchain activity analysis via Blockscout APIs",
7+
"long_description": "This extension enables contextual blockchain activity analysis with multi-chain support, intelligent context optimization, smart response slicing, and seamless pagination. The server exposes blockchain data including balances, tokens, NFTs, contract metadata, transactions, and logs via MCP for comprehensive blockchain analysis. This extension acts as a proxy to the official Blockscout MCP server.",
8+
"author": {
9+
"name": "Blockscout",
10+
"url": "https://blockscout.com"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/blockscout/mcp-server"
15+
},
16+
"homepage": "https://blockscout.com",
17+
"documentation": "https://mcp.blockscout.com",
18+
"support": "https://github.com/blockscout/mcp-server/issues",
19+
"icon": "blockscout.png",
20+
"server": {
21+
"type": "node",
22+
"entry_point": "node_modules/mcp-remote/dist/proxy.js",
23+
"mcp_config": {
24+
"command": "node",
25+
"args": [
26+
"${__dirname}/node_modules/mcp-remote/dist/proxy.js",
27+
"${user_config.blockscout_url}",
28+
"--transport", "http-only",
29+
"--allow-http"
30+
],
31+
"env": {}
32+
}
33+
},
34+
"user_config": {
35+
"blockscout_url": {
36+
"type": "string",
37+
"title": "Blockscout MCP Server URL",
38+
"description": "The URL of the Blockscout MCP server to connect to (e.g., http://127.0.0.1:8000/mcp/ for local development)",
39+
"default": "http://127.0.0.1:8000/mcp/",
40+
"required": true
41+
}
42+
},
43+
"tools": [
44+
{
45+
"name": "__unlock_blockchain_analysis__",
46+
"description": "Provides custom instructions for the MCP host. This is a mandatory first step."
47+
},
48+
{
49+
"name": "get_chains_list",
50+
"description": "Returns a list of all known blockchain chains"
51+
},
52+
{
53+
"name": "get_address_by_ens_name",
54+
"description": "Converts an ENS name to its Ethereum address"
55+
},
56+
{
57+
"name": "lookup_token_by_symbol",
58+
"description": "Searches for tokens by symbol"
59+
},
60+
{
61+
"name": "get_contract_abi",
62+
"description": "Retrieves the ABI for a smart contract"
63+
},
64+
{
65+
"name": "get_address_info",
66+
"description": "Gets comprehensive information about an address"
67+
},
68+
{
69+
"name": "get_tokens_by_address",
70+
"description": "Returns ERC20 token holdings for an address"
71+
},
72+
{
73+
"name": "get_latest_block",
74+
"description": "Returns the latest indexed block"
75+
},
76+
{
77+
"name": "get_transactions_by_address",
78+
"description": "Gets transactions for an address"
79+
},
80+
{
81+
"name": "get_token_transfers_by_address",
82+
"description": "Returns ERC-20 token transfers for an address"
83+
},
84+
{
85+
"name": "transaction_summary",
86+
"description": "Provides a human-readable transaction summary"
87+
},
88+
{
89+
"name": "nft_tokens_by_address",
90+
"description": "Retrieves NFT tokens owned by an address"
91+
},
92+
{
93+
"name": "get_block_info",
94+
"description": "Returns detailed block information"
95+
},
96+
{
97+
"name": "get_transaction_info",
98+
"description": "Gets comprehensive transaction information"
99+
},
100+
{
101+
"name": "get_transaction_logs",
102+
"description": "Returns transaction logs with decoded event data"
103+
},
104+
{
105+
"name": "read_contract",
106+
"description": "Executes a read-only smart contract function"
107+
}
108+
],
109+
"keywords": [
110+
"blockchain",
111+
"ethereum",
112+
"evm",
113+
"blockscout",
114+
"arbitrum",
115+
"optimism"
116+
],
117+
"license": "MIT"
118+
}

dxt/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dxt_version": "0.1",
33
"name": "blockscout-mcp",
44
"display_name": "Blockscout",
5-
"version": "0.1.0",
5+
"version": "0.2.0",
66
"description": "Contextual blockchain activity analysis via Blockscout APIs",
77
"long_description": "This extension enables contextual blockchain activity analysis with multi-chain support, intelligent context optimization, smart response slicing, and seamless pagination. The server exposes blockchain data including balances, tokens, NFTs, contract metadata, transactions, and logs via MCP for comprehensive blockchain analysis. This extension acts as a proxy to the official Blockscout MCP server.",
88
"author": {

0 commit comments

Comments
 (0)