Skip to main content
Glama
Knowledge MCP
by jihoho12

Knowledge MCP

Air 프레임워크(https://docs.airmcp.dev/) 로 만든 배운 CS 지식을 그래프 구조로 자동 정리·병합하는 MCP 서버입니다.

Claude Desktop에서 자연어로 지식을 말하면, 핵심 개념(Entity)과 관계(Relation)를 추출해서 SQLite 기반 지식 그래프에 저장합니다. 같은 개념이 다시 나오면 기존 노드에 병합합니다.

해결하는 문제

  • 지식 파편화: 같은 개념에 대해 시차를 두고 배운 정보가 하나의 노드에 누적

  • 컨텍스트 비대화: 전체 대화를 넘기지 않고, 관련 노드만 꺼내서 토큰 절약

  • 할루시네이션 방지: 정제된 지식 베이스를 기반으로 LLM 답변 품질 향상

Related MCP server: Knowledge Graph Memory Server

아키텍처

사용자 → Claude(Entity/Relation 추출) → MCP(저장) → SQLite(WAL 모드)

MCP 내부에 별도 LLM이 없습니다. Claude가 추출과 판단을, MCP가 저장과 조회를 담당합니다.

도구

도구

설명

ingest_knowledge

Entity/Relation JSON을 받아 그래프에 upsert

list_nodes

키워드 검색, 카테고리 필터, 페이지네이션

merge_nodes

중복 노드 병합 (alias 이전, edge 중복 처리)

update_node

노드 속성 직접 수정

delete_node

노드 soft delete (cascade 옵션)

delete_edge

관계 soft delete (ID 또는 조건)

설치

git clone https://github.com/jihoho12/MyKnowledgeMCP.git
cd MyKnowledgeMCP
uv sync

Claude Desktop 연동

claude_desktop_config.json에 추가:

{
  "mcpServers": {
    "knowledge": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/MyKnowledgeMCP", "python", "-m", "knowledge_mcp.server"]
    }
  }
}

사용 예시

Claude Desktop에서 자연어로:

"HTTP는 TCP 위에서 동작하는 애플리케이션 계층 프로토콜이야. 정리해줘."
→ Claude가 Entity/Relation 추출 → ingest_knowledge 호출

"네트워크 관련 지식 보여줘"
→ list_nodes(category="network")

"'서버'랑 'Server' 같은 개념이니까 합쳐줘"
→ merge_nodes(node_a="서버", node_b="Server")

기술 스택

구성 요소

선택

MCP 서버

Python + FastMCP

저장소

SQLite (WAL 모드)

패키지 관리

uv

Entity 추출

Claude (대화 중인 LLM)

설정

config.toml에서 카테고리 목록, DB 경로, summary 통합 임계값을 변경할 수 있습니다.

[knowledge]
categories = ["general", "network", "os", "database", "web", "security", "language", "algorithm", "architecture", "devops"]
summary_consolidation_threshold = 500

테스트

48개 테스트 전체 통과 (기능 28 + 고급 20)

  • 도구별 정상/에러 경로

  • 동시성 (WAL 멀티스레드)

  • 대량 데이터 성능 (500 노드)

  • 데이터 무결성 (SQL injection, 특수문자, 외래키)

  • 복구 (DB 손상, 백업/복원)

라이선스

MIT

Available Tools

6 tools
delete_edgeA

edge를 삭제(soft delete)합니다. edge_id로 직접 삭제하거나, source/target/relation 조건으로 삭제합니다.

Args: edge_id: 삭제할 edge ID (이 값이 있으면 다른 조건 무시) source: source 노드 이름 (조건 삭제용) target: target 노드 이름 (조건 삭제용) relation: 관계 타입 (조건 삭제용)

Inputs: edge_id, source, target, relation. Returns: result

delete_nodeA

노드를 삭제(soft delete)합니다.

Args: name: 삭제할 노드 이름 cascade: True면 연결된 edge도 함께 삭제. False면 edge가 있을 경우 거부.

Inputs: name (required), cascade. Returns: result

ingest_knowledgeA

지식을 그래프에 저장합니다. Claude가 추출한 Entity/Relation JSON을 받습니다.

Args: raw_text: 사용자가 입력한 원본 텍스트 (로그용) entities: JSON 배열. 예: [{"name": "서버", "category": "network", "description": "클라이언트에게 서비스를 제공하는 컴퓨터", "aliases": ["Server"], "properties": {}}] relations: JSON 배열. 예: [{"source": "서버", "target": "클라이언트", "relation": "serves", "description": "서비스 제공 관계"}]

Inputs: raw_text (required), entities (required), relations (required). Returns: result

list_nodesA

지식 그래프의 노드 목록을 조회합니다.

Args: keyword: 검색어 (name, summary에서 부분 매칭). 빈 문자열이면 전체 조회. category: 카테고리 필터. 빈 문자열이면 전체. include_edges: 각 노드의 연결된 edge 포함 여부 limit: 최대 반환 수 (기본 20, 최대 100) offset: 페이지네이션 오프셋 sort_by: 정렬 기준 (updated_at, created_at, name) sort_order: 정렬 방향 (asc, desc)

Inputs: keyword, category, include_edges, limit, +3 more. Returns: result

merge_nodesA

두 노드를 하나로 병합합니다. node_a를 유지하고 node_b를 흡수합니다.

Args: node_a: 유지할 노드 이름 node_b: 흡수될 노드 이름 (병합 후 soft delete) merged_summary: Claude가 합쳐서 작성한 통합 요약 (선택. 비어있으면 단순 append)

Inputs: node_a (required), node_b (required), merged_summary. Returns: result

update_nodeA

특정 노드의 속성을 수정합니다.

Args: name: 수정할 노드 이름 summary: 새 요약 (전체 교체). 빈 문자열이면 변경 안 함. category: 새 카테고리. 빈 문자열이면 변경 안 함. add_aliases: 추가할 별칭 JSON 배열. 예: ["웹서버", "web server"]. 빈 문자열이면 변경 안 함. properties: 추가할 속성 JSON 객체. 기존 속성에 merge. 빈 문자열이면 변경 안 함.

Inputs: name (required), summary, category, add_aliases, +1 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct operation (delete node, delete edge, ingest, list, merge, update) with clear boundaries. No two tools overlap in purpose.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (e.g., delete_edge, list_nodes). No mixing of conventions.

    Tool Count5/5

    6 tools is well-scoped for a knowledge graph server, covering creation, deletion, update, list, and merge without being too sparse or too heavy.

    Completeness3/5

    Basic CRUD for nodes is covered, but edges lack update and list operations. There is no dedicated get tool for individual nodes or edges, which may hinder agents.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to automatically extract entities and relationships from URLs, PDFs, and YouTube videos to build structured knowledge graphs in Neo4j. It supports custom schemas, academic citation extraction, and community detection for advanced research and content analysis.
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides persistent memory for Claude by implementing a local knowledge graph to store and retrieve entities, relations, and observations. This enables long-term information retention and personalization across different chat sessions.
      374,489 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Self-hosted personal knowledge graph for Claude that persists across sessions, devices, and tools. Built on Neo4j with local semantic embeddings; OAuth 2.1 lets Claude Code, Claude Desktop, and claude.ai web all hit the same graph.
      24
      132 npm
      2
      MIT