klever-io avatar

Mcp Klever Vm

klever-io/mcp-klever-vm

If you're building smart contracts on Klever blockchain, this gives your AI assistant direct access to VM patterns, best practices, and code examples through MCP tools. It exposes query_context for searching the knowledge base, get_context for retrieving specific patterns, and find_similar for discovering related examples. The server comes pre-loaded with 95+ knowledge entries covering storage patterns, event handling, token operations, and common anti-patterns. You can run it locally via npx, connect to the public hosted instance at mcp.klever.org, or self-host with Redis backing. It also includes helper tools for initializing projects and adding deployment scripts, though these are disabled on the public server for security.

GitHub stars
31
tools
16
transport
STDIO, HTTP
last updated
Mar 19, 2026

Install

From registry metadata
$ npx add-mcp https://mcp.klever.org/mcp --name mcp-klever-vm

Run in your terminal. add-mcp asks which agents to add it to (Claude Code, Codex, Cursor and more). Add -g to install it for every project.

Review the command, arguments and environment values before installing. MCP servers run with your local permissions.

Other ways

Claude Code

$ claude mcp add --transport http mcp-klever-vm https://mcp.klever.org/mcp

Run in your terminal. Add --scope user to make it available in every project.

Tools

Verified live · 16 tools

Verified live against the running server on Nov 6, 2026.

query_contextSearch the Klever VM knowledge base for smart contract development context. Returns structured JSON with matching entries, scores, and pagination. Use this for precise filtering by type or tags; use search_documentation for human-readable "how do I..." answers.6 params

Search the Klever VM knowledge base for smart contract development context. Returns structured JSON with matching entries, scores, and pagination. Use this for precise filtering by type or tags; use search_documentation for human-readable "how do I..." answers.

Parameters* required
contractTypestring
Filter by contract type (e.g. "token", "nft", "defi", "dao"). Only returns entries tagged for this contract category.
limitinteger
Maximum number of results to return (1-100). Default: 10.default: 10
offsetinteger
Number of results to skip for pagination. Use with limit to page through results. Default: 0.default: 0
querystring
Free-text search query. Use Klever-specific terms for best results (e.g. "storage mapper SingleValueMapper", "payable endpoint KLV", "deploy contract testnet").
tagsarray
Filter by tags (e.g. ["storage", "mapper"], ["tokens", "KLV"], ["events"]). Tags are matched with OR logic — any matching tag includes the entry.
typesarray
Filter results by context type. Omit to search all types. Common combinations: ["code_example", "documentation"] for learning, ["error_pattern"] for debugging, ["security_tip", "best_practice"] for...
get_contextRetrieve a single knowledge base entry by its unique ID. Returns the full entry including content, metadata, tags, and related context IDs. Use this after query_context or find_similar to get complete details for a specific entry.1 params

Retrieve a single knowledge base entry by its unique ID. Returns the full entry including content, metadata, tags, and related context IDs. Use this after query_context or find_similar to get complete details for a specific entry.

Parameters* required
id*string
The unique context ID (UUID format). Obtain IDs from query_context or find_similar results.
find_similarFind knowledge base entries similar to a given entry by comparing tags and content. Returns related contexts ranked by similarity score. Useful for discovering related patterns, examples, or documentation after finding one relevant entry.2 params

Find knowledge base entries similar to a given entry by comparing tags and content. Returns related contexts ranked by similarity score. Useful for discovering related patterns, examples, or documentation after finding one relevant entry.

Parameters* required
id*string
The context ID to find similar entries for. Obtain from query_context or get_context results.
limitinteger
Maximum number of similar entries to return. Typical range is 1-20; higher values may be slower. Default: 5.default: 5
get_knowledge_statsGet summary statistics of the Klever VM knowledge base. Returns total entry count, counts broken down by context type (code_example, best_practice, security_tip, etc.), and a sample entry title for each type. Useful for understanding what knowledge is available before querying.

Get summary statistics of the Klever VM knowledge base. Returns total entry count, counts broken down by context type (code_example, best_practice, security_tip, etc.), and a sample entry title for each type. Useful for understanding what knowledge is available before querying.

No parameters. Call it with no arguments.

enhance_with_contextAugment a natural-language query with relevant Klever VM knowledge base context. Extracts Klever-specific keywords, finds matching entries, and returns the original query combined with relevant code examples and documentation in markdown. Use this to enrich a user prompt befor...2 params

Augment a natural-language query with relevant Klever VM knowledge base context. Extracts Klever-specific keywords, finds matching entries, and returns the original query combined with relevant code examples and documentation in markdown. Use this to enrich a user prompt befor...

Parameters* required
autoIncludeboolean
When true (default), automatically appends the most relevant knowledge base entries to the response. Set to false to only return metadata without injecting context.default: true
query*string
The user's natural-language question or prompt to enhance (e.g. "How do I handle KLV payments in my contract?").
search_documentationSearch Klever VM documentation and knowledge base. Returns human-readable markdown with titles, descriptions, and code snippets. Optimized for "how do I..." questions. Use this instead of query_context when you need formatted developer documentation.2 params

Search Klever VM documentation and knowledge base. Returns human-readable markdown with titles, descriptions, and code snippets. Optimized for "how do I..." questions. Use this instead of query_context when you need formatted developer documentation.

Parameters* required
categorystring
Narrow results to a specific knowledge category. Available: core, storage, events, tokens, modules, tools, scripts, examples, errors, best-practices, documentation.one of core · storage · events · tokens · modules · tools
query*string
Search query in natural language (e.g. "how to use storage mappers", "deploy contract to testnet", "handle KDA token transfers").
analyze_contractAnalyze Klever smart contract Rust source code for common issues. Checks for missing imports, missing #[klever_sc::contract] macro, missing endpoint annotations, payable handlers without call_value usage, storage mappers without #[storage_mapper], and missing event definitions...2 params

Analyze Klever smart contract Rust source code for common issues. Checks for missing imports, missing #[klever_sc::contract] macro, missing endpoint annotations, payable handlers without call_value usage, storage mappers without #[storage_mapper], and missing event definitions...

Parameters* required
contractNamestring
Human-readable name for the contract (used in output labeling). Defaults to "contract" if omitted.
sourceCode*string
The full Rust source code of the Klever smart contract to analyze. Must be valid Rust code using klever_sc imports.
get_balanceGet the KLV or KDA token balance for a Klever blockchain address. Returns the balance in the smallest unit (for KLV: 1 KLV = 1,000,000 units with 6 decimal places). Optionally specify an asset ID to query a specific KDA token balance instead of KLV.3 params

Get the KLV or KDA token balance for a Klever blockchain address. Returns the balance in the smallest unit (for KLV: 1 KLV = 1,000,000 units with 6 decimal places). Optionally specify an asset ID to query a specific KDA token balance instead of KLV.

Parameters* required
address*string
Klever address (klv1... bech32 format).
assetIdstring
Optional KDA token ID (e.g. "USDT-A1B2", "LPKLVKFI-3I0N"). Omit for KLV balance.
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
get_accountGet full account details for a Klever blockchain address including nonce, balance, frozen balance, allowance, and permissions. Use this when you need comprehensive account state beyond just the balance.2 params

Get full account details for a Klever blockchain address including nonce, balance, frozen balance, allowance, and permissions. Use this when you need comprehensive account state beyond just the balance.

Parameters* required
address*string
Klever address (klv1... bech32 format).
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
get_asset_infoGet complete properties and configuration for any asset on the Klever blockchain (KLV, KFI, KDA tokens, NFT collections). Returns supply info, permissions (CanMint, CanBurn, etc.), roles, precision, and metadata. Note: string fields like ID, Name, Ticker are base64-encoded in...2 params

Get complete properties and configuration for any asset on the Klever blockchain (KLV, KFI, KDA tokens, NFT collections). Returns supply info, permissions (CanMint, CanBurn, etc.), roles, precision, and metadata. Note: string fields like ID, Name, Ticker are base64-encoded in...

Parameters* required
assetId*string
Asset identifier (e.g. "KLV", "KFI", "USDT-A1B2", "MYNFT-XY78").
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
query_scExecute a read-only query against a Klever smart contract (VM view call). Returns the contract function result as base64-encoded return data. Arguments must be base64-encoded. Use this to read contract state without modifying it.5 params

Execute a read-only query against a Klever smart contract (VM view call). Returns the contract function result as base64-encoded return data. Arguments must be base64-encoded. Use this to read contract state without modifying it.

Parameters* required
argsarray
Optional base64-encoded arguments. For addresses, encode the hex-decoded bech32 bytes. For numbers, use big-endian byte encoding.
callerstring
Optional caller address (klv1... bech32 format). Some view functions use the caller to look up address-keyed storage mappers.
funcName*string
Function name to call (must be a #[view] function on the contract).
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
scAddress*string
Smart contract address (klv1... bech32 format).
get_transactionGet transaction details by hash from the Klever blockchain. Returns sender, receiver, status, block info, contracts, and receipts. Uses the API proxy for indexed data.2 params

Get transaction details by hash from the Klever blockchain. Returns sender, receiver, status, block info, contracts, and receipts. Uses the API proxy for indexed data.

Parameters* required
hash*string
Transaction hash (hex string).
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
get_blockGet block information from the Klever blockchain by nonce (block number). If no nonce is provided, returns the latest block. Returns hash, timestamp, proposer, number of transactions, and other block metadata.2 params

Get block information from the Klever blockchain by nonce (block number). If no nonce is provided, returns the latest block. Returns hash, timestamp, proposer, number of transactions, and other block metadata.

Parameters* required
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
nonceinteger
Block number (nonce). Omit to get the latest block.
list_validatorsList active validators on the Klever blockchain network. Returns validator addresses, names, commission rates, delegation info, and staking amounts.1 params

List active validators on the Klever blockchain network. Returns validator addresses, names, commission rates, delegation info, and staking amounts.

Parameters* required
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
init_klever_projectScaffold a new Klever smart contract project using the SDK. Creates the Rust project structure via `ksc new` and generates automation scripts (build, deploy, upgrade, query, test, interact). Requires Klever SDK installed at ~/klever-sdk/. Run check_sdk_status first to verify....3 params

Scaffold a new Klever smart contract project using the SDK. Creates the Rust project structure via `ksc new` and generates automation scripts (build, deploy, upgrade, query, test, interact). Requires Klever SDK installed at ~/klever-sdk/. Run check_sdk_status first to verify....

Parameters* required
name*string
The contract project name in kebab-case (e.g. "my-token", "nft-marketplace"). Used as the Cargo package name and directory name.
noMoveboolean
When true, keeps the project in the SDK output directory instead of moving it to the current working directory. Default: false.default: false
templatestring
Project template to scaffold from. "empty" creates a blank contract with just an init function. "adder" creates a simple counter example. Default: "empty".one of empty · adderdefault: empty
add_helper_scriptsAdd build, deploy, upgrade, query, test, and interact automation scripts to an existing Klever smart contract project. Creates a scripts/ directory with bash scripts and updates .gitignore. Run this from the project root directory (where Cargo.toml is located). NOTE: In public...1 params

Add build, deploy, upgrade, query, test, and interact automation scripts to an existing Klever smart contract project. Creates a scripts/ directory with bash scripts and updates .gitignore. Run this from the project root directory (where Cargo.toml is located). NOTE: In public...

Parameters* required
contractNamestring
The contract name to embed in scripts (e.g. "my-token"). If omitted, auto-detected from the `name` field in Cargo.toml.

Sponsors

Readme

Klever MCP Server

A Model Context Protocol (MCP) server tailored for Klever blockchain smart contract development. This server maintains and serves contextual knowledge including code patterns, best practices, and runtime behavior for developers working with the Klever VM SDK.

Features

  • 🚀 Triple Mode Operation: Run as HTTP API server, MCP stdio server, or public hosted MCP server
  • 💾 Flexible Storage: In-memory or Redis backend support
  • 🔍 Smart Context Retrieval: Query by type, tags, or contract type
  • 📝 Automatic Pattern Extraction: Parse Klever contracts to extract examples and patterns
  • 🎯 Relevance Ranking: Intelligent scoring and ranking of context
  • 🔄 Live Updates: Add and update context in real-time
  • 🛡️ Type Safety: Full TypeScript with Zod validation
  • 📚 Comprehensive Knowledge Base: Pre-loaded with Klever VM patterns, best practices, and examples
  • 🔧 Contract Validation: Automatic detection of common issues and anti-patterns
  • 🚀 Deployment Scripts: Ready-to-use scripts for contract deployment, upgrade, and querying

Quick Start

Install and run instantly via npx — no cloning required:


View the full README on GitHub

Details

Repository
github.com/klever-io/mcp-klever-vm
Package
@klever/mcp-server
Transport
STDIO, HTTP
Registry
MCP registry, active
Resources
1
Prompts
4
Tools verified
Nov 6, 2026