Token导航 LogoToken导航

MCP Server · 数据服务

Knowledgegraphmcp

一个基于模型上下文协议(MCP)的系统,允许LLM动态构建、查询和更新知识图谱,支持Neo4j和Memgraph作为后端数据库。

stdio官方级别未说明来源级核验工具 8
知识图谱TypeScriptClaudeClaude DesktopCline

快速开始

作者 / 组织
gyash1512
提供方
gyash1512
运行时
Docker

工具数量

8

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

0

仓库热度

收录来源

1 个

MCP World

选型结论

Knowledgegraphmcp 属于数据服务类 MCP Server,公开资料标注 8 个工具,通过stdio 本地进程接入,适配 Claude Desktop、Claude、Cline,有可以直接复制的安装命令;接入前先确认权限范围。

分类

数据服务

传输方式

stdio

认证方式

无需认证

部署方式

公开资料未说明

安装与配置

安装命令

docker run -d \

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 Docker,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 8 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

🌐 KnowledgeGraphMCP - Model Context Protocol Knowledge Graph System

A complete Model Context Protocol (MCP)-based system that enables LLMs to dynamically construct, query, and update knowledge graphs using Neo4j or Memgraph as the backend. Build complex knowledge graphs through natural language without hardcoding entities or relationships.

🔍 Overview

KnowledgeGraphMCP allows AI assistants to interact with graph databases in real-time, enabling:

  • Dynamic Entity Management: Add entities (nodes) on-the-fly with custom types and metadata
  • Relationship Creation: Connect entities with typed relationships
  • Natural Language Querying: Convert natural language to Cypher queries automatically
  • Graph Analytics: Get insights, statistics, and find patterns in your knowledge graph
  • External Data Integration: Fetch and integrate data from external APIs
  • Real-time Updates: Modify graph structure based on LLM interactions

✨ Features

  • 🔄 Dynamic Graph Construction - No hardcoded schemas, create entities and relationships on demand
  • 🧠 Natural Language Interface - Query graphs using plain English
  • 📊 Built-in Analytics - Graph statistics, top connections, distribution analysis
  • 🔗 External Data Integration - Pull data from APIs and automatically create graph structures
  • 🔒 Security First - Input sanitization and safe query validation
  • 🚀 Production Ready - Connection pooling, error handling, and graceful shutdowns
  • 📚 Multiple Graph DBs - Supports both Neo4j and Memgraph
  • 🎯 Domain Agnostic - Works for legal aid, startups, research, and any domain

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                      LLM Client                             │
│  (Issues natural language commands)                         │
└────────────────┬────────────────────────────────────────────┘
                 │
                 │ MCP Protocol (JSON-RPC over stdio)
                 │
┌────────────────┴────────────────────────────────────────────┐
│              Knowledge Graph MCP Server                     │
│  ┌──────────────────────────────────────────────────────┐   │
│  │   Tools: addEntity, addRelationship, queryGraph,     │   │
│  │          searchEntities, graphAnalytics, etc.        │   │
│  └────────────────────┬─────────────────────────────────┘   │
│                       │                                     │
│  ┌────────────────────▼─────────────────────────────────┐   │
│  │         Database Connection Manager                  │   │
│  │           (Neo4j Driver / Memgraph)                  │   │
│  └──────────────────────────────────────────────────────┘   │
└────────────────┬────────────────────────────────────────────┘
                 │
                 │ Bolt Protocol
                 │
┌────────────────▼────────────────────────────────────────────┐
│              Neo4j / Memgraph Database                      │
│  (Graph storage with Cypher query language)                 │
└─────────────────────────────────────────────────────────────┘

📋 Prerequisites

  • Node.js 18+
  • Neo4j or Memgraph database (local or cloud)
  • An MCP-compatible client (Claude Desktop, Cline, etc.)

🚀 Installation

Quick Start with npx (Recommended)

Configure your MCP client:

{
  "mcpServers": {
    "knowledge-graph": {
      "command": "npx",
      "args": ["-y", "kgraph-mcp"],
      "env": {
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USERNAME": "neo4j",
        "NEO4J_PASSWORD": "your_password"
      }
    }
  }
}

That's it! The server will auto-connect to your graph database.


Local Development

For contributing or modifying the code:

git clone https://github.com/gyash1512/KnowledgeGraphMCP.git
cd KnowledgeGraphMCP
npm install
npm run build

Database Setup

Using Neo4j Desktop (Easiest)
  1. Download Neo4j Desktop
  2. Create a new project and database
  3. Start the database (default: bolt://localhost:7687)
  4. Note your username and password
Using Docker
# Neo4j
docker run -d \
  --name neo4j \
  -p 7474:7474 -p 7687:7687 \
  -e NEO4J_AUTH=neo4j/your_password \
  neo4j:latest

# Or Memgraph
docker run -d \
  --name memgraph \
  -p 7687:7687 \
  memgraph/memgraph:latest

🎮 Usage

MCP Configuration

For Claude Desktop:

Edit your Claude Desktop config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "knowledge-graph": {
      "command": "npx",
      "args": ["-y", "kgraph-mcp"],
      "env": {
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USERNAME": "neo4j",
        "NEO4J_PASSWORD": "your_password"
      }
    }
  }
}

For local development:

{
  "mcpServers": {
    "knowledge-graph": {
      "command": "node",
      "args": ["./dist/server.js"],
      "cwd": "/absolute/path/to/KnowledgeGraphMCP",
      "env": {
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USERNAME": "neo4j",
        "NEO4J_PASSWORD": "your_password"
      }
    }
  }
}

📚 Available Tools

1. addEntity

Add a new entity (node) to the knowledge graph.

Parameters:

  • name (string, required): Unique entity name
  • type (string, required): Entity type/category
  • metadata (object, optional): Additional properties

Example:

{
  "name": "NutriGuide AI",
  "type": "Startup",
  "metadata": {
    "founded": "2024",
    "founder": "Yash Gupta",
    "location": "Delhi",
    "industry": "HealthTech"
  }
}

2. addRelationship

Create a relationship between two existing entities.

Parameters:

  • source (string, required): Source entity name
  • target (string, required): Target entity name
  • type (string, required): Relationship type
  • metadata (object, optional): Relationship properties

Example:

{
  "source": "NutriGuide AI",
  "target": "Yash Gupta",
  "type": "FOUNDED_BY",
  "metadata": {
    "date": "2024-01-15",
    "role": "CEO"
  }
}

3. queryGraph

Query the graph using natural language or Cypher.

Parameters:

  • query (string, required): Natural language or Cypher query
  • useNaturalLanguage (boolean, optional): Auto-convert to Cypher (default: true)

Examples:

// Natural language
{
  "query": "Show all startups founded by Yash Gupta"
}

// Cypher query
{
  "query": "MATCH (s:Startup)-[:FOUNDED_BY]->(p:Person {name: 'Yash Gupta'}) RETURN s",
  "useNaturalLanguage": false
}

4. searchEntities

Search for entities by name or type.

Parameters:

  • searchTerm (string, required): Search term
  • entityType (string, optional): Filter by type

5. graphAnalytics

Get comprehensive graph statistics.

Parameters:

  • nodeType (string, optional): Filter by node type
  • relationshipType (string, optional): Filter by relationship type

Returns:

  • Node and relationship counts
  • Type distributions
  • Top connected entities
  • Graph density and average degree

6. externalData

Fetch data from external APIs and integrate into graph.

Parameters:

  • source (string, required): API source name
  • query (string, required): Query parameters
  • endpoint (string, optional): Custom API endpoint
  • apiKey (string, optional): API authentication

7. deleteEntity

Remove an entity and its relationships.

Parameters:

  • name (string, required): Entity name to delete

8. getSubgraph

Get a subgraph starting from a specific entity.

Parameters:

  • entityName (string, required): Starting entity
  • maxDepth (number, optional): Max traversal depth (default: 2)
  • relationshipTypes (array, optional): Filter relationship types

💡 Example Queries

Example 1: Building a Startup Ecosystem

Natural language commands:

1. "Add entity: Startup 'NutriGuide AI' with founder 'Yash Gupta'"
2. "Add entity: Investor 'Sequoia Capital' with metadata type 'VC Firm'"
3. "Add relationship: 'Sequoia Capital' invested in 'NutriGuide AI' with amount '1M USD'"
4. "Show all startups and their investors"

Expected workflow:

  1. Creates Startup node
  2. Creates Investor node
  3. Creates INVESTED_IN relationship
  4. Returns graph showing connections

Example 2: Legal Aid System

Natural language commands:

1. "Add entity: Prisoner 'John Doe' in 'Tihar Jail'"
2. "Add entity: Volunteer 'Jane Smith' specializing in 'criminal law'"
3. "Add relationship: 'Jane Smith' assigned to 'John Doe'"
4. "Show all prisoners connected to volunteers in Delhi"

Example 3: Knowledge Graph Analytics

Query:

"Get analytics for all Person entities"

Returns:

{
  "nodeCount": 150,
  "relationshipCount": 320,
  "nodeTypeDistribution": {
    "Person": 150
  },
  "topConnectedNodes": [
    {
      "name": "Yash Gupta",
      "type": "Person",
      "connectionCount": 25
    }
  ],
  "averageDegree": 4.27,
  "graphDensity": 0.0143
}

🔧 API Response Schemas

Entity Object

{
  id: string;              // Database-generated ID
  name: string;            // Entity name
  type: string;            // Entity type
  metadata: object;        // Custom properties
  createdAt: string;       // ISO timestamp
  updatedAt: string;       // ISO timestamp
}

Relationship Object

{
  id: string;              // Database-generated ID
  source: string;          // Source entity name
  target: string;          // Target entity name
  type: string;            // Relationship type
  metadata: object;        // Custom properties
  createdAt: string;       // ISO timestamp
}

Query Result

{
  nodes: Entity[];         // Matching nodes
  relationships: Relationship[];  // Matching relationships
  metadata: {
    executionTime: number; // Query time in ms
    query: string;         // Executed query
    resultCount: number;   // Number of results
  }
}

🎯 Use Cases

Startup/Investment Tracking

  • Map startup founders, investors, and funding rounds
  • Track connections between companies
  • Analyze investment patterns

Legal Aid Management

  • Connect prisoners with legal volunteers
  • Track case assignments and progress
  • Map legal case relationships

Research Networks

  • Build academic collaboration graphs
  • Track paper citations and co-authorships
  • Find research communities

Social Networks

  • Map person-to-person relationships
  • Analyze influence and connections
  • Build organizational hierarchies

Knowledge Management

  • Create interconnected knowledge bases
  • Map concepts and relationships
  • Build decision trees

🛠️ Development

Project Structure

KnowledgeGraphMCP/
├── src/
│   ├── server.ts        # Main MCP server
│   ├── database.ts      # Graph DB connection
│   ├── types.ts         # TypeScript types
│   ├── utils.ts         # Utility functions
│   └── cli.ts           # CLI entry point
├── dist/                # Compiled output
├── package.json
├── tsconfig.json
└── README.md

Building

npm run build        # Compile TypeScript
npm run watch        # Watch mode for development
npm run clean        # Clean dist folder

Testing

# Start the server locally
npm run start

# Or with development build
npm run dev

🔒 Security

  • Input Sanitization: All user inputs are sanitized
  • Query Validation: Dangerous Cypher operations are blocked
  • Connection Security: Supports encrypted connections
  • Environment Variables: Credentials stored securely in .env

🐛 Troubleshooting

Database Connection Failed

  • Verify Neo4j/Memgraph is running: http://localhost:7474
  • Check credentials in config
  • Ensure bolt port (7687) is accessible

Entity Already Exists

  • Entity names must be unique
  • Search for existing entity first
  • Update metadata instead of recreating

Query Returns Empty

  • Verify entities exist: use searchEntities
  • Check relationship types match
  • Try simpler query first

📞 Support

For issues, questions, or contributions:

🤝 Contributing

Contributions welcome! Please read CONTRIBUTING.md for guidelines.

📄 License

MIT License - see LICENSE for details.

🙏 Acknowledgments


Built with ❤️ using TypeScript, MCP, and Graph Databases

工具与能力

工具数量

8

资源数量

0

提示词数量

0

能力标签

知识图谱TypeScript本地部署图数据库自然语言处理动态实体管理图分析

支持客户端

Claude DesktopClaudeCline

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

用自然语言查库

不用手写 SQL,直接问数据,让模型组织查询语句。

数据巡检

定期拉指标、做对比,把异常项整理成一段说明。

打通业务数据

把数据库、数仓和接口接进同一个上下文,减少导出再上传。

选择建议

值得选的地方

  • 只提供 8 个工具,职责集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已经适配 Claude Desktop、Claude、Cline,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好 Docker,换机器要重新装一遍。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在数据服务场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Knowledgegraphmcp

MCP World · 本页

8stdio有1 个2026-05-17
Memory 9d25f64e

MCP World

9未说明未标注1 个2026-05-17
Prisma MCP Server

MCP World

0stdio有3 个2026-05-17
Astr Bot

MCP World

0stdio有1 个2026-05-17
Getzep MCP

MCP World

9stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Knowledgegraphmcp 怎么安装?

公开资料给出的安装命令是 docker run -d \,运行环境为 Docker。装完后按客户端要求写进 MCP 配置,重启客户端生效。

Knowledgegraphmcp 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 Docker;保存后完全退出客户端再打开,配置才会生效。

Knowledgegraphmcp 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Knowledgegraphmcp 需要 API Key 吗?

公开资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Knowledgegraphmcp 支持哪些客户端?

公开资料标注支持 Claude Desktop、Claude、Cline;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP