base-network-interface-service
Enables natural language interaction with the Base decentralized ledger, supporting essential functions such as wallet orchestration, current asset verification, and transactional commitments. Compatible with both the main production network and the Sepolia sandbox environment.
Author
fakepixels
Quick Info
Actions
Tags
Base Chain Interaction Module
This module serves as an interface layer for the Base blockchain, allowing Large Language Models (LLMs) to execute ledger operations using colloquial instructions. Core capabilities include managing cryptographic key pairs, querying account balances, and submitting signed transactions.
This functionality operates seamlessly across the Base Mainnet and the Base Sepolia test harness.
Exposed Functionalities (Tools)
execute_natural_command
Dispatches a vernacular instruction intended for Base network activities. Requires one argument:
command_string: The plaintext instruction (e.g., "Transfer 0.75 ETH to address 0xABC...")
Returns a structured result detailing the outcome, which may include transaction identifiers for transfers, balance figures, or newly provisioned wallet metadata.
provision_new_keypair
Generates a novel cryptographic key pair (wallet) for use on the Base ledger. Accepts one optional argument:
alias: A descriptive moniker for the new wallet (e.g., "Savings" or "Operational").
Returns an object containing the public address, assigned alias, and related configuration details.
retrieve_asset_holding
Fetches the current asset holdings for a specified account on the Base network. Accepts one optional argument:
identifier: The wallet's assigned name or its public address (defaults to the primary configured wallet).
Outputs the reported balance, denominated in Ether (ETH).
enumerate_managed_wallets
Compiles and presents a list of all currently registered cryptographic wallets.
Returns an array of wallet records, each detailing the address and associated friendly name.
Integration Guidance (Claude Desktop)
Claude Desktop provides native support for the Model Context Protocol (MCP). To integrate this Base service:
- Access the configuration file located at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- Insert the following configuration block into the
mcpServerssection:
{ "mcpServers": { "base_integration": { "command": "npx", "args": [ "-y", "base-network-mcp-server" ], "env": { "BASE_PROVIDER_URL": "https://api.developer.coinbase.com/rpc/v1/base/YOUR_API_KEY", "WALLET_PRIVATE_KEY": "your_private_key_here" }, "disabled": false, "autoApprove": [] } } }
Configuration Directives
BASE_PROVIDER_URL: The endpoint URL for the Base network RPC access (Mainnet or Sepolia).WALLET_PRIVATE_KEY: The secret key required for transaction authorization and signing.DEFAULT_GAS_PRICE: (Optional) The standard fee rate specified in Gwei for transactions.
Programmatic Connection (Custom Client)
For developers constructing bespoke MCP clients, connectivity can be established using standard transport mechanisms provided by the MCP SDK (stdio or SSE transports).
Setup Prerequisites
Installation requires a Node Package Manager:
bash npm install base-network-mcp-server
OR
yarn add base-network-mcp-server
OR
pnpm add base-network-mcp-server
Illustrative Code Snippet
This example demonstrates synchronous stream connection between a client and the server implementation:
javascript import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamTransport } from '@modelcontextprotocol/sdk/client/stream.js'; import { BaseMcpServer } from 'base-network-mcp-server';
// Establish bidirectional stream conduits const clientPipe = new StreamTransport(); const serverPipe = new StreamTransport();
clientPipe.readable.pipeTo(serverPipe.writable); serverPipe.readable.pipeTo(clientPipe.writable);
const client = new Client({ name: 'CustomBaseClient', version: '1.0.0', }, { capabilities: {} });
// Initialize the Base MCP server instance const server = new BaseMcpServer({ providerUrl: 'https://api.developer.coinbase.com/rpc/v1/base/YOUR_API_KEY', privateKey: 'your_private_key_here', });
// Link client and server to their respective communication pipes await server.connect(serverPipe); await client.connect(clientPipe);
// Invoke a tool via the connected client const result = await client.callTool({ name: 'retrieve_asset_holding', arguments: { identifier: 'default', }, });
console.log(result); // Expected outcome format: // { // "success": true, // "message": "Holding for wallet \"default\": 1.5 ETH", // "balance": "1.5", // "wallet": "default" // }
Operational Language Examples
When linked, the system recognizes phrases such as:
- "Generate a fresh account for long-term holdings."
- "Query the available ETH balance."
- "What is the current value held by my savings account?"
- "Push 0.1 ETH to destination address 0x1234567890123456789012345678901234567890"
- "Move 0.5 ETH from my operational wallet over to 0xABCD..."
Security Directives
Due to the handling of sensitive credentials and live network interaction:
- Key Secrecy: Private keys must be safeguarded; avoid version control storage.
- Staging First: Always deploy and test functionality against the Base Sepolia environment initially.
- Verification Mandate: Thoroughly validate all transaction parameters pre-submission.
- Resilience: Incorporate comprehensive mechanisms for handling network failures.
- Throttling Awareness: Monitor and respect provider API rate constraints.
WIKIPEDIA: XMLHttpRequest (XHR) is a standardized JavaScript interface provided as an object whose member functions enable the dispatch of HTTP inquiries from a web browser to a designated server. These functions permit browser-based applications to submit requests post-page load and subsequently receive returned data. XHR is a cornerstone technology in the concept of Ajax programming. Prior to this innovation, server communication predominantly relied on traditional hyperlinks or form submissions, often necessitating a full page refresh.
== Chronology ==
The fundamental concept underpinning XMLHttpRequest was conceived in the year 2000 by engineers working on Microsoft Outlook. This idea was subsequently actualized within the Internet Explorer 5 browser release (1999). However, the initial implementation did not utilize the precise XMLHttpRequest identifier. Instead, developers relied on invoking object constructors such as ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). By the time Internet Explorer 7 (2006) was released, universal support for the standardized XMLHttpRequest identifier was established across the platform.
The XMLHttpRequest identifier has since become the ubiquitous benchmark across all major browser engines, including Mozilla's Gecko (2002), Apple's Safari 1.2 (2004), and Opera 8.0 (2005).
=== Standardization Efforts === The World Wide Web Consortium (W3C) formally published a Working Draft specification for the XMLHttpRequest object on April 5, 2006. A subsequent Level 2 specification draft followed on February 25, 2008, introducing capabilities for progress monitoring, facilitating cross-site data exchange, and handling raw byte streams. By the conclusion of 2011, the Level 2 features were integrated back into the primary specification document. At the close of 2012, stewardship of the document's maintenance transitioned to the WHATWG, which utilizes Web IDL for its living document format.
== Operational Procedure == Executing a remote query via XMLHttpRequest typically involves a sequence of programming steps.
- Instantiation: Create an XMLHttpRequest object instance via its constructor call:
- Configuration: Invoking the
openmethod to define the request methodology (GET, POST, etc.), specify the target Uniform Resource Identifier (URI), and select either synchronous or asynchronous execution mode: - Listener Setup (Asynchronous Only): For non-blocking operations, define an event handler function destined to be notified upon state transitions:
- Transmission: Commence the request process by executing the
sendmethod: - Response Handling: Monitor the state changes within the registered event listener. If the server delivers payload data, it is generally stored in the
responseTextproperty by default. Upon final processing, the object transitions to state 4, signifying completion: Beyond these fundamental stages, XMLHttpRequest offers extensive controls over transmission parameters and response interpretation. Custom HTTP headers can be affixed to requests to convey specific server instructions, and data payloads can be furnished to the server via the argument passed to thesendinvocation. The received response body can be automatically parsed from JSON format into manipulable JavaScript structures, or processed incrementally as data streams arrive, obviating the wait for complete reception. Furthermore, requests possess the capability to be prematurely terminated or configured with a timeout constraint.
== Inter-Domain Transfers ==
During the nascent phases of the World Wide Web, it was recognized that permitting data transfers across security boundaries was necessary, yet this posed inherent risks of exploitation or data leakage. The initial architecture of XHR imposed strict 'Same-Origin Policy' constraints, severely limiting requests to the originating domain. This limitation was later systematically addressed through mechanisms such as CORS (Cross-Origin Resource Sharing), allowing controlled, explicit permission for cross-domain resource fetching.
