NEAR Contract Deployer MCP Server
Allows deploying, initializing, and upgrading NEAR smart contracts, checking deployment status, and estimating deployment costs.
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 Contract Deployer MCP ServerDeploy my contract to testnet"
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 Contract Deployer MCP Server
An MCP (Model Context Protocol) server that enables AI assistants like Claude to deploy, initialize, and upgrade NEAR smart contracts.
Features
deploy_contract: Deploy WASM smart contracts to NEAR accounts
initialize_contract: Call initialization methods after deployment
upgrade_contract: Upgrade existing contracts with new code
get_deployment_status: Check if an account has a contract deployed
estimate_deployment_cost: Calculate storage costs before deploying
Related MCP server: Solana Web3.js MCP Server
Installation
npm install
npm run buildConfiguration
Credentials
The server looks for NEAR credentials in these locations (in order):
~/.near-credentials/{network}/{account_id}.json~/.near/credentials/{network}/{account_id}.json./.near-credentials/{network}/{account_id}.json
You can also provide credentials directly via the private_key parameter.
Generate Credentials
# For testnet
near login --networkId testnet
# For mainnet
near login --networkId mainnetUsage with Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"near-deploy": {
"command": "node",
"args": ["/path/to/mcp-near-deploy/dist/index.js"]
}
}
}Example Conversations
Deploying a New Contract
User: Deploy my contract to testnet
Claude: I'll help you deploy your contract. First, let me estimate the costs.
Tool: estimate_deployment_cost
Args: {"wasm_path": "./target/wasm32-unknown-unknown/release/my_contract.wasm"}
π° DEPLOYMENT COST ESTIMATE
π Cost Breakdown:
βββββββββββββββββββββββββββββββββ
WASM Size: 156.32 KB (160,072 bytes)
Storage Cost: 1.600720 NEAR
Estimated Gas: 11 TGas
Total Estimate: ~1.65 NEAR
π‘ Recommendation:
β
Contract size is reasonable. Deployment should proceed smoothly.Now let me deploy it:
Tool: deploy_contract
Args: {
"account_id": "mycontract.testnet",
"wasm_path": "./target/wasm32-unknown-unknown/release/my_contract.wasm",
"network": "testnet"
}
β
CONTRACT DEPLOYED SUCCESSFULLY
π Deployment Details:
βββββββββββββββββββββββββββββββββ
Contract ID: mycontract.testnet
Network: testnet
WASM Size: 156.32 KB
Storage Cost: 1.600720 NEAR
Transaction: 7abc123...
π Explorer: https://explorer.testnet.near.org/transactions/7abc123...
π Next Steps:
1. Initialize the contract using initialize_contract()
2. Verify deployment with get_deployment_status()Initializing a Contract
User: Initialize the contract with owner set to my account
Claude: I'll initialize your contract with the specified owner:
Tool: initialize_contract
Args: {
"contract_id": "mycontract.testnet",
"method_name": "new",
"args": {"owner_id": "yourname.testnet"},
"network": "testnet"
}
β
CONTRACT INITIALIZED SUCCESSFULLY
π Initialization Details:
βββββββββββββββββββββββββββββββββ
Contract ID: mycontract.testnet
Method: new
Arguments: {"owner_id": "yourname.testnet"}
Transaction: 8def456...
π Explorer: https://explorer.testnet.near.org/transactions/8def456...
β¨ The contract is now ready to use!Checking Deployment Status
User: Is there a contract on wrap.near?
Claude: Let me check the deployment status:
Tool: get_deployment_status
Args: {"account_id": "wrap.near", "network": "mainnet"}
β
CONTRACT IS DEPLOYED
π Deployment Status:
βββββββββββββββββββββββββββββββββ
Contract ID: wrap.near
Network: mainnet
Code Hash: 4Fh7SHqU...
Storage Used: 3,456,789 bytes
Storage Cost: 34.567890 NEAR
Balance: 1,234.567890 NEAR
π Explorer: https://explorer.near.org/accounts/wrap.near
β¨ Contract is ready to interact with!Upgrading a Contract
User: Upgrade my contract with the new version
Claude: I'll upgrade your contract with the new WASM and run the migration:
Tool: upgrade_contract
Args: {
"contract_id": "mycontract.testnet",
"wasm_path": "./target/wasm32-unknown-unknown/release/my_contract_v2.wasm",
"migrate_method": "migrate",
"network": "testnet"
}
β
CONTRACT UPGRADED SUCCESSFULLY
π Upgrade Details:
βββββββββββββββββββββββββββββββββ
Contract ID: mycontract.testnet
Network: testnet
New WASM Size: 162.45 KB
Storage Cost: 1.624500 NEAR
Deploy TX: 9ghi789...
Migration TX: 0jkl012...
π Explorer: https://explorer.testnet.near.org/transactions/9ghi789...
β¨ Migration completed successfully!Cost Estimation
User: How much will it cost to deploy a 500KB contract?
Claude: Let me calculate the deployment cost:
Tool: estimate_deployment_cost
Args: {"wasm_size_bytes": 512000}
π° DEPLOYMENT COST ESTIMATE
π Cost Breakdown:
βββββββββββββββββββββββββββββββββ
WASM Size: 500.00 KB (512,000 bytes)
Storage Cost: 5.120000 NEAR
(5120000000000000000000000 yoctoNEAR)
Estimated Gas: 15 TGas
Gas Cost: ~0.001500 NEAR
βββββββββββββββββββββββββββββββββ
Total Estimate: 5.121500 NEAR
π‘ Recommendation:
πΈ Storage cost is significant. Ensure account has sufficient NEAR balance.
π Notes:
β’ Storage costs are exact (1 byte = 0.00001 NEAR)
β’ Gas costs may vary based on network conditions
β’ Add ~10% buffer for safetyAPI Reference
deploy_contract
Deploy a WASM smart contract to a NEAR account.
Parameter | Type | Required | Description |
account_id | string | β | NEAR account to deploy to |
wasm_path | string | β* | Path to WASM file |
wasm_base64 | string | β* | Base64-encoded WASM |
network | string | β | "mainnet" or "testnet" (default: testnet) |
private_key | string | β | Signing key (ed25519:xxx format) |
*Either wasm_path or wasm_base64 required
initialize_contract
Call an initialization method on a deployed contract.
Parameter | Type | Required | Description |
contract_id | string | β | Contract account ID |
method_name | string | β | Init method name |
args | object | β | Method arguments |
deposit | string | β | NEAR to attach (e.g., "1.5") |
gas | string | β | Gas limit in TGas (default: 100) |
network | string | β | "mainnet" or "testnet" |
private_key | string | β | Signing key |
upgrade_contract
Upgrade an existing contract with new WASM code.
Parameter | Type | Required | Description |
contract_id | string | β | Contract to upgrade |
wasm_path | string | β* | Path to new WASM file |
wasm_base64 | string | β* | Base64-encoded new WASM |
migrate_method | string | β | Migration method to call |
migrate_args | object | β | Migration arguments |
network | string | β | "mainnet" or "testnet" |
private_key | string | β | Signing key |
get_deployment_status
Check if an account has a contract deployed.
Parameter | Type | Required | Description |
account_id | string | β | Account to check |
network | string | β | "mainnet" or "testnet" (default: mainnet) |
estimate_deployment_cost
Calculate storage costs for deployment.
Parameter | Type | Required | Description |
wasm_path | string | β* | Path to WASM file |
wasm_base64 | string | β* | Base64-encoded WASM |
wasm_size_bytes | number | β* | Direct size in bytes |
*At least one required
Networks
Mainnet: Production network (
mainnet)Testnet: Development network (
testnet)
Default network is testnet for safety.
Security Notes
Never share or commit private keys
Use environment variables or credential files for keys
Test on testnet before mainnet deployments
Review contract code before deploying
License
MIT
Available Tools
5 toolsdeploy_contractB
Deploy a WebAssembly (WASM) smart contract to a NEAR account. Requires the deployer account to have sufficient balance for storage costs.
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | NEAR network to deploy to (default: testnet) | |
| wasm_path | No | Path to the compiled WASM file | |
| account_id | Yes | The NEAR account ID to deploy the contract to (e.g., "mycontract.testnet") | |
| private_key | No | Optional: Private key for signing (ed25519:xxx format). If not provided, uses ~/.near-credentials/ | |
| wasm_base64 | No | Alternative: Base64-encoded WASM bytes (use instead of wasm_path) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of disclosing behavior. It mentions the storage cost requirement but fails to disclose that deploying may overwrite existing contract code, requires signing privileges, or produces transaction-related side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with the action, and contains no filler. It delivers the core purpose and one key requirement without unnecessary verbosity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a deployment tool with five parameters and no output schema, the description is too minimal. It does not explain the relationship between wasm_path and wasm_base64, whether the contract initialization is part of this step or separate, or what the return value is, leaving the agent under-informed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides 100% description coverage for all five parameters, including alternatives like wasm_path and wasm_base64. The description adds no additional parameter meaning, so the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: deploying a WASM smart contract to a NEAR account. It uses a specific verb and resource, and the focus on deployment distinguishes it from sibling tools like upgrade_contract and initialize_contract.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. The only additional note about storage cost balance is a prerequisite rather than usage direction, and there is no mention of exclusions or scenarios favoring other sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
estimate_deployment_costA
Calculate the storage cost for deploying a WASM contract before actually deploying.
| Name | Required | Description | Default |
|---|---|---|---|
| wasm_path | No | Path to the compiled WASM file | |
| wasm_base64 | No | Alternative: Base64-encoded WASM bytes | |
| wasm_size_bytes | No | Alternative: Provide WASM size directly in bytes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the full burden of behavioral disclosure. It implies that the tool does not deploy ('before actually deploying') but does not explicitly state it is read-only or has no side effects. It also doesn't mention any external dependencies or computation specifics, leaving some transparency gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence that immediately states the purpose. Every word earns its place, with no filler or redundancy. It is concise while still conveying the core functionality and timing.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has a simple interface (3 alternative params, no output schema). The description effectively communicates that it estimates deployment cost, which is the main purpose. However, it does not mention what the return value looks like (e.g., numeric cost in tokens/currency), which would be useful. Given the low complexity, this is a minor omission, and the description is otherwise complete for guiding selection and invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already provides 100% coverage with descriptions for each parameter, including noting they are alternatives. The tool description adds no additional parameter semantics beyond the schema, so it does not go above the baseline. It does not clarify when to prefer wasm_path over wasm_base64, but the schema's 'Alternative' notes help.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the verb 'Calculate' and the resource 'storage cost for deploying a WASM contract'. It distinguishes itself from sibling tools like deploy_contract and initialize_contract by focusing on cost estimation rather than actual deployment.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'before actually deploying' provides a clear temporal context for when to use the tool. While it doesn't explicitly name alternatives, the sibling list includes deployment-related tools, making it obvious that this is a pre-deployment step. It could be more explicit by saying 'use this instead of deploy_contract to estimate costs without committing', but the current wording is adequate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_deployment_statusA
Check if a NEAR account has a smart contract deployed and get deployment details.
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | NEAR network to query (default: mainnet) | |
| account_id | Yes | The NEAR account ID to check |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of disclosing behavior. It implies a non-destructive check but never explicitly states that it does not modify anything or what exactly 'deployment details' includes. This lack of explicit safety and output context is a significant gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with the main verb first and no filler. It earns its place by conveying both purpose and scope in minimal words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema or annotations, the description should clarify what 'deployment details' returns and whether there are any side effects. It does neither, leaving the agent without adequate context for a correct invocation or result interpretation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already documents both parameters with descriptions, giving 100% coverage, so the baseline is 3. The description adds no extra meaning about parameters (e.g., network default or accepted formats), relying entirely on the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Check if') and identifies the resource (NEAR account), making the action and scope immediately clear. It distinguishes itself from sibling deployment tools by focusing on querying status rather than modifying, which is a distinct purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description clearly implies a read-only status query, which contrasts with the mutation-focused sibling tools like deploy_contract and upgrade_contract. However, it does not explicitly state when to prefer this tool over alternatives or mention any exclusions, so it falls short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
initialize_contractA
Call an initialization method on a deployed contract. Most contracts require this after deployment.
| Name | Required | Description | Default |
|---|---|---|---|
| gas | No | Optional: Gas limit in TGas (default: 100) | |
| args | No | Initialization arguments as JSON object | |
| deposit | No | Optional: NEAR amount to attach (in NEAR, e.g., "1.5") | |
| network | No | NEAR network (default: testnet) | |
| contract_id | Yes | The NEAR account ID of the deployed contract | |
| method_name | Yes | Name of the init method (commonly "new" or "init") | |
| private_key | No | Optional: Private key for signing |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It only states that an init method is called; it does not mention that this is a state-changing transaction, that private_key is needed for signing, potential side effects like double-initialization errors, or whether it is irreversible. The description adds minimal behavioral context beyond what the schema already lists.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise: two short sentences that immediately state the action and the typical usage context. Every word earns its place, and the key information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite good schema coverage, the tool has 7 parameters, no output schema, and no annotations. The description is too terse to cover important contextual aspects like return values, failure modes (e.g., 'method already initialized'), network defaults, or the difference between 'new' and 'init' methods. As a state-changing blockchain operation, more context is needed for safe autonomous invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema provides 100% coverage for all 7 parameters, each with detailed descriptions. The description itself adds no parameter-specific guidance, so the baseline score of 3 is appropriate since the schema already documents the parameters thoroughly.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Call') and resource ('initialization method on a deployed contract'), clearly distinguishing it from sibling tools like deploy_contract or upgrade_contract. The added context 'Most contracts require this after deployment' reinforces the tool's specific role in the contract lifecycle.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'Most contracts require this after deployment' implies the tool is used post-deployment, which helps orient the agent. However, it does not explicitly mention when not to use it or name alternatives, though sibling tool names provide implicit differentiation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
upgrade_contractA
Upgrade an existing contract with new WASM code. The contract must be owned by the signer.
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | NEAR network (default: testnet) | |
| wasm_path | No | Path to the new compiled WASM file | |
| contract_id | Yes | The NEAR account ID of the contract to upgrade | |
| private_key | No | Optional: Private key for signing | |
| wasm_base64 | No | Alternative: Base64-encoded new WASM bytes | |
| migrate_args | No | Optional: Arguments for migration method | |
| migrate_method | No | Optional: Migration method to call after upgrade (e.g., "migrate") |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries the burden of behavioral disclosure. It discloses the ownership requirement ('must be owned by the signer') and implies code replacement, but omits details on irreversibility, migration invocation, state persistence, or potential failure modes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences with no redundant phrasing. The purpose is front-loaded, and the ownership constraint is stated efficiently.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex operation with 7 parameters and no output schema, this description is too minimal. It lacks guidance on when to use wasm_path versus wasm_base64, how migration methods are invoked, and what outcome the agent should expect after calling the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so each parameter is already documented. The description only loosely references WASM code and ownership, adding little beyond the schema. Baseline 3 is appropriate because the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's action ('Upgrade an existing contract') and its resource ('with new WASM code'), which distinguishes it from sibling tools like deploy_contract targeting new contracts. The phrase 'existing contract' reinforces the intended use case.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context that this tool is for existing contracts and includes an ownership prerequisite, but it does not explicitly contrast with deploy_contract or mention when migration arguments are relevant. No direct exclusions or alternative names are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool targets a distinct phase in the contract lifecycle: deploy creates, initialize configures, upgrade replaces, status checks, and cost estimates. There is no overlap or ambiguity between them.
All tool names follow a consistent verb_noun pattern (deploy_contract, initialize_contract, upgrade_contract, get_deployment_status, estimate_deployment_cost). The pattern is uniform and predictable.
With 5 tools, the server is well-scoped for its purpose of managing NEAR contract deployments. Each tool is necessary and there is no redundancy or bloat.
The server covers the full deployment lifecycle: estimation, deployment, initialization, upgrading, and status checking. There are no obvious gaps for its stated purpose, as contract interaction beyond deployment is out of scope.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Plan Salesforce deploys, open pull requests and trigger pipelines from your AI client.
Provide AI agents and automation tools with contextual access to blockchain data including balanceβ¦
Deploy and manage your apps, databases, storage, and scheduled jobs from your AI agent
Build, validate, deploy β HTTP APIs, cron jobs, webhooks and MCP tools β from your AI client.
Related MCP Servers
FlicenseAqualityDmaintenanceEnables AI assistants to interact with the MIDL blockchain, supporting smart contract deployment, balance queries, asset bridging, Bitcoin Rune management, and more through natural language.291- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with the Solana blockchain, manage accounts and tokens, and develop and deploy smart contracts end-to-end.4
- AlicenseAqualityBmaintenanceEnables AI agents to build, check, cost, and deploy HotPocket dApps on Evernode/Xahau by scaffolding deterministic contracts, checking determinism, estimating lease costs, ranking hosts, and generating deploy commands.121MIT
- FlicenseAqualityDmaintenanceEnables Claude to interact with NEAR smart contracts: read state, call view methods, decode transactions, and explain contract interfaces.5
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/jim-agent/mcp-near-deploy'
If you have feedback or need assistance with the MCP directory API, please join our Discord server