section

KB Environment

KB Environment

Environment Configuration

  • Location: /opt/mcp-servers/kb/mcp_kb_server.py
  • Version: 1.1.0 (Stable user ID support)
  • Vault Port: 6625 (requires password)
  • Operational Port: 6626

Purpose

Unlimited hierarchy knowledge base with documentation-style structure. Supports tree structures like:

Root > Section > Page > Subsection > Content

Unlike Context (flat key-value), KB supports unlimited depth hierarchies.

Tools (10 total)

Tool Description Required Params
create Create KB node title (required)
get Get node by ID or slug node_id OR path
update Update node content/title node_id (required)
move Move node to new parent node_id, new_parent_id
delete Delete node node_id, cascade
tree Get full tree structure node_id, max_depth
roots List all root KBs none
search Search by title/content/tags query (required)
children Get immediate children node_id (required)
breadcrumb Get path from root to node node_id (required)

Node Types

  • root - Top-level knowledge base
  • section - Major section/category
  • page - Content page
  • content - Content block within page

Architecture

Key Schema

  • kb:{user}:node:{node_id} → Node JSON
  • kb:{user}:roots → Set of root node IDs
  • kb:{user}:node:{node_id}:children → Ordered list of children
  • kb:{user}:slug:{full/path/slug} → node_id mapping
  • kb:{user}:all_nodes → Set of all node IDs

Features

  • Tree pattern with parent-child relationships
  • Slug-based URL paths for web routing
  • Atomic children lists (race-condition safe)
  • Session linking via session_helper
  • Graph indexing via graph_helper
  • Credentials from credentials_helper

Security Assessment

✅ Uses credentials_helper when available ✅ Node IDs are hashed (MD5) ✅ Slugs sanitized via regex ✅ No injection risks ⚠️ Fallback password 'tg6ap5' hardcoded (line 73) - low risk

Test Results

✅ Redis 6625 (vault): Responding ✅ Redis 6626 (operational): Responding ✅ kb.roots: Lists 50+ root KBs ✅ kb.tree: Shows hierarchy correctly ✅ kb.search: Finds nodes by content ✅ kb.get: Retrieves node with children

Bug Fixes Applied

✅ Duplicate Children Bug (Fixed 2026-01-06 by Vader) - Root cause: rpush to children list without checking for existing entries - Fix: Added existence check before rpush in kb_create, kb_move, kb_roots, kb_children, kb_delete - Data cleanup: 35 Redis children lists deduplicated - Files modified: /opt/mcp-servers/kb/mcp_kb_server.py (5 edits)

⚠️ Port 6626 AUTH Warning: Returns "AUTH failed" warning but still works (cosmetic)

Status: WORKING

All 10 tools functional. Duplicate children bug fixed.

ID: 9a7cfae2
Path: Nexus 3.0 Complete Environment Reference > KB Environment
Updated: 2026-01-06T12:47:06