NEAR MCP Server
The NEAR MCP Server enables AI agents to interact with the NEAR Protocol blockchain by monitoring smart contract events, processing them with AI, and responding back to contracts.
Watch NEAR Contract Events (
watch_near_event): Start monitoring a specific NEAR smart contract for named events (e.g.,run_agent,price_request) in real-time, with configurable polling frequency (via cron expression). Detected events are automatically processed with AI, and responses are sent back to the contract via a specified method.Stop Watching Events (
stop_watching_near_event): Stop an active event listener for a specific event on a given NEAR contract.List Active Subscriptions (
list_watched_near_events): Retrieve all currently active event watchers, optionally including detailed statistics about each subscription.Flexible Configuration: Customize polling intervals, response method and parameter names, network (mainnet/testnet/betanet), gas limits, and RPC endpoints.
Authentication: Uses NEAR account keys (
ACCOUNT_ID+ACCOUNT_KEY) for signing and submitting transactions back to the blockchain.
Integrates with the NEAR Protocol blockchain to enable AI agents to monitor smart contract events, manage event subscriptions, process blockchain data with AI, and send transactions back to contracts.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@NEAR MCP ServerWatch for 'run_agent' events on contract oracle.near"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ NEAR MCP Server
๐ Overview
The NEAR MCP Server enables AI agents to interact with the NEAR Protocol blockchain. This server provides smart contract interaction, transaction handling, and event listening capabilities with AI-driven processing.
By implementing the Model Context Protocol (MCP), this server allows Large Language Models (LLMs) to monitor blockchain events, process them with AI intelligence, and respond back to smart contracts, bridging the gap between AI and decentralized applications.
Related MCP server: thegraph-mcp
โจ Features
Event Watching: Monitor NEAR smart contracts for specific events in real-time.
AI-Driven Processing: Automatically process blockchain events with AI and send responses back to contracts.
Subscription Management: Manage multiple event subscriptions with detailed statistics.
Flexible Configuration: Customizable polling intervals, response methods, and network settings.
๐ฆ Installation
๐ Using npx (Recommended)
To use this server without installing it globally:
npx @iqai/mcp-near๐ง Build from Source
git clone https://github.com/IQAIcom/mcp-near.git
cd mcp-near
pnpm install
pnpm run buildโก Running with an MCP Client
Add the following configuration to your MCP client settings (e.g., claude_desktop_config.json).
๐ Minimal Configuration
{
"mcpServers": {
"near": {
"command": "npx",
"args": ["-y", "@iqai/mcp-near"],
"env": {
"ACCOUNT_ID": "your-account.near",
"ACCOUNT_KEY": "ed25519:your_private_key_here"
}
}
}
}โ๏ธ Advanced Configuration (Local Build)
{
"mcpServers": {
"near": {
"command": "node",
"args": ["/absolute/path/to/mcp-near/dist/index.js"],
"env": {
"ACCOUNT_ID": "your-account.near",
"ACCOUNT_KEY": "ed25519:your_private_key_here",
"NEAR_NETWORK_ID": "mainnet",
"NEAR_NODE_URL": "https://rpc.mainnet.near.org"
}
}
}
}๐ Configuration (Environment Variables)
Variable | Required | Description | Default |
| Yes | Your NEAR account ID for authentication | - |
| Yes | Private key for your NEAR account (ed25519: or secp256k1: format) | - |
| No | NEAR network ("mainnet", "testnet", "betanet") |
|
| No | Custom NEAR RPC endpoint | - |
| No | Gas limit for transactions | - |
๐ก Usage Examples
๐ Event Watching
"Watch for 'run_agent' events on contract oracle.near"
"Start monitoring price_request events on my-contract.testnet"
"Set up a listener for transfer events with 5-second polling"
๐ Subscription Management
"List all my active event subscriptions"
"Show statistics for my event watchers"
"Stop watching events on contract oracle.near"
๐ค AI-Driven Workflows
"Process incoming oracle requests and respond with AI analysis"
"Monitor for user queries and provide intelligent responses"
๐ ๏ธ MCP Tools
๐จโ๐ป Development
๐๏ธ Build Project
pnpm run build๐๏ธ Development Mode (Watch)
pnpm run watchโ Linting & Formatting
pnpm run lint
pnpm run format๐งช Running Tests
pnpm test๐ Project Structure
src/tools/: Individual tool definitionssrc/services/: Event watcher, auth manager, and business logicsrc/types.ts: TypeScript type definitionssrc/index.ts: Server entry point
๐ AI-Driven Event Processing Workflow
The server enables an "AI in the loop" workflow:
๐ Smart contract transaction triggers an event and pauses execution
๐ค MCP server detects the event and requests AI processing from the client
๐ง AI client processes the event data and provides intelligent response
โฉ๏ธ Server sends AI response back to blockchain via transaction
โ Original smart contract resumes with the AI-provided data
๐ Resources
โ ๏ธ Disclaimer
This project interacts with the NEAR blockchain and requires private keys for transaction signing. Users should exercise caution, secure their credentials, and verify all transactions independently. Blockchain operations involve risk and may incur gas fees.
๐ License
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BrainDAO/mcp-near-agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server