Version: 2.17.0 | Protocol:
misaka-protocol.json
MisakaNet exposes a multi-surface API: CLI search, MCP tools, GitHub-based contribution endpoints, and optional Hub federation. This document catalogues every supported interface.
The primary entry point for knowledge retrieval.
python3 search_knowledge.py "<query>" [flags]| Flag | Description |
|---|---|
--lessons |
Search only lesson files |
--ref |
Search only reference documents |
--titles |
Match against titles only |
--domain <name> |
Filter by domain (e.g., python, docker) |
--semantic |
Enable semantic search (requires sentence-transformers) |
--explain |
Show score breakdowns and match reasons |
--json |
Output results as JSON |
--top N |
Limit to top N results (default: 10) |
--verbose |
Show detailed scoring metadata |
{
"title": "Lesson title",
"domain": "python",
"tags": ["tag1", "tag2"],
"score": 0.8765,
"path": "lessons/domain/filename.md",
"preview": "First 120 characters...",
"match_reason": "title + body match",
"preview_highlighted": "First 120 chars with <mark>...</mark>",
"confidence": "high",
"result_type": "lesson",
"score_breakdown": {
"bm25": 0.8234,
"title_boost": 1.5,
"tag_match": 1.2,
"final": 0.8765
}
}| Code | Meaning |
|---|---|
| 0 | Success — results returned |
| 1 | Search failed or no results found |
Two transports are available: stdio (local) and HTTP/SSE (remote).
python3 scripts/mcp_server.pyExposes 4 tools via MCP stdio protocol:
| Tool | Parameters | Returns |
|---|---|---|
misakanet.search |
query (str), domain? (str), top? (int=5) |
Ranked lesson results |
misakanet.get_lesson |
path_or_id (str) |
Full lesson markdown content |
misakanet.submit_usage |
lesson_id (str), tool (str), outcome (str) |
Confirmation |
misakanet.usage_status |
user? (str) |
Usage statistics |
{
"mcpServers": {
"misakanet": {
"command": "python3",
"args": ["C:/path/to/MisakaNet/scripts/mcp_server.py"]
}
}
}python3 scripts/mcp_http_server.py [--port 8080]Started on http://localhost:8080/mcp by default. Compatible with any MCP client supporting Streamable HTTP transport.
{
"mcpServers": {
"misakanet-http": {
"url": "http://localhost:8080/mcp"
}
}
}Server identity advertised at connection:
{
"name": "misakanet",
"version": "2.16.0",
"description": "MisakaNet knowledge search and contribution"
}Submit lessons directly via GitHub API — no fork or git push required.
# Submit a pre-written .md file
python3 scripts/contribute.py path/to/lesson.md
# Create a lesson inline
python3 scripts/contribute.py -t "Title" -d domain --tags "tag1,tag2" "Content body..."GITHUB_TOKENenvironment variable (or~/.git-credentials)- PR is created against
Ikalus1988/MisakaNet:main - Branch is auto-named
lesson/<slug>
- Get default branch SHA (
GET /repos/Ikalus1988/MisakaNet/git/ref/heads/main) - Create blob (
POST /repos/Ikalus1988/MisakaNet/git/blobs) - Create tree (
POST /repos/Ikalus1988/MisakaNet/git/trees) - Create commit (
POST /repos/Ikalus1988/MisakaNet/git/commits) - Create branch ref (
POST /repos/Ikalus1988/MisakaNet/git/refs) - Create PR (
POST /repos/Ikalus1988/MisakaNet/pulls)
python3 scripts/queue_lesson.py \
-t "Title" -d domain \
--tags "node:name,project:name" \
"Problem\n\n## Root Cause\n...\n\n## Fix\n...\n\n## Verification\n..."The Hub provides a lightweight sync scheduler with optional federation.
python3 hub/misaka_hub.py| Mode | Description |
|---|---|
| Standalone | Periodic git fetch + knowledge graph rebuild |
| Master | Master API for multi-node coordination |
| Federation | HMAC-authenticated inter-node sync |
| Endpoint | Method | Description |
|---|---|---|
/status |
GET | Node health and sync status |
/nodes |
GET | Registered node directory |
/sync/trigger |
POST | Force immediate sync |
# Node-to-node authentication with shared secret
from hub.federation.hmac_auth import sign_request, verify_request
signed = sign_request(payload, secret_key)
verified = verify_request(signed, secret_key)from hub.storage.knowledge_graph import KnowledgeGraph
kg = KnowledgeGraph()
kg.build() # Rebuild from lessons/
kg.query("concept") # Semantic queryOptional notification channels for sync events.
Configure via environment variables:
| Variable | Purpose |
|---|---|
DISCORD_WEBHOOK_URL |
Discord notification webhook |
SLACK_WEBHOOK_URL |
Slack incoming webhook |
EMAIL_SMTP_HOST |
SMTP server for email |
EMAIL_TO |
Recipient address |
| Variable | Purpose |
|---|---|
FEISHU_WEBHOOK_URL |
Feishu bot webhook URL |
python3 scripts/misaka_verify.pyValidates protocol configuration against misaka-protocol.json.
python3 scripts/validate_lessons.py [--strict]Checks all lesson frontmatter for schema compliance.
python3 scripts/site_health_check.pyEnd-to-end health check of deployed services.
# Core search engine
from misakanet.search.engine import MisakaNetSearchEngine, _search_cached, LESSONS
# Lesson scoring
from misakanet.tools.lesson_scorer import score_lessons, format_lesson_scores
# BM25 via ecosystem package
from misakanet_core import BM25, tokenize, rrf
# Node profile
from misakanet.profile import NodeProfile
# Evidence tracking
from misakanet.evidence import EvidenceTracker- GitHub API: Standard rate limits apply (5000 req/h authenticated)
- MCP stdio: Single-connection, no built-in rate limiting
- MCP HTTP: No built-in rate limiting — use a reverse proxy for production
- Search: L1/L2 caching built into
misakanet.search.engine - Notifiers: Exponential backoff on webhook failures (3 retries, 2s/4s/8s)