Skip to content

johnalbertini14-glitch/openclaw-skills / skills/0xlucasliao/bnbchain-mcp

bnbchain-mcp

Verified

Interact with the BNB Chain Model Context Protocol (MCP) server. Use to query DeFi data, get token prices, search documentation, fetch git diffs, and retrieve smart contract source code on BNB Chain.

FileKindSize
SKILL.mdskill md1.8 KB
_meta.jsonconfig459 B
package.jsonmanifest197 B
scripts/mcp-client.pyscript3.9 KB

scripts/mcp-client.py

View on GitHub
import sys
import json
import subprocess
import asyncio
import os

# This is a wrapper to call the MCP server tools via stdio.
# Since we don't have a native MCP client library installed in the environment generally, 
# we assume the 'bnbchain-mcp' executable is available or we are calling it effectively.
# 
# However, for a skill, we often need to Bridge the gap. 
# If the user has `bnbchain-mcp` installed via `uv tool install`, we can call it.
# 
# For now, this script mimics a client by directly invoking the server process in stdio mode 
# for a single request, then exiting. This is inefficient but functional for a CLI wrapper.

async def run_mcp_tool(tool_name, arguments):
    # Command to start the MCP server
    # We assume 'uv run bnbchain-mcp' works in the environment as per the repo docs
    server_command = ["uv", "run", "bnbchain-mcp"]
    
    # Create the JSON-RPC request
    request = {
        "jsonrpc": "2.0",
        "id": 1,
        "method": "tools/call",
        "params": {
            "name": tool_name,
            "arguments": arguments
        }
    }

    try:
        process = await asyncio.create_subprocess_exec(
            *server_command,
            stdin=asyncio.subprocess.PIPE,
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE
        )
        
        # Initialize connection (simplified, usually requires initialize handshake)
        # Real MCP requires Client <-> Server handshake (initialize -> initialized) before calls.
        
        # Handshake: initialize
        init_req = {
            "jsonrpc": "2.0",
            "id": 0,
            "method": "initialize",
            "params": {
                "protocolVersion": "2024-11-05", # Approximate version
                "capabilities": {},
                "clientInfo": {"name": "openclaw-skill", "version": "1.0"}
            }
        }
        
        input_data = json.dumps(init_req) + "\n"
        process.stdin.write(input_data.encode())
        await process.stdin.drain()
        
        # Read init response (basic loop to find response)
        while True:
            line = await process.stdout.readline()
            if not line: break
            msg = json.loads(line.decode())
            if msg.get("id") == 0:
                # Send initialized notification
                process.stdin.write(json.dumps({"jsonrpc":"2.0","method":"notifications/initialized"}).encode() + b"\n")
                await process.stdin.drain()
                break
        
        # Send actual tool call
        process.stdin.write(json.dumps(request).encode() + b"\n")
        await process.stdin.drain()
        
        # Read tool response
        while True:
            line = await process.stdout.readline()
            if not line: break
            msg = json.loads(line.decode())
            if msg.get("id") == 1:
                print(json.dumps(msg.get("result"), indent=2))
                break
                
        process.terminate()
        
    except FileNotFoundError:
        print("Error: 'uv' or 'bnbchain-mcp' not found. Please ensure the MCP server is installed.")
    except Exception as e:
        print(f"Error running MCP tool: {e}")

def main():
    if len(sys.argv) < 2:
        print("Usage: mcp-client.py <tool_name> [--args '{\"key\": \"value\"}']")
        sys.exit(1)

    tool_name = sys.argv[1]
    args = {}
    
    if len(sys.argv) > 3 and sys.argv[2] == "--args":
        try:
            args = json.loads(sys.argv[3])
        except json.JSONDecodeError:
            print("Error: Invalid JSON for arguments")
            sys.exit(1)
            
    if tool_name == "list_tools":
        # Special case to just list tools (requires different method)
        # We'll skip implementation for brevity in this first pass or implement if needed
        pass
    else:
        asyncio.run(run_mcp_tool(tool_name, args))

if __name__ == "__main__":
    main()
rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).Stars: 198kUpdated Claude CodeCodexUnverifiedInstall
doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.Stars: 198kUpdated Claude CodeCodexVerifiedInstall