# AntChain MCP

> AntChain MCP connects any AI agent directly to Alibaba’s enterprise blockchain platform, giving you full control over consortium chain data. Use your natural language client to inspect account states, query transaction finality, deploy smart contracts, and monitor network health for dApps.

## Overview
- **Category:** industry-titans
- **Price:** Free
- **Tags:** baas, smart-contracts, distributed-ledger, enterprise-blockchain, transaction-query, decentralized-apps

## Description

Managing an enterprise blockchain usually means jumping through hoops: checking a dashboard here, running a CLI command there, cross-referencing logs in a third tab. It's slow. This MCP changes that. You tell your AI client what you need—say, the balance of a specific account or if a recent contract execution succeeded—and it handles the entire sequence of queries against AntChain’s platform.

It lets developers run complex tasks like deploying new smart contracts and invoking methods without writing boilerplate API integration code. Need to audit who touched an account last week? Just ask. Want to see if your network is healthy enough for a big release? Ask that too. The whole operation becomes conversational. You connect this MCP via Vinkius, and suddenly, your AI agent acts like a full-time blockchain operations center, handling everything from simple data lookups to complex contract management.

## Tools

### deploy_contract
Puts a new smart contract onto the AntChain network using compiled bytecode.

### get_chain_list
Lists all blockchain networks your account has access to for scoping operations.

### invoke_contract
Calls a specific method on an already deployed smart contract instance.

### query_account_balance
Checks the available funds for any specified account, including pending amounts.

### query_account
Retrieves detailed information about a wallet address's current state and activity.

### query_block
Gets metadata like timestamps and transaction counts for a specific block height or hash.

### query_contract
Retrieves the configuration details of a smart contract before you try to run it.

### query_latest_transactions
Fetches a list and status summary of the most recent network activity.

### query_network_info
Provides operational metrics on the overall health and topology of the blockchain network.

### query_transaction
Verifies the final status, sender, receiver, and gas usage for a single transaction.

## Prompt Examples

**Prompt:** 
```
Show me the latest 5 transactions on my default AntChain network.
```

**Response:** 
```
📋 Here are the 5 most recent transactions on chain 'default'. The latest transaction (hash: 0xabc123...) was successful, transferring assets between accounts. Block height: 45678. Gas used: 21000. All 5 transactions show successful execution with varying gas costs.
```

**Prompt:** 
```
What's the balance of account 0x742d35Cc6634C0532925a3b844Bc9e7595e0bFa8?
```

**Response:** 
```
💰 Account 0x742d35Cc6634C0532925a3b844Bc9e7595e0bFa8 has a balance of 1,250.50 ANT tokens. The account nonce is 47, indicating 47 previous transactions. Status: Active.
```

**Prompt:** 
```
Invoke the 'transfer' method on contract 'TokenContract' with args {"to": "0x123...", "amount": 100}.
```

**Response:** 
```
✅ Contract invocation successful! The 'transfer' method on 'TokenContract' executed successfully. Transaction hash: 0xdef456..., status: SUCCESS. Gas used: 45230. The transfer of 100 tokens to 0x123... has been confirmed on-chain.
```

## Capabilities

### Get network status
Check the overall health of the entire blockchain infrastructure.

### Inspect account details
View an account's current balance, nonce value, and metadata on the chain.

### Query contract logic
Retrieve configuration details for a specific smart contract before running it.

### Execute contract methods
Run specific functions within a deployed smart contract using natural language instructions.

### Deploy new contracts
Create and deploy a brand-new smart contract to the network via bytecode and ABI.

### Track transaction history
Fetch lists of recent transactions or investigate a specific transaction by hash or ID.

## Use Cases

### Investigating failed deployments
A developer sees a transaction failed on the network. They ask their agent to run `query_transaction` with the hash, and the MCP returns the sender, receiver, gas used, and the specific execution error result immediately.

### Pre-flight check before contract interaction
A product manager wants to call a function on an existing smart contract. They first ask the agent to use `query_contract` to confirm the ABI and method names, ensuring they don't invoke it with wrong arguments.

### Getting a full view of network scope
A new team member needs to know which blockchains are even available for testing. They simply run `get_chain_list` and get the IDs, names, and configurations without touching any config files.

### Verifying an account's history
An auditor needs proof of funds. They ask the agent to combine a call to `query_account_balance` with `query_account` to get both the current balance and the last 47 transactions (nonce value) in one response.

## Benefits

- Stop manually checking logs. You can use `query_latest_transactions` to get a real-time snapshot of network activity, instantly seeing success statuses and metadata for multiple recent operations.
- Need to know if an account has enough gas? Instead of logging into three different monitoring tools, just ask the MCP to run `query_account_balance`. It gives you available funds and pending amounts in one go.
- Deploying contracts used to be a multi-step CLI nightmare. Now, use `deploy_contract` to push bytecode directly from your agent using natural language prompts.
- Auditing contract interactions is easier than it sounds. You can run `query_transaction` on any hash to get the full execution result, including gas costs and final status checks.
- Want to check if a contract exists before calling it? Use `query_contract` first. It gives you all the necessary metadata so your agent knows exactly what methods are available for invocation.

## How It Works

The bottom line is you talk to it like a person, not a database.

1. Subscribe to this MCP and provide your AntChain Access Key and Secret Key credentials.
2. Tell your AI agent the task (e.g., 'What's the latest transaction for 0x...').
3. The client executes the necessary tool calls, returns structured data, and summarizes the results in plain language.

## Frequently Asked Questions

**How do I list all my available blockchain networks using AntChain MCP?**
You run `get_chain_list`. This tool returns a full list of chain IDs, names, and configurations so you know exactly what environments you can operate in.

**What is the difference between query_account and query_account_balance?**
`query_account` gives comprehensive state info—like nonce and metadata. `query_account_balance` specifically focuses on available funds, which is crucial for calculating gas costs before any transaction.

**How do I deploy a new smart contract?**
Use the `deploy_contract` tool. You just need to provide the compiled bytecode and optionally the ABI so your agent can push the contract onto AntChain.

**Can I check if a transaction was successful using query_transaction?**
Yes, `query_transaction` returns the full execution result. It tells you the final status (success/fail), gas used, and whether the block included it.

**How do I use the invoke_contract tool to execute methods on an existing contract?**
You provide the contract name, method name, and any required arguments. This function executes a specified method using the contract's logic. The result includes gas usage, return values, and final transaction status.

**What metadata can I retrieve from a specific block using query_block?**
The tool returns comprehensive block details like the timestamp, total transaction count, hash, and the reference to the previous block. You identify blocks either by their unique height or their full hash.

**How do I check the overall health of the blockchain infrastructure using query_network_info?**
This tool gives you a snapshot of the underlying network structure, including node status and consensus state. It's useful for monitoring general chain health beyond just transaction activity.

**If I need to audit recent activity across multiple transactions, how do I use query_latest_transactions?**
Running this tool returns a list of the most current transactions on the network. You get immediate visibility into their status and associated metadata without needing individual transaction hashes.

**How do I get my AntChain Access Key and Secret Key?**
Log in to the AntChain BaaS console, navigate to the API Management or Developer Center section, and create a new API credential pair. You'll receive an Access Key (public identifier) and a Secret Key (used for HMAC-SHA256 signature generation). The Secret Key is shown only once — save it immediately. These credentials authenticate all your API requests.

**What's the difference between querying a block and querying a transaction?**
A block query returns information about the container itself — block height, hash, timestamp, transaction count, and the previous block hash. A transaction query returns details about a specific operation within a block — sender/receiver addresses, gas used, execution status, return values, and whether the transaction succeeded or reverted. Use blocks to explore the chain structure, and transactions to verify individual operations.

**Can I deploy smart contracts through this MCP server?**
Yes! Use the `deploy_contract` tool to upload and deploy compiled smart contract bytecode to your AntChain network. You'll need the contract bytecode (in hex format), a name for the contract, and optionally the ABI for future interactions. After deployment, you can invoke contract methods using the `invoke_contract` tool. Make sure your account has sufficient permissions and balance for deployment.