From 2bf34a6b9c39c454b497fb5343eca0f79411d5cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 30 Aug 2025 12:24:48 +0000 Subject: [PATCH 1/2] Initial plan From 3798c7aa5b43fd2338f8d7705b9a1ba739918908 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 30 Aug 2025 12:50:12 +0000 Subject: [PATCH 2/2] Add MCP Inspector compatibility and improved one-liner installation Co-authored-by: 0xrinegade <101195284+0xrinegade@users.noreply.github.com> --- README.md | 36 ++++++++++- config.json | 2 +- scripts/install.sh | 146 +++++++++++++++++++++++++++++++++++++++++++++ src/protocol.rs | 2 +- test_sequence.sh | 2 +- tests/e2e.rs | 22 +++---- 6 files changed, 194 insertions(+), 16 deletions(-) create mode 100755 scripts/install.sh diff --git a/README.md b/README.md index 74fa877..b8f908c 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,35 @@ solana-mcp-server web --port 8080 📖 **[Complete Web Service Documentation](./docs/web-service.md)** -## Installation +## Quick Installation (One-liner) + +🚀 **Install Solana MCP Server for Claude Desktop in one command:** + +```bash +curl -fsSL https://raw.githubusercontent.com/opensvm/solana-mcp-server/main/scripts/install.sh | bash +``` + +This will: +- Download pre-built binaries (if available) or build from source +- Configure Claude Desktop automatically +- Set up proper environment variables +- Back up existing configurations + +**Alternative install methods:** + +```bash +# Using wget +wget -qO- https://raw.githubusercontent.com/opensvm/solana-mcp-server/main/scripts/install.sh | bash + +# Manual download and run +curl -fsSL https://raw.githubusercontent.com/opensvm/solana-mcp-server/main/scripts/install.sh -o install.sh +chmod +x install.sh +./install.sh +``` + +After installation, restart Claude Desktop and start querying Solana data directly! + +## Manual Installation (Advanced) ### Using Pre-built Binaries @@ -53,9 +81,13 @@ solana-mcp-server web --port 8080 ### Building from Source ```bash -TEMP_DIR=$(mktemp -d) && cd "$TEMP_DIR" && git clone https://github.com/opensvm/solana-mcp-server.git . && cargo build --release && CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/claude" && mkdir -p "$CONFIG_DIR" && echo "{\"mcpServers\":{\"solana\":{\"command\":\"$PWD/target/release/solana-mcp-server\",\"env\":{\"SOLANA_RPC_URL\":\"https://api.mainnet-beta.solana.com\"}}}}" > "$CONFIG_DIR/config.json" || { rm -rf "$TEMP_DIR"; exit 1; } +git clone https://github.com/opensvm/solana-mcp-server.git +cd solana-mcp-server +cargo build --release ``` +Then configure Claude Desktop with the path to `target/release/solana-mcp-server`. + ## Quick Deployment 🚀 **One-liner deployment scripts for all platforms:** diff --git a/config.json b/config.json index aa6abeb..3bb7eb2 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { "rpc_url": "https://api.opensvm.com", "commitment": "confirmed", - "protocol_version": "2024-11-05" + "protocol_version": "2025-06-18" } diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..e046d9c --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# One-liner installation script for Solana MCP Server +# Usage: curl -fsSL https://raw.githubusercontent.com/opensvm/solana-mcp-server/main/scripts/install.sh | bash +set -e + +echo "🚀 Installing Solana MCP Server for Claude Desktop..." + +# Function to detect OS and architecture +detect_platform() { + local os=$(uname -s | tr '[:upper:]' '[:lower:]') + local arch=$(uname -m) + + case "$arch" in + x86_64) arch="amd64" ;; + arm64|aarch64) arch="arm64" ;; + *) echo "Unsupported architecture: $arch" >&2; exit 1 ;; + esac + + case "$os" in + darwin) os="macos" ;; + linux) os="linux" ;; + *) echo "Unsupported OS: $os" >&2; exit 1 ;; + esac + + echo "${os}-${arch}" +} + +# Function to get Claude config directory +get_claude_config_dir() { + if [[ "$OSTYPE" == "darwin"* ]]; then + echo "$HOME/Library/Application Support/Claude" + else + echo "${XDG_CONFIG_HOME:-$HOME/.config}/claude" + fi +} + +# Try to download pre-built binary first, fall back to building from source +try_download_binary() { + local platform=$(detect_platform) + local binary_name="solana-mcp-server-${platform}" + + echo "Attempting to download pre-built binary for ${platform}..." + + # Try to download from releases + local download_url="https://github.com/opensvm/solana-mcp-server/releases/latest/download/${binary_name}" + if curl -sL "$download_url" -o solana-mcp-server; then + # Check if download was successful (not a 404 page) + if [[ $(wc -c < solana-mcp-server) -gt 1000 ]] && file solana-mcp-server | grep -q "executable"; then + chmod +x solana-mcp-server + echo "✅ Downloaded pre-built binary" + return 0 + else + echo "⚠️ Download failed or binary not available" + rm -f solana-mcp-server + return 1 + fi + else + echo "⚠️ Pre-built binary not available, building from source..." + return 1 + fi +} + +# Build from source +build_from_source() { + echo "Building Solana MCP Server from source..." + + # Check if Rust is installed + if ! command -v cargo &> /dev/null; then + echo "Installing Rust..." + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source "$HOME/.cargo/env" + fi + + # Clone and build + TEMP_DIR=$(mktemp -d) + cd "$TEMP_DIR" + git clone https://github.com/opensvm/solana-mcp-server.git . + cargo build --release + + # Copy binary to working directory + cp target/release/solana-mcp-server "$OLDPWD/" + cd "$OLDPWD" + rm -rf "$TEMP_DIR" + + echo "✅ Built from source successfully" +} + +# Main installation logic +main() { + # Create working directory + INSTALL_DIR="$HOME/.local/bin" + mkdir -p "$INSTALL_DIR" + cd "$INSTALL_DIR" + + # Try download first, then build if needed + if ! try_download_binary; then + build_from_source + fi + + # Configure Claude Desktop + local claude_config_dir=$(get_claude_config_dir) + mkdir -p "$claude_config_dir" + + local config_file="$claude_config_dir/claude_desktop_config.json" + local server_path="$INSTALL_DIR/solana-mcp-server" + + # Create or update Claude config + if [[ -f "$config_file" ]]; then + echo "⚠️ Existing Claude config found. Backing up..." + cp "$config_file" "${config_file}.backup.$(date +%s)" + fi + + cat > "$config_file" << EOF +{ + "mcpServers": { + "solana": { + "command": "$server_path", + "env": { + "SOLANA_RPC_URL": "https://api.mainnet-beta.solana.com", + "SOLANA_COMMITMENT": "confirmed" + } + } + } +} +EOF + + echo "✅ Installation complete!" + echo "" + echo "🎉 Solana MCP Server is now configured for Claude Desktop" + echo "📁 Installed at: $server_path" + echo "⚙️ Config file: $config_file" + echo "" + echo "🚀 To use:" + echo "1. Restart Claude Desktop" + echo "2. You can now query Solana blockchain data directly in Claude!" + echo "" + echo "💡 Example queries:" + echo " - 'What is the balance of account [pubkey]?'" + echo " - 'Show me the latest block information'" + echo " - 'Get transaction details for [signature]'" + echo "" + echo "📖 More info: https://github.com/opensvm/solana-mcp-server" +} + +# Run main function +main "$@" \ No newline at end of file diff --git a/src/protocol.rs b/src/protocol.rs index 0d2f87e..3996700 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use std::collections::HashMap; use url::Url; -pub const LATEST_PROTOCOL_VERSION: &str = "2024-11-05"; +pub const LATEST_PROTOCOL_VERSION: &str = "2025-06-18"; /// Describes who the intended customer of this object or data is #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] diff --git a/test_sequence.sh b/test_sequence.sh index 2738e1a..52c7185 100755 --- a/test_sequence.sh +++ b/test_sequence.sh @@ -1,4 +1,4 @@ #!/bin/bash # Start the server and send both requests through the same pipe -(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"test-client","version":"1.0.0"},"capabilities":{}}}'; sleep 1; echo '{"jsonrpc":"2.0","id":2,"method":"tools/list"}') | ./target/release/solana-mcp-server +(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","clientInfo":{"name":"test-client","version":"1.0.0"},"capabilities":{}}}'; sleep 1; echo '{"jsonrpc":"2.0","id":2,"method":"tools/list"}') | ./target/release/solana-mcp-server diff --git a/tests/e2e.rs b/tests/e2e.rs index 55c05c4..4883d05 100644 --- a/tests/e2e.rs +++ b/tests/e2e.rs @@ -86,7 +86,7 @@ async fn test_mcp_initialize_protocol() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": { "name": "e2e-test-client", @@ -103,7 +103,7 @@ async fn test_mcp_initialize_protocol() { assert!(response["result"].is_object()); let result = &response["result"]; - assert_eq!(result["protocolVersion"], "2024-11-05"); + assert_eq!(result["protocolVersion"], "2025-06-18"); assert_eq!(result["serverInfo"]["name"], "solana-mcp-server"); assert!(result["capabilities"]["tools"].is_object()); } @@ -119,7 +119,7 @@ async fn test_tools_list() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} } @@ -165,7 +165,7 @@ async fn test_tool_execution_get_health() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} } @@ -202,7 +202,7 @@ async fn test_tool_execution_get_balance() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} } @@ -308,7 +308,7 @@ async fn test_error_handling_method_not_found() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} } @@ -343,7 +343,7 @@ async fn test_error_handling_invalid_tool_params() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} } @@ -382,7 +382,7 @@ async fn test_content_type_validation() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} } @@ -439,7 +439,7 @@ async fn test_resources_list() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} } @@ -472,7 +472,7 @@ async fn test_complex_tool_multiple_accounts() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} } @@ -514,7 +514,7 @@ async fn test_concurrent_requests() { "id": 1, "method": "initialize", "params": { - "protocolVersion": "2024-11-05", + "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"} }