原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。使用 Google 登录即可撰写评价。原型 · 每 30 分钟更新
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

MCP Klever Vm

作者:klever-io版本 1.3.0i★ 31i电脑或云端官方网站 ↗
注册名称io.github.klever-io/mcp-klever-vm

安装方法

What it does

MCP server for Klever blockchain smart contract development.

  • Connects 电脑或云端
  • Account or key No key needed
  • Category 加密货币与区块链

为什么排在这里

列表按使用分(满分 100)排序,由以下部分组成

热度18/80GitHub 星标或每周下载量:较大的计 60,较小的计 20
新鲜度3/1230 天内有发布或代码更新得满分
仍在响应8/8上次检查时云端端点有响应
使用分29/100

质量: 基础检查通过 4/5 项(仅展示,不用于排序) · 上升势头: 暂无数据 (只用于“上升中”标签)

安装

选择你使用的 AI 应用,然后复制设置。

用一句话让 AI 帮你安装

请帮我安装 MCP Klever Vm。按照 https://mcp.popnx.com/i/klever-io-mcp-klever-vm.md 操作,先把命令给我看,等我同意后再运行。

粘贴到能在你电脑上工作的 AI(如 Claude Code、Cursor)。它会读取我们的步骤,先给你看命令,等你同意。无需密钥,无需注册。 · 查看 AI 会读取的全文

通过 4/5 项检查 · 你的提问会经过开发者的服务器(mcp.klever.org) · ✓ 命令已检查 2026年11月13日

第一步:你用哪个 AI?

选择你用的应用,步骤会显示在下方。

可连接 Claude · 约 2 分钟

不需要密钥,不用安装程序 · 在 claude.ai 或桌面应用设置一次,即可在聊天中使用 · 免费账户可添加 1 个 · Team/Enterprise 方案由所有者(Owner)添加

  1. 打开 Claude 的 Connectors 页面

    CustomizeConnectors

    CustomizeConnectors1Add2https://…3Add4
  2. 点击“Add” → “Custom” → “Web”,填写这 2 项

    把这里的内容复制到 Claude 中同名的输入框,然后点击 Continue

    Name · 名称MCP Klever Vm
    Remote MCP server URL · 地址https://mcp.klever.org/mcp

    在 Claude 检测到的登录设置页点击 Continue · Authentication 按作者说明选择(Sign in now、Sign in when needed 或 No sign in),然后点击 Add

  3. 在聊天中开启

    +ConnectorsMCP Klever Vm

  4. 试一试

    用 MCP Klever Vm 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude 说正在使用 MCP Klever Vm,或回答中出现 MCP Klever Vm 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同

能否连接 ChatGPT 取决于方案

完整 MCP:网页版 ChatGPT Business、Enterprise 或 Edu · Pro:以读取/获取权限连接,修改数据的工具可能用不了 · Plus:官方文档尚未确认,如果在插件页看到添加自定义 MCP 的选项可以试试 · 仅限网页

  1. 在网页版 ChatGPT 打开添加 MCP 的页面

    Plugins+Add custom MCP server

    ChatGPTPlugins1+2https://…3Create4
  2. 填写名称和地址

    输入名称,在 Connection 下粘贴地址,勾选风险提示,然后点击 Create as a plugin

    Name · 名称MCP Klever Vm
    Connection · 地址https://mcp.klever.org/mcp
  3. 在聊天中选择 MCP Klever Vm

    开启新聊天,输入前先从插件列表中选择 MCP Klever Vm

  4. 试一试

    用 MCP Klever Vm 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 ChatGPT 说正在使用 MCP Klever Vm,或回答中出现 MCP Klever Vm 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 OpenAI 帮助页面核实 · 你的界面可能因版本略有不同

可连接 Claude Code · 约 2 分钟

不需要密钥,不用安装程序

  1. 打开终端

    Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell

  2. 粘贴这条命令并按 Enter

    claude mcp add --transport http --scope user klever-vm https://mcp.klever.org/mcp
  3. 在 Claude Code 中输入 /mcp

    应能看到 MCP Klever Vm 在列表中并显示已连接

  4. 试一试

    用 MCP Klever Vm 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude Code 说正在使用 MCP Klever Vm,或回答中出现 MCP Klever Vm 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同

可连接 Cursor · 约 2 分钟

不需要密钥,不用安装程序

  1. 点击这个按钮打开 Cursor

    在 Cursor 中打开

    Cursor 会请你确认安装,点击 Install

  2. 在 Cursor 中以 Agent 模式打开 AI 聊天

  3. 试一试

    用 MCP Klever Vm 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Cursor 说正在使用 MCP Klever Vm,或回答中出现 MCP Klever Vm 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同

可连接 VS Code · 约 2 分钟

不需要密钥,不用安装程序

  1. 点击这个按钮打开 VS Code

    在 VS Code 中打开

    VS Code 会请你确认安装,点击 Install

  2. 在 VS Code 中以 Agent 模式打开 AI 聊天

  3. 试一试

    用 MCP Klever Vm 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 VS Code 说正在使用 MCP Klever Vm,或回答中出现 MCP Klever Vm 的工具名称,就表示连接成功

菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同

其他支持 MCP 的应用(如 Windsurf、Zed、Gemini CLI)添加方式各不相同,请在应用列表中查看

查看所有支持 MCP 的应用 →

通过网页连接的应用使用的地址

地址https://mcp.klever.org/mcp

JSON 设置在下方“开发者专用”中

卡住了?问问正在用 MCP Klever Vm 的人💬 讨论 →
开发者专用:终端命令和 JSON 设置

通过网页连接

Claude Code

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

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "klever-vm": {
      "url": "https://mcp.klever.org/mcp"
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "klever-vm": {
      "type": "http",
      "url": "https://mcp.klever.org/mcp"
    }
  }
}

安装在电脑上

Claude Code

claude mcp add --scope user klever-vm -- npx -y @klever/mcp-server

Claude Desktop (claude_desktop_config.json)

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

Cursor (~/.cursor/mcp.json)

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

VS Code (mcp.json)

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

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

一览

每周下载量i
88/周
连接方式
电脑或云端
传输方式
stdio, streamable-http
最新版本i
1.3.0
发布到注册中心i
2026年3月20日
代码最后更新i
2026年5月19日
最近检查
2026年11月18日
作者
klever-io
软件包
npm: @klever/mcp-server
注册状态
活跃

哪些应用可以使用它

依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。

通过互联网连接,适用于

ClaudeChatGPTGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatOpen WebUIRaycast

在你的电脑上运行,适用于

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

全部应用及其优缺点 →

它能做什么

工具名称和描述与服务器在 2026年11月18日 报告的完全一致。这些内容由作者撰写,不是我们写的;我们以纯文本形式显示。

  • query_context

    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.

  • get_context

    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.

  • find_similar

    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.

  • get_knowledge_stats

    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.

  • enhance_with_context

    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 before a

  • search_documentation

    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.

  • analyze_contract

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

  • get_balance

    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.

  • get_account

    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.

  • get_asset_info

    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 the

  • query_sc

    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.

  • get_transaction

    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.

  • get_block

    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.

  • list_validators

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

  • init_klever_project

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

  • add_helper_scripts

    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 pr

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月19日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 klever-io 验证,该账户拥有此仓库

  • ! 注意

    仍在维护

    代码最后更新于6个月前,已超过 6 个月

  • ✓ 通过

    有许可证

    使用 MIT

  • ✓ 通过

    端点有响应

    在 133 毫秒内响应(HTTP 200)

  • – 不适用

    使用 OAuth 登录

    无需登录

  • ✓ 通过

    工具描述中没有隐藏指令

    已读取 16 个工具描述,未发现针对 AI 的隐藏指令

云端地址最近 4 次检查中有 4 次响应 · 最近一次 133 ms · 检查于 2026年11月18日

已公开的漏洞(OSV.dev)

OSV.dev 中没有 @klever/mcp-server@1.3.0 的记录

只检查这个版本的包本身,不包括所有依赖 · 检查于 2026年11月15日

我们检查什么 → · JSON

作者:申请重新检查或报告信息错误
给作者:在 README 中加徽章

如果你是作者,可把这段代码贴到 README。徽章会链接回本页。

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/klever-io-mcp-klever-vm.svg)](https://mcp.popnx.com/en/servers/klever-io-mcp-klever-vm)

讨论

提问、分享技巧或报告无法使用。按“有帮助”数量排序。

还没有帖子,欢迎第一个提问或分享。

此处内容由用户撰写,不代表 PopNx 团队。

登录后发帖

用户评价

还没有评价

登录后写评价

与“加密货币与区块链”中的其他服务器比较i

  • 星标数多于此分类中其他 1759 个服务器的 98%
  • 发布到注册中心的时间比此分类中其他 1759 个服务器的 7% 更新
  • 基础检查结果等于或优于此分类中其他 1759 个服务器的 60%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

MCP Klever Vm 安全吗?

它在 5 项适用的基础检查中通过了 4 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。

它在我的电脑上运行还是在云端?

两种方式都可以:安装在你的电脑上,或者连接云端版本。

它还在维护吗?

GitHub 仓库最后更新于6个月前,最新版本(1.3.0)于8个月前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。它通过 URL 连接,因此也能用于接受远程 MCP 的应用,例如网页版 ChatGPT(Business 及以上为完整 MCP;Pro 为只读)。

有什么可以替代它?

同一分类中有:DexSQL, PayRam, DexPaprika, Alchemy MCP Server, X402 List MCP

功能相近的其他选择

同一分类、其他作者、命令已通过检查。官方的排在前面,再按星标排序。

如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

DexSQL

SQL for Android APK and DEX files: classes, methods, strings, references and smali.

作者:LSPosed正在增长★ 32032天前更新

在你的电脑上运行✓ lsposed.org

PayRam

Install, configure, operate and integrate self-hosted PayRam crypto payment gateways.

作者:PayRam正在增长★ 15843天前更新

在云端运行✓ 服务方 · payram.com

DexPaprika

DEX and on-chain data: liquidity pools, token prices, swaps, and trading volume.

作者:coinpaprika正在增长★ 1206天前更新

在云端运行✓ 服务方 · dexpaprika.com

X402 List MCP

Find and vet x402 payment APIs before your agent pays one: uptime, price, on-chain volume.

作者:mcccsm起步阶段↓ 80/周★ 1840天前更新

电脑或云端✓ 服务方 · x402-list.com
与相似项目对比
本项
MCP Klever Vm
DexSQLPayRamDexPaprikaAlchemy MCP ServerX402 List MCP
运行位置云端或安装在电脑上都可以需要安装在电脑上在云端运行,无需安装在云端运行,无需安装在云端运行,无需安装云端或安装在电脑上都可以
需要密钥否否否否否否
可在 Claude 中按 + 添加否否否否否否
基础检查4/52/33/44/44/45/5
许可证MITNOASSERTION–MITMITMIT
价格登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

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
  1. API Security
  • Added input validation for all endpoints
  • Batch operation size limits
  • Proper error responses without leaking internals
  • Environment-aware error messages
  1. Type Safety
  • Centralized schema validation
  • Proper TypeScript interfaces for options
  • Runtime validation of stored data
  1. 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 './ut

只显示了开头部分;其余内容请在仓库中阅读