Skip to main content
Glama
guyeyouhun

auto-knowledge-base

by guyeyouhun

Quick Start

# 1. Install
git clone https://github.com/guyeyouhun/auto-knowledge-base.git
cd auto-knowledge-base
npm install                   # installs deps + auto-downloads embedding model (~55MB)
npm run build
node dist/install.js          # creates .env template

# 2. Configure LLM (needed for rerank/synthesis)
# Edit .env:
LLM_BASE_URL=https://api.openai.com/v1
LLM_API_KEY=sk-...
LLM_MODEL=gpt-4o

# 3. Start
node dist/index.js            # runs as MCP server over stdio

No additional services. No embedding server, no vector database, no Python runtime. BM25 and vector search both run in-process with SQLite + ONNX.


Related MCP server: Open WebUI Knowledge Base MCP Server

Usage

# Store knowledge → staging
knowledge_learn(content: "Vite uses Rollup for production bundling", title: "Vite Build")

# Confirm → committed
knowledge_confirm(id: "550e8400-e29b-41d4-a716-446655440000")

# Search (BM25 + vector hybrid + LLM rerank)
knowledge_search(query: "vite rollup")

# Role-aware knowledge push
knowledge_relevant(role: "frontend", task: "configure build tooling")

# Export backup
knowledge_export

Core Architecture

Layer

Technology

Retrieval

FTS5 BM25 → cosine similarity → LLM rerank

Embedding

Process-internal ONNX via fastembed (BGESmallZH, 512-dim)

Storage

SQLite + WAL + FTS5 + relation graph + vector columns

Spaced repetition

FSRS-6 for retention optimization

Knowledge diffusion

Role-based BFS activation

Search pipeline

query → BM25 FTS5 → vector cosine rerank
  → if BM25 < limit: vector similarity scan → results
  → (optional) LLM rerank + synthesis

Every stage degrades gracefully. No single failure blocks the response.

Knowledge lifecycle

learn (staging) → confirm (confirmed) → FSRS decay → frozen
                                              ↓
                             refresh queue → content-digester re-digest

MCP Tools

Core (4)

Tool

Description

knowledge_search

BM25 + vector hybrid + LLM rerank

knowledge_learn

Store knowledge (staging), auto-dedup

knowledge_confirm

staging → confirmed

knowledge_relevant

Role-based diffusion + BFS activation

Configuration (2)

Tool

Description

knowledge_role_config

Role entry nodes, diffusion depth

knowledge_config

View LLM configuration

Operations (5)

Tool

Description

knowledge_maintenance

FSRS-6 decay sweep

knowledge_export / import

JSON backup / restore

knowledge_audit

Operation log

knowledge_status

Statistics (truth, temperature, relations, embeddings)

Feedback (3)

Tool

Description

knowledge_request_refresh

Request re-digestion (content-digester integration)

knowledge_report_gap

Report knowledge gaps, triggers auto-digest

knowledge_gaps

Query gap records by status/role


Configuration

Only the LLM needs to be configured (in .env):

LLM_BASE_URL=http://localhost:11434/v1
LLM_API_KEY=your-api-key
LLM_MODEL=gpt-4o

The embedding model (fastembed + BGESmallZH) is automatically downloaded during npm install to knowledge/models/. No embedding configuration needed.


Development

npm test                    # 157 tests, 21 files
npm run test:watch          # watch mode
npm run build               # tsc + copy schema

Design


Available Tools

6 tools
knowledge_configA

查看 LLM 配置信息(不暴露密钥)。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description mentions that keys are not exposed, which is a behavioral trait. However, no other traits (e.g., permissions, rate limits) are disclosed, and no annotations are provided to compensate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise, single sentence. Front-loaded with essential information. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters and no output schema, the description is minimal but sufficient for a simple config view. Could mention return format or authentication.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has zero parameters, so baseline score is 4. Description does not add parameter info as none exist. Schema coverage is 100%.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: to view LLM configuration information, with a specific note about not exposing keys. It distinguishes from sibling tools like knowledge_learn and knowledge_search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives like knowledge_status. The context implies it's for viewing config, but lacks direct comparison or exclusion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

knowledge_learnC

导入知识到知识库。LLM 会自动提取结构化信息(标题、摘要、标签、关系)。

ParametersJSON Schema
NameRequiredDescriptionDefault
contentYes知识内容(文本、代码、文档片段等)
typeNo知识类型(可选,LLM 自动判断)
titleNo标题(可选,LLM 自动生成)
projectNo关联项目名
tagsNo标签(可选,LLM 自动提取)
sourceNo来源描述

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must disclose behavior. It mentions LLM extraction but omits important traits like idempotency, sync/async nature, side effects, or auth requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with clear action and key feature (LLM extraction). No wasted words, though additional behavioral info could be added without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 6 parameters, no output schema, and moderate complexity (enum, nested, etc.), the description is too brief. Lacks return value info, error handling, or usage examples.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. Description adds context that LLM auto-extracts structure for optional fields, but this does not significantly enhance understanding beyond schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool imports knowledge into the knowledge base and that the LLM auto-extracts structured info. It distinguishes from siblings like knowledge_config (configuration) and knowledge_search, but lacks explicit differentiation from knowledge_learn_staged.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., knowledge_learn_staged). No when-not-to-use or prerequisites mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

knowledge_learn_stagedA

暂存待确认知识。存入 staging 区域,需要确认后才正式入库。

ParametersJSON Schema
NameRequiredDescriptionDefault
contentYes知识内容
sourceNo来源描述

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility. It discloses the staging nature and need for confirmation, but lacks details on side effects, reversibility, or behavior of multiple staging calls. For a write tool, this is insufficient beyond the basic staging concept.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description consists of two sentences: first states the purpose, second explains the process. No extraneous words; every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with 2 parameters and no output schema, the description covers the staging workflow and confirmation requirement. It does not mention how to confirm later or integration with sibling tools like knowledge_status, but remains fairly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with both parameters already described. The description adds context about staging overall but does not enhance parameter-specific meaning beyond the schema. Baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states '暂存待确认知识' (temporarily store knowledge to be confirmed) and '存入 staging 区域' (store in staging area), clearly indicating the tool's purpose of staging knowledge. It distinguishes from sibling tools like knowledge_learn (direct learning) and knowledge_config (configuration) by specifying the staging nature.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description says '需要确认后才正式入库' (requires confirmation before formal entry), hinting that this tool is for adding knowledge without immediate commitment. It provides clear context but does not explicitly mention when not to use or compare with alternatives like knowledge_learn for direct insertion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

knowledge_relevantC

获取与当前任务相关的知识。基于任务描述和关键词返回最匹配的条目。

ParametersJSON Schema
NameRequiredDescriptionDefault
taskYes当前任务描述
keywordsNo关键词列表
projectNo当前项目名
currentFileNo当前文件路径
maxResultsNo最大返回数

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It states the tool returns best matching entries but does not disclose read-only nature, behavior with no matches, or any side effects. A retrieval tool should clearly indicate it is a read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences front-loading the action and purpose. No redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 5-parameter retrieval tool with no output schema or annotations, the description lacks details on return format, error handling, or behavior when no results. Incomplete for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. Description adds that it uses task description and keywords, but does not clarify how project, currentFile, or maxResults affect results beyond schema descriptions. Marginal value added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool retrieves knowledge relevant to the current task, using task description and keywords. It distinguishes from siblings like knowledge_search by emphasizing contextual relevance, but does not explicitly contrast them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings like knowledge_search or knowledge_learn. The description implies usage for context-based retrieval but lacks explicit when-to-use or when-not-to-use instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

knowledge_statusA

知识库状态概览:条目数量、类型分布、LLM 连接状态。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description indicates that the tool returns status data, but with no annotations provided, it does not disclose behavioral traits such as whether it is read-only, what happens if the LLM connection is down, or if it requires authentication. It is minimally adequate but lacks depth.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that immediately conveys the tool's purpose and key details. It is front-loaded and contains no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no params, no output schema), the description covers the main purpose adequately. It could mention read-only behavior or caching, but the current level is sufficient for a status overview tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and 100% schema description coverage, so the description naturally adds no parameter meaning. Per the baseline rule for 0 parameters, a score of 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool provides an overview of knowledge base status, specifying three aspects: item count, type distribution, and LLM connection status. This verb+resource+details format makes the purpose unambiguous and distinguishes it from sibling tools like knowledge_search or knowledge_learn.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or when-not-to-use guidance is given. The description implies it's for checking status, but does not mention alternatives or scenarios where other tools might be preferred. Given the presence of five sibling tools, this is a notable gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 6 tool updatesv0.1.0
    • First observedknowledge_config
    • First observedknowledge_learn
    • First observedknowledge_learn_staged
    • First observedknowledge_relevant
    • First observedknowledge_search
    • First observedknowledge_status

TDQS

A3.5/5.0
Disambiguation4/5

Tools are mostly distinct, but knowledge_relevant and knowledge_search both serve retrieval purposes, which could cause confusion. Descriptions help differentiate them though.

Naming Consistency5/5

All tools follow a consistent knowledge_verb pattern in snake_case, making them predictable and easy to navigate.

Tool Count5/5

With 6 tools covering configuration, import, staging, retrieval, and status, the count is well-scoped for a knowledge base MCP server.

Completeness3/5

Missing update and delete operations, and the staged workflow lacks a confirm tool, leaving notable gaps in the lifecycle.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/guyeyouhun/auto-knowledge-base'

If you have feedback or need assistance with the MCP directory API, please join our Discord server