CAT
/MCP
SkillsMCPMarketplacesDigestToolsAdvertise

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by Category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP Servers by Category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by Category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control

Cross AI Tools

Discover Claude Code plugins, extensions, and tools. Automatically updated directory of Anthropic Claude AI marketplaces with development tools, productivity plugins, and integrations.

Resources

  • Browse Skills
  • Browse MCP Servers
  • Browse Marketplaces
  • Plugins Reference

Community

  • About
  • Tools
  • Feedback
  • Privacy Policy
  • Advertise

Built for the Claude Code community with Claude Code by @mertduzgun

Independent project, not affiliated with Anthropic

Mcp Klever Vm

klever-io/mcp-klever-vm
3116 toolsSTDIO, HTTPregistry active
Summary

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.

Install to Claude Code

verified
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.

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

CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Keep your Mac awake
Keep your Mac awake
Keep your Mac awake while Claude Code and 40+ AI agents run. Sleeps when they're idle.
One time payment $9 →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Keep your Mac awake
Keep your Mac awake
Keep your Mac awake while Claude Code and 40+ AI agents run. Sleeps when they're idle.
One time payment $9 →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →

Tools

Verified live against the running server on Jun 10, 2026.

verified live16 tools
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
tagsarray
Filter by tags (e.g. ["storage", "mapper"], ["tokens", "KLV"], ["events"]). Tags are matched with OR logic — any matching tag includes the entry.
limitinteger
Maximum number of results to return (1-100). Default: 10.default: 10
querystring
Free-text search query. Use Klever-specific terms for best results (e.g. "storage mapper SingleValueMapper", "payable endpoint KLV", "deploy contract testnet").
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 reviews.
offsetinteger
Number of results to skip for pagination. Use with limit to page through results. Default: 0.default: 0
contractTypestring
Filter by contract type (e.g. "token", "nft", "defi", "dao"). Only returns entries tagged for this contract category.
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
query*string
The user's natural-language question or prompt to enhance (e.g. "How do I handle KLV payments in my contract?").
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
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
query*string
Search query in natural language (e.g. "how to use storage mappers", "deploy contract to testnet", "handle KDA token transfers").
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
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
sourceCode*string
The full Rust source code of the Klever smart contract to analyze. Must be valid Rust code using klever_sc imports.
contractNamestring
Human-readable name for the contract (used in output labeling). Defaults to "contract" if omitted.
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.
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
funcName*string
Function name to call (must be a #[view] function on the contract).
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
nonceinteger
Block number (nonce). Omit to get the latest block.
networkstring
Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet).one of mainnet · testnet · devnet · local
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.

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:

npx -y @klever/mcp-server

Or connect to the hosted public server:

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

See MCP Client Integration for client-specific configuration.

Architecture

mcp-klever-vm/
├── src/
│   ├── api/          # HTTP API routes with validation
│   ├── context/      # Context management service layer
│   ├── mcp/          # MCP protocol server implementation
│   ├── parsers/      # Klever contract parser and validator
│   ├── storage/      # Storage backends (memory/Redis)
│   │   ├── memory.ts # In-memory storage with size limits
│   │   └── redis.ts  # Redis storage with optimized queries
│   ├── types/        # TypeScript type definitions
│   ├── utils/        # Utilities and ingestion tools
│   └── knowledge/    # Modular knowledge base (95+ entries)
│       ├── core/     # Core concepts and imports
│       ├── storage/  # Storage patterns and mappers
│       ├── events/   # Event handling and rules
│       ├── tokens/   # Token operations and decimals
│       ├── modules/  # Built-in modules (admin, pause)
│       ├── tools/    # CLI tools (koperator, ksc)
│       ├── scripts/  # Helper scripts
│       ├── examples/ # Complete contract examples
│       ├── errors/   # Error patterns
│       ├── best-practices/ # Optimization and validation
│       └── documentation/  # API reference
├── tests/            # Test files
└── docs/             # Documentation

Key Improvements Made

  1. Storage Layer

    • Added memory limits to prevent OOM in InMemoryStorage
    • Optimized Redis queries to avoid O(N) KEYS command
    • Added atomic transactions for Redis operations
    • Improved error handling and validation
  2. API Security

    • Added input validation for all endpoints
    • Batch operation size limits
    • Proper error responses without leaking internals
    • Environment-aware error messages
  3. Type Safety

    • Centralized schema validation
    • Proper TypeScript interfaces for options
    • Runtime validation of stored data
  4. Performance

    • Batch operations using Redis MGET
    • Index-based queries instead of full scans
    • Optimized count operations

Installation

  1. Clone the repository:
git clone https://github.com/klever-io/mcp-klever-vm.git
cd mcp-klever-vm
  1. Install dependencies:
pnpm install
  1. Copy environment configuration:
cp .env.example .env
  1. Install Klever SDK tools (required for transactions):
chmod +x scripts/install-sdk.sh && ./scripts/install-sdk.sh
  1. Build the project:
pnpm run build

Configuration

Edit .env file to configure the server:

# Server Mode (http, mcp, or public)
MODE=http

# HTTP Server Port (only for http mode)
PORT=3000

# Storage Backend (memory or redis)
STORAGE_TYPE=memory

# Maximum contexts for in-memory storage (default: 10000)
MEMORY_MAX_SIZE=10000

# Redis URL (only if STORAGE_TYPE=redis)
REDIS_URL=redis://localhost:6379

# Node environment (development or production)
NODE_ENV=development

MCP Client Integration

Claude Code

# Add via npx (recommended)
claude mcp add klever-vm -- npx -y @klever/mcp-server

# Or connect to the public hosted server
claude mcp add -t http klever-vm https://mcp.klever.org/mcp

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "klever-vm": {
      "command": "npx",
      "args": ["-y", "@klever/mcp-server"]
    }
  }
}

For detailed setup, see the Claude Desktop Installation Guide.

Cursor

Add to your Cursor MCP settings (.cursor/mcp.json):

{
  "mcpServers": {
    "klever-vm": {
      "command": "npx",
      "args": ["-y", "@klever/mcp-server"]
    }
  }
}

VS Code (GitHub Copilot)

Add to .vscode/mcp.json in your project:

{
  "servers": {
    "klever-vm": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@klever/mcp-server"]
    }
  }
}

For detailed setup, see the VS Code Installation Guide.

Public MCP Server

The Klever MCP Server can be hosted as a public shared service, allowing any developer to connect without running it locally.

Connecting to the Public Server

# Add permanently (user-level)
claude mcp add -t http klever-vm https://mcp.klever.org/mcp

# Add for current project only
claude mcp add -t http -s project klever-vm https://mcp.klever.org/mcp

Available Tools (Public Mode)

The public server exposes a read-only subset of tools for security:

ToolDescription
query_contextSearch the Klever VM knowledge base
get_contextRetrieve a specific context by ID
find_similarFind contexts similar to a given context
get_knowledge_statsGet knowledge base statistics
enhance_with_contextEnhance queries with relevant Klever VM context

Write operations (add_context) and shell-based tools (init_klever_project, add_helper_scripts) are disabled in public mode.

Self-Hosting with Docker

# Build and run
docker build -t mcp-klever-vm .
docker run -p 3000:3000 mcp-klever-vm

# Or using docker compose
docker compose up -d

Then connect:

claude mcp add -t http klever-vm-local http://localhost:3000/mcp

Self-Hosting without Docker

pnpm install
pnpm run build
pnpm run start:public

Environment Variables (Public Mode)

VariableDefaultDescription
MODEhttpSet to public for hosted mode
PORT3000Server port
CORS_ORIGINS(unset)Comma-separated allowed origins. Unset or * allows all origins
RATE_LIMIT_MCP60MCP endpoint requests/min per IP
RATE_LIMIT_API30API endpoint requests/min per IP
BODY_SIZE_LIMIT1mbMax request body size

Deployment Notes

For production at mcp.klever.org:

  • Deploy Docker container behind a reverse proxy (nginx/Caddy/cloud LB) for TLS termination
  • Ensure proxy passes mcp-session-id header and supports SSE (disable response buffering)
  • Single instance is sufficient as the server is read-only with an in-memory knowledge base
  • Consider Cloudflare for DDoS protection (SSE is supported)

Usage

Knowledge Base Loading

The server automatically loads the Klever knowledge base based on your storage type:

Memory Storage (Default)

  • Knowledge is automatically loaded when the server starts
  • No need to run pnpm run ingest separately
  • Data exists only while server is running
  • Best for development and testing

Redis Storage

# First, ingest the knowledge base (one time)
pnpm run ingest

# Then start the server
pnpm run dev
  • Knowledge persists in Redis database
  • Survives server restarts
  • Best for production use

This will load:

  • Smart contract templates and examples
  • Annotation rules and best practices
  • Storage mapper patterns and comparisons
  • Deployment and query scripts
  • Common errors and solutions
  • Testing patterns
  • API reference documentation

Running as HTTP Server

# Development mode
pnpm run dev

# Production mode
pnpm run build && pnpm start

The HTTP API will be available at http://localhost:3000/api

Running as MCP Server

MODE=mcp pnpm start

Use with any MCP-compatible client.

API Endpoints

POST /api/context

Ingest new context into the system.

{
  "type": "code_example",
  "content": "contract code here",
  "metadata": {
    "title": "Token Contract Example",
    "description": "ERC20-like token implementation",
    "tags": ["token", "fungible"],
    "contractType": "token"
  }
}

GET /api/context/:id

Retrieve specific context by ID.

POST /api/context/query

Query contexts with filters.

{
  "query": "transfer",
  "types": ["code_example", "best_practice"],
  "tags": ["token"],
  "contractType": "token",
  "limit": 10,
  "offset": 0
}

PUT /api/context/:id

Update existing context.

DELETE /api/context/:id

Delete context.

GET /api/context/:id/similar

Find similar contexts.

POST /api/context/batch

Batch ingest multiple contexts.

MCP Tools

When running as MCP server, the following tools are available:

  • query_context: Search for relevant Klever development context
  • add_context: Add new context to the knowledge base
  • get_context: Retrieve specific context by ID
  • find_similar: Find contexts similar to a given context
  • get_knowledge_stats: Get statistics about the knowledge base
  • init_klever_project: Initialize a new Klever smart contract project with helper scripts
  • enhance_with_context: Automatically enhance queries with relevant Klever VM context

Context Types

  • code_example: Working code snippets and examples (Rust smart contract code)
  • best_practice: Recommended patterns and practices
  • security_tip: Security considerations and warnings
  • optimization: Performance optimization techniques
  • documentation: General documentation and guides
  • error_pattern: Common errors and solutions
  • deployment_tool: Deployment scripts and utilities (bash scripts, tools)
  • runtime_behavior: Runtime behavior explanations

Pre-loaded Knowledge Base

The MCP server includes a comprehensive knowledge base with 95+ entries organized into 11 categories:

Critical Patterns

  • Payment handling and token operations
  • Decimal conversions and calculations
  • Event emission and parameter rules
  • CLI tool usage and best practices

Contract Patterns & Examples

  • Basic contract structure templates
  • Complete lottery game implementation
  • Staking contract with rewards
  • Cross-contract communication patterns
  • Remote storage access patterns
  • Token mapper helper modules

Development Tools

  • Koperator: Complete CLI reference with argument encoding
  • KSC: Build commands and project setup
  • Deployment, upgrade, and query scripts
  • Interactive contract management tools
  • Common utilities library (bech32, network management)

Storage & Optimization

  • Storage mapper selection guide with performance comparisons
  • Namespace organization patterns
  • View endpoints for efficient queries
  • Gas optimization techniques
  • OptionalValue vs Option patterns

Best Practices & Security

  • Input validation patterns
  • Error handling strategies
  • Admin and pause module usage
  • Access control patterns
  • Common mistakes and solutions

Ingesting Contracts

Use the built-in ingestion utilities to parse and import Klever contracts:

import { StorageFactory } from './storage/index.js';
import { ContextService } from './context/service.js';
import { ContractIngester } from './utils/ingest.js';

const storage = StorageFactory.create('memory');
const contextService = new ContextService(storage);
const ingester = new ContractIngester(contextService);

// Ingest a single contract
await ingester.ingestContract('./path/to/contract.rs', 'AuthorName');

// Ingest entire directory
await ingester.ingestDirectory('./contracts', 'AuthorName');

// Add common patterns
await ingester.ingestCommonPatterns();

Development

# Run tests
pnpm test

# Lint code
pnpm run lint

# Format code
pnpm run format

# Watch mode
pnpm run dev

# Ingest/update knowledge base
pnpm run ingest

Contract Validation

The server can automatically validate Klever contracts and detect issues:

import { KleverValidator } from './parsers/validators.js';

const issues = KleverValidator.validateContract(contractCode);
// Returns array of detected issues with suggestions

Validation checks include:

  • Event annotation format (double quotes, camelCase)
  • Managed type API parameters
  • Zero address validation in transfers
  • Optimal storage mapper selection
  • Module naming conventions

Example Use Cases

1. Smart Contract Development Assistant

Integrate with your IDE to provide context-aware suggestions for Klever contract development.

2. Code Review Tool

Automatically check contracts against best practices and security patterns.

3. Learning Platform

Provide examples and explanations for developers learning Klever development.

4. Documentation Generator

Extract and organize contract documentation automatically.

Project Specifications and Examples

For complete project implementation examples and specifications, see:

  • Project Specification Template - A fill-in template for specifying Klever smart contract projects. Guides AI assistants through MCP knowledge discovery, task tracking, and phased implementation. Includes a KleverDice example.

Project Initialization

The MCP server includes a powerful project initialization tool that creates a new Klever smart contract project with all necessary helper scripts.

Using the init_klever_project Tool

When connected via MCP, use the init_klever_project tool:

{
  "name": "my-token-contract",
  "template": "empty",
  "noMove": false
}

Parameters:

  • name (required): The name of your contract
  • template (optional): Template to use (default: "empty")
  • noMove (optional): If true, keeps project in subdirectory (default: false)

Generated Helper Scripts

The tool creates the following scripts in the scripts/ directory:

  • build.sh: Builds the smart contract
  • deploy.sh: Deploys to Klever testnet with auto-detection of contract artifacts
  • upgrade.sh: Upgrades existing contract (auto-detects from history.json)
  • query.sh: Query contract endpoints with proper encoding/decoding
  • test.sh: Run contract tests
  • interact.sh: Shows usage examples and available commands

Example Workflow

  1. Initialize project:

    # Via MCP tool
    init_klever_project({"name": "my-contract"})
    
  2. Build contract:

    ./scripts/build.sh
    
  3. Deploy to testnet:

    ./scripts/deploy.sh
    
  4. Query contract:

    ./scripts/query.sh --endpoint getSum
    ./scripts/query.sh --endpoint getValue --arg myKey
    
  5. Upgrade contract:

    ./scripts/upgrade.sh
    

All deployment history is tracked in output/history.json for easy reference.

Automatic Context Enhancement

The MCP server can automatically enhance queries with relevant Klever VM context. This ensures your MCP client always has access to the most relevant information.

Using Context Enhancement

Use the enhance_with_context tool to automatically add relevant context to any query:

{
  "tool": "enhance_with_context",
  "arguments": {
    "query": "How do I create a storage mapper?",
    "autoInclude": true
  }
}

This will:

  1. Extract relevant keywords from the query
  2. Search the knowledge base for matching contexts
  3. Return an enhanced query with context included
  4. Provide metadata about what was found

Integration Pattern

For MCP clients that want to always check Klever context first:

// Always enhance Klever-related queries
if (query.match(/klever|kvm|smart contract|endpoint/i)) {
  const enhanced = await callTool('enhance_with_context', { query });
  // Use enhanced.enhancedQuery for processing
}

The context enhancement feature automatically enriches queries with relevant Klever VM knowledge from the comprehensive knowledge base.

Integration Examples

VS Code Extension

// Query for token transfer examples
const response = await fetch('http://localhost:3000/api/context/query', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    query: 'transfer',
    types: ['code_example'],
    contractType: 'token'
  })
});

CLI Tool

# Using curl to add context
curl -X POST http://localhost:3000/api/context \
  -H "Content-Type: application/json" \
  -d '{
    "type": "security_tip",
    "content": "Always check for zero address",
    "metadata": {
      "title": "Zero Address Check",
      "tags": ["security", "validation"]
    }
  }'

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Acknowledgments

  • Inspired by Context7 by Upstash
  • Built for the Klever Blockchain
  • Uses the Klever VM SDK (Rust)
Featured
CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Keep your Mac awake
Keep your Mac awake
Keep your Mac awake while Claude Code and 40+ AI agents run. Sleeps when they're idle.
One time payment $9 →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
Registryactive
Package@klever/mcp-server
TransportSTDIO, HTTP
Resources1
Prompts4
Tools verifiedJun 10, 2026
UpdatedMar 19, 2026
View on GitHub