# Nearblocks MCP

> Nearblocks (Near Blockchain Explorer API) lets your AI agent query the Near Protocol blockchain directly. You can inspect specific accounts for balances, track NFTs and tokens, review transaction history, or check global network stats—all without leaving your client interface.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Tags:** near-protocol, blockchain-explorer, crypto-api, web3, smart-contracts

## Description

You're hooking up your AI agent to **Nearblocks API**, so you can pull real-time data straight from the Near Protocol blockchain. This MCP server lets your agent query everything—accounts, transactions, blocks, and tokens—right where you are working. You don't need to leave your client interface to check the ledger.

**Checking Account Holdings**

You wanna see what an account owns? The `get_account_details` tool grabs basic identifying information for any specified Near account address. To check its assets, your agent can list all Non-Fungible Tokens (NFTs) using `get_account_inventory`. It can also retrieve a full list of fungible tokens (FTs) and their current balances with `get_account_tokens`. 

**Pulling Transaction History**

Need to track movement? Your agent pulls historical data for an account using `get_account_transactions`, which gives you a paginated list of transactions associated with that address. If you're looking at one specific move, `get_transaction_details` gets the full payload and success status for any single transaction hash. To see what’s happening right now across the whole network, your agent can pull the most recent transactions using `get_recent_transactions`.

**Monitoring Network Activity**

You gotta know if the chain is healthy. Your agent pulls current, high-level metrics for the entire network with `get_network_stats`, which reports things like gas prices and total transactions per second (TPS). It can also pull a list of the most recent blocks recorded on the Near blockchain using `get_latest_blocks`. For deeper investigation into the ledger state at a specific moment, `get_block_details` fetches all the information about one single block hash.

**Analyzing Token Contracts**

When it comes to tokens, your agent has options. It can get a comprehensive list of every unique token contract deployed across the entire Near blockchain using `get_token_list`. If you know the specific ID, `get_token_details` gets all the metadata and contract specifics for that single token on the network.

**Getting Core Account Info**

Beyond just balances, your agent can grab basic metadata and core information about any specified Near blockchain address with `get_account_details`. For a full picture of an account's history, it checks transactions via `get_account_transactions` or dives into the specifics of one transfer hash using `get_transaction_details`.

**How It Works Together**

Your agent can use these tools in sequence. Wanna know what’s up with an address? First, it gets basic details using `get_account_details`. Then, it checks the assets: running `get_account_inventory` shows all NFTs, and calling `get_account_tokens` lists every fungible token and its balance. If you want to see where those assets came from, your agent runs `get_account_transactions` for history or uses `get_transaction_details` if you have a specific hash.

If you’re monitoring the whole system, the process starts by checking general network health with `get_network_stats`. To track down any particular contract, it lists all available tokens via `get_token_list`, then drills down with `get_token_details` on the one you care about. The server also lets your agent check the latest activity—either by pulling a list of recent blocks using `get_latest_blocks` or listing the most recent transactions across the whole chain via `get_recent_transactions`. These tools make sure that every piece of blockchain data, from basic address metadata to deep-dive contract specs, is available for your AI client to process.

## Tools

### get_account_details
Retrieves basic identifying information for a specified Near account address.

### get_account_inventory
Lists all Non-Fungible Tokens (NFTs) currently owned by a specific Near account.

### get_account_tokens
Retrieves a list of fungible tokens held by an account, including their current balances.

### get_account_transactions
Gathers a paginated list of historical transactions associated with a given Near address.

### get_block_details
Fetches specific information about a single block hash, allowing deep inspection of the ledger state at that time.

### get_latest_blocks
Pulls a list containing the most recent blocks recorded on the Near blockchain.

### get_network_stats
Returns current, high-level metrics for the entire network, such as gas prices and total transactions per second (TPS).

### get_recent_transactions
Retrieves a list of the most recently processed transactions across the whole Near network.

### get_token_details
Gets specific metadata and contract details for an individual token ID on the network.

### get_token_list
Provides a comprehensive list of all unique token contracts deployed across the Near blockchain.

### get_transaction_details
Gets the full payload and success status for a single, specific transaction hash.

## Prompt Examples

**Prompt:** 
```
Get the latest blocks from the Near blockchain.
```

**Response:** 
```
I've retrieved the most recent blocks. The latest block is at height 115,234,001 with hash '9aB...'. Would you like to see the details of a specific block?
```

**Prompt:** 
```
Show me the transaction history for account 'vinkius.near'.
```

**Response:** 
```
I found 10 recent transactions for 'vinkius.near'. The most recent was a 'FunctionCall' to 'app.near' 5 minutes ago. Should I fetch the full details for that specific transaction?
```

**Prompt:** 
```
What are the details for transaction hash 8nZ...?
```

**Response:** 
```
Transaction 8nZ... was successful. It involved a transfer of 5 NEAR from 'sender.near' to 'receiver.near' at block 115,233,980. Gas used: 2.4 Tgas.
```

## Capabilities

### Check account holdings
Retrieves a user's current NEAR balances, along with lists of owned NFTs (`get_account_inventory`) and fungible tokens (FTs) using `get_account_tokens`.

### Pull transaction history
Fetches a list of recent transactions for an account or gets the full details for any specific transaction hash, including gas usage.

### Monitor network activity
Retrieves general network statistics (like current block height and TPS) and lists the most recent blocks and transactions happening across the entire chain.

### Analyze token contracts
Lists all available tokens on the Near network or gets specific contract details for a single token ID.

### View account fundamentals
Grabs basic metadata and core information about any specified Near blockchain address using `get_account_details`.

## Use Cases

### Debugging a failed smart contract call
A developer finds a failing transaction hash. They first run `get_transaction_details` to see *why* it failed, then use `get_account_details` on the target account to verify its current balance. This confirms if the failure was due to insufficient funds or a contract logic error.

### Auditing an investor's portfolio
An analyst needs to know everything about 'Wallet X'. They first call `get_account_tokens` for fungible assets, then run `get_account_inventory` for NFTs. Finally, they use `get_account_transactions` to trace the movement of those assets over time.

### Checking network congestion before deployment
A team is planning a major token launch. They check `get_network_stats` to see current gas prices and TPS. If the stats are bad, they run `get_recent_transactions` to estimate how much bandwidth the new smart contract will consume.

### Verifying asset ownership legitimacy
A user questions if a specific token is legitimate. They use `get_token_list` to see all deployed contracts, find the ID, and run `get_token_details` to verify its official metadata before trusting it.

## Benefits

- See an account's total holdings (NFTs, FTs) in one go. Using `get_account_inventory` and `get_account_tokens` separates asset types but keeps the results together for a full picture.
- Track historical activity without leaving your chat. You can request all transactions using `get_account_transactions`, then use `get_transaction_details` on any single hash to see the payload.
- Get a real-time view of network stress. Call `get_network_stats` to check TPS and block height, giving you immediate context for any transaction you're analyzing.
- Never manually search for token contracts again. Run `get_token_list` to get every contract ID, then use `get_token_details` to pull its specific rules and metadata.
- Pinpoint exactly when something happened. By combining `get_latest_blocks` with a transaction hash check via `get_transaction_details`, you can pinpoint the exact block where an event occurred.

## How It Works

The bottom line is: You ask a question about the Near blockchain; the agent runs the required tool calls under the hood and presents the clean answer.

1. First, connect the Nearblocks MCP Server to your AI client. You'll need an API key if you want high usage limits.
2. Next, prompt your agent with a request (e.g., 'What tokens does account X hold?'). The agent determines which tool to call and executes it.
3. Finally, the server returns structured data—like a list of token IDs or transaction records—which your AI client interprets and gives back to you in plain text.

## Frequently Asked Questions

**How do I check if an account has NFTs using get_account_inventory?**
Use `get_account_inventory` and provide the target Near account address. It returns a list of all associated NFT IDs, confirming ownership without needing to know which contract they belong to.

**What is the difference between get_recent_transactions and get_account_transactions?**
`get_recent_transactions` shows everything that happened on the network globally. `get_account_transactions` filters that history, only showing activity tied directly to a specific account address you provide.

**Can I use get_token_details to see an account's balance?**
No. `get_token_details` gives metadata about the contract itself (like its name or total supply). To see a specific account’s balance, you must use `get_account_tokens`.

**Do I need to call get_latest_blocks before querying an account?**
No. While checking the latest blocks gives context, most queries like `get_account_details` run independently and pull data relative to the current state; you don't need a prerequisite block read.

**If I use get_account_transactions repeatedly, how do I handle rate limits?**
The API documentation outlines specific rate limit thresholds. If you hit a limit, your AI client must pause and retry the request after a specified delay (usually 1-2 seconds). Using an API key helps manage higher call volumes.

**Does get_account_transactions include transaction types like staking or governance calls?**
Yes, it returns all associated activity. The data differentiates between standard transfers and smart contract interactions (like FunctionCalls). You'll find a 'type' field to filter these actions in your agent code.

**How can I check if a transaction failed when calling get_transaction_details?**
You need to look at the 'status' field returned by the tool. A successful transaction will have a status of 'SUCCESS', while failures are marked with specific error codes and messages.

**If I run get_token_list, how do I match those tokens to an account using get_account_tokens?**
The list tool provides the contract addresses for all available tokens. You then pass those specific addresses into get_account_tokens to see which ones a given account currently holds.

**Can I see which NFTs an account owns?**
Yes! Use the `get_account_inventory` tool with the target account ID. It will return a list of Non-Fungible Tokens (NFTs) currently held by that account.

**How do I check the current network status like TPS?**
You can use the `get_network_stats` tool. It provides real-time metrics including Transactions Per Second (TPS), current block height, and gas prices.

**Is it possible to list all tokens available on the Near network?**
Yes, the `get_token_list` tool allows you to fetch a list of fungible and non-fungible tokens registered on the Near network.