@klever/klever-connect-mcp
v1.0.2
Published
MCP server for klever-connect — Unified JavaScript/TypeScript SDK for the Klever blockchain
Keywords
Readme
klever-connect-mcp
MCP server for klever-connect — Unified JavaScript/TypeScript SDK for the Klever blockchain. Provides offline transaction building, wallet management (Node + Browser extension), provider/network communication, smart contract interactions (ABI-based), HD wallets, and React hooks.
What's Inside
| Knowledge File | Entries | Content | |---|---|---| | api-reference.json | 46 | API methods, classes, and interfaces | | best-practices.json | 11 | Recommended patterns and security tips | | configuration.json | 5 | Network, provider, and environment setup | | documentation.json | 9 | Architecture guides and migration docs | | errors.json | 12 | Common error patterns with fixes | | examples.json | 21 | Working code snippets (Node.js, React, contracts) | | patterns.json | 12 | Design patterns and integration workflows | | types.json | 9 | TypeScript types and interfaces | | Total | 125 | |
Quick Start
pnpm install
pnpm dev # HTTP mode -> http://localhost:3000/mcp
MODE=mcp pnpm dev:mcp # stdio mode for Claude Desktop / CursorRequirements
- Node.js >= 18.14.0
- pnpm (recommended) or npm
Installation
git clone https://github.com/klever-io/mcp-klever-connect.git
cd mcp-klever-connect
pnpm install
pnpm buildRunning
Streamable HTTP (default)
pnpm dev # development (auto-reload)
pnpm start # production (requires pnpm build first)MCP endpoint: http://localhost:3000/mcp
stdio (Claude Desktop, Cursor, Claude Code)
MODE=mcp pnpm dev:mcpPublic mode (security headers + restricted CORS)
MODE=public CORS_ORIGINS=https://yourdomain.com pnpm dev:publicConfiguration
| Variable | Default | Description |
|---|---|---|
| MODE | http | http, public, mcp/stdio |
| PORT | 3000 | Server port |
| HOST | 0.0.0.0 | Bind address |
| KNOWLEDGE_DIR | ./knowledge | Path to knowledge JSONs |
| MAX_SIZE | 10000 | Max entries in memory |
| CORS_ORIGINS | * | Comma-separated allowed origins |
MCP Tools
| Tool | Description |
|---|---|
| query_context | Structured search with BM25 ranking + type/tag/category filters |
| get_context | Retrieve full entry by ID |
| find_similar | Find related entries by tag/type overlap |
| get_knowledge_stats | Knowledge base overview (total, types, top tags) |
| enhance_with_context | Augment a query with top-5 relevant entries |
| search_documentation | Natural-language search with formatted markdown output |
MCP Resources
| URI | Description |
|---|---|
| knowledge://index | Browse all categories, types, and top tags |
| knowledge://category/{category} | All entries in a category |
| knowledge://type/{type} | All entries of a type |
| knowledge://entry/{id} | Single entry with full content |
Entry Types
| Type | Description |
|---|---|
| code_example | Working code snippets |
| best_practice | Recommended patterns |
| security_tip | Security guidance |
| optimization | Performance advice |
| documentation | API reference and guides |
| error_pattern | Common mistakes + fixes |
| deployment_tool | Build/deploy instructions |
| runtime_behavior | Lifecycle and gotchas |
Search Quality
The knowledge base uses BM25 full-text ranking with:
- Stopword filtering — removes noise words (the, is, how, what, show, code, example, etc.)
- Stemming — matches plural/tense variations (balance/balances/balanced)
- Weighted fields — titles and tags are weighted higher than content body
- Relevance scoring — combines BM25 scores with curated relevance metadata
Project Structure
mcp-klever-connect/
├── src/
│ ├── types/index.ts Zod schemas + TypeScript types
│ ├── storage/memory.ts In-memory storage with BM25 search
│ ├── storage/index.ts Storage exports
│ ├── context/service.ts Business logic + relevance scoring
│ ├── utils/auto-ingest.ts Knowledge JSON loader
│ ├── mcp/server.ts MCP server (tools + resources + prompt hook)
│ ├── mcp/resources.ts Resource builders (markdown output)
│ └── index.ts Entry point (http/public/stdio modes)
├── knowledge/ Knowledge base JSON files (125 entries)
├── package.json
├── tsconfig.json
├── Makefile
└── DockerfileConnecting MCP Clients
Claude Desktop (stdio)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"klever-connect": {
"command": "node",
"args": ["/absolute/path/to/mcp-klever-connect/dist/index.js"],
"env": { "MODE": "mcp" }
}
}
}Cursor (stdio)
Edit .cursor/mcp.json in your workspace:
{
"mcpServers": {
"klever-connect": {
"command": "node",
"args": ["/absolute/path/to/mcp-klever-connect/dist/index.js"],
"env": { "MODE": "mcp" }
}
}
}Claude Code (Streamable HTTP)
claude mcp add klever-connect --transport http http://localhost:3000/mcpDocker
docker build -t klever-connect-mcp .
docker run -p 3000:3000 -e MODE=public klever-connect-mcp # HTTP public
docker run klever-connect-mcp # stdio (default)License
MIT
