Near Contract
FreeNot checkedEnables Claude to interact with NEAR smart contracts: read state, call view methods, decode transactions, and explain contract interfaces.
About
Enables Claude to interact with NEAR smart contracts: read state, call view methods, decode transactions, and explain contract interfaces.
README
An MCP (Model Context Protocol) server that allows Claude to read NEAR smart contract state, call view methods, decode transactions, and understand contract interfaces.
Features
- Contract Metadata: Fetch code hash, storage usage, and detect implemented standards (NEP-141, NEP-171, etc.)
- View Method Calls: Call any read-only method on any NEAR contract
- Transaction Decoding: Decode and explain transaction actions, gas usage, and outcomes
- State Reading: Read raw contract state with optional key prefix filtering
- Interface Explanation: AI-friendly explanation of contract purpose and functions
Installation
npm install @near-mcp/contract-interaction
Or run directly:
npx @near-mcp/contract-interaction
Claude Desktop Configuration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"near-contract": {
"command": "npx",
"args": ["@near-mcp/contract-interaction"]
}
}
}
Available Tools
1. get_contract_metadata
Fetches contract metadata including code hash, storage usage, and detected methods/standards.
Input:
{
"contract_id": "wrap.near",
"network": "mainnet"
}
Output:
{
"contract_id": "wrap.near",
"network": "mainnet",
"code_hash": "ABC123...",
"storage_usage_bytes": 12345,
"storage_usage_near": "0.12345 NEAR",
"detected_methods": ["ft_transfer", "ft_balance_of", "ft_metadata"],
"detected_standards": ["NEP-141 (Fungible Token Standard)"]
}
2. call_view_method
Calls a view (read-only) method on any NEAR smart contract.
Input:
{
"contract_id": "wrap.near",
"method_name": "ft_balance_of",
"args": { "account_id": "example.near" },
"network": "mainnet"
}
Output:
{
"contract_id": "wrap.near",
"method": "ft_balance_of",
"args": { "account_id": "example.near" },
"result": "1000000000000000000000000",
"blockHeight": 123456789,
"blockHash": "ABC...",
"logs": []
}
3. decode_transaction
Decodes and explains a NEAR transaction, including all actions and their effects.
Input:
{
"tx_hash": "ABC123...",
"sender_id": "example.near",
"network": "mainnet"
}
Output:
{
"hash": "ABC123...",
"signerId": "example.near",
"receiverId": "wrap.near",
"actions": [
{
"type": "FunctionCall",
"description": "Calls method \"ft_transfer\" with 0.0100 NEAR attached",
"details": {
"method_name": "ft_transfer",
"args_decoded": { "receiver_id": "bob.near", "amount": "1000000" },
"gas": 30000000000000,
"deposit": "1"
}
}
],
"outcome": {
"status": "Success",
"gasUsed": "2.5432 TGas",
"tokensBurned": "0.000254 NEAR"
}
}
4. get_contract_state
Reads raw contract state entries, optionally filtered by key prefix.
Input:
{
"contract_id": "example.near",
"key_prefix": "",
"network": "mainnet"
}
Output:
{
"contract_id": "example.near",
"network": "mainnet",
"total_entries": 42,
"state_entries": [
{
"key": "base64...",
"keyDecoded": "STATE",
"value": "base64...",
"valueDecoded": "{\"owner\": \"alice.near\"}"
}
],
"truncated": false
}
5. explain_contract_interface
Analyzes a contract and provides a human-readable explanation of its purpose and main functions.
Input:
{
"contract_id": "wrap.near",
"network": "mainnet"
}
Output:
{
"contract_id": "wrap.near",
"network": "mainnet",
"summary": "Wrapped NEAR (wNEAR) - A fungible token contract implementing the NEP-141 standard...",
"detected_standards": ["NEP-141 (Fungible Token Standard)", "NEP-145 (Storage Management)"],
"main_functions": {
"token_operations": ["ft_transfer", "ft_transfer_call"],
"queries": ["ft_balance_of", "ft_total_supply", "ft_metadata"],
"storage": ["storage_deposit", "storage_withdraw"]
},
"token_info": {
"name": "Wrapped NEAR",
"symbol": "wNEAR",
"decimals": 24
},
"example_usage": [
"Check token balance: call_view_method(\"wrap.near\", \"ft_balance_of\", {\"account_id\": \"user.near\"})",
"Get token info: call_view_method(\"wrap.near\", \"ft_metadata\", {})"
]
}
Supported Contract Standards
The server automatically detects contracts implementing:
- NEP-141: Fungible Token Standard
- NEP-171: Non-Fungible Token Standard
- NEP-145: Storage Management
- NEP-148: Fungible Token Metadata
Networks
Both mainnet and testnet are supported. Default is mainnet.
{ "network": "testnet" }
Development
# Install dependencies
npm install
# Build
npm run build
# Run locally
npm start
License
MIT
Installing Near Contract
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/jim-agent/mcp-near-contractFAQ
Is Near Contract MCP free?
Yes, Near Contract MCP is free — one-click install via Unyly at no cost.
Does Near Contract need an API key?
No, Near Contract runs without API keys or environment variables.
Is Near Contract hosted or self-hosted?
A hosted option is available: Unyly runs the server in the cloud, no local setup required.
How do I install Near Contract in Claude Desktop, Claude Code or Cursor?
Open Near Contract on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
by lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Near Contract with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
