Knowledge Graph Mcp
Manage, analyze, and visualize knowledge graphs with support for various graph types, including ontologies and timelines. Integrate effectively with MCP-compatible AI assistants to query and manipulate knowledge graph data while tracking resource management and version status.
Author

aiuluna
Quick Info
Actions
Tags
Knowledge Graph MCP Server
A Model Context Protocol (MCP) service for creating, managing, analyzing, and visualizing knowledge graphs. This service fully complies with the MCP standard and seamlessly integrates with MCP-compatible AI assistants (such as Claude).
Core Features
- Multiple Graph Types: Support for topology structures, timelines, changelogs, requirement documents, knowledge bases, ontologies, and more
- Complete Error Handling: Clear error messages and handling suggestions for common issues
- Resource Management: Support for SVG and Markdown resource association and management
- Version Status: Support for multiple status management including draft, published, and archived
Installation & Configuration
Installing via Smithery
To install knowledge-graph-mcp for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @aiuluna/knowledge-graph-mcp --client claude
Requirements
- Node.js >= 16.0.0
- pnpm >= 7.0.0
Configure Knowledge Graph Directory
Create a directory to store knowledge graph data, for example:
mkdir ~/knowledge_graph
Usage in Cursor
Add the following configuration to your Cursor config file:
{
"mcpServers": {
"knowledge-graph": {
"command": "npx",
"args": [
"-y",
"@aiuluna/knowledge-graph-mcp"
],
"env": {
"KNOWLEDGE_GRAPH_DIR": "/path/to/your/knowledge_graph/dir"
}
}
}
}
Note:
- Replace
KNOWLEDGE_GRAPH_DIR
with your actual knowledge graph storage directory path - You can specify a particular version number, such as
@0.0.1
Usage in Claude Desktop
Add the following configuration to claude_desktop_config.json
:
{
"mcpServers": {
"knowledge-graph": {
"command": "npx",
"args": [
"-y",
"@aiuluna/knowledge-graph-mcp"
],
"env": {
"KNOWLEDGE_GRAPH_DIR": "/path/to/your/knowledge_graph/dir"
}
}
}
}
Prompt Usage Guide
Project Structure
Prompt files are located in the /src/rules/prompts
directory. Please copy these files to your Cursor and add them as default rules for Agent mode (refer to Cursor Rules Configuration):
.cursor/
└── rules/
└── graph-query.mdc # Knowledge graph query prompt file
Using Agent Mode
When using Agent mode in Cursor, you can trigger knowledge graph queries by:
- Type
/ck
command in the editor - The Agent will automatically invoke the prompt defined in
@graph-query.mdc
- The prompt will:
- Analyze current context
- Query relevant knowledge graph nodes
- Generate summary content
- Integrate query results into the conversation
Other Rules
The project also includes prompts for generating hand-drawn style graphics and Markdown documents as knowledge graph resources. Since Cursor doesn't support the MCP standard for prompts, this project uses tools to obtain these rules. You can also integrate them into Cursor's rules like above and modify them to your desired style for use in Cursor Agent mode.
Tool List
Graph Management
create_graph
- Create a new knowledge graph
- Parameters:
name
(string): Graph namedescription
(string, optional): Graph descriptiontype
(string): Graph type (topology/timeline/changelog/requirement/kb/ontology)
list_graphs
- List all knowledge graphs
- Parameters:
status
(string, optional): Filter by status (draft/published/archived)type
(string, optional): Filter by type
publish_graph
- Publish a knowledge graph
- Parameters:
graphId
(string): Graph ID
Node Management
add_node
- Add a node to the graph
- Parameters:
graphId
(string): Graph IDtype
(string): Node typename
(string): Node namedescription
(string, optional): Node descriptionfilePath
(string, optional): Associated file pathmetadata
(object, optional): Node metadata
update_node
- Update node information
- Parameters:
graphId
(string): Graph IDnodeId
(string): Node IDname
(string, optional): New node namedescription
(string, optional): New node descriptionfilePath
(string, optional): New file pathmetadata
(object, optional): New metadata
delete_node
- Delete a node
- Parameters:
graphId
(string): Graph IDnodeId
(string): Node IDconfirmDelete
(boolean): Delete confirmation
get_node_details
- Get detailed node information
- Parameters:
graphId
(string): Graph IDnodeId
(string): Node ID
Edge Management
add_edge
- Add an edge
- Parameters:
graphId
(string): Graph IDtype
(string): Edge typesourceId
(string): Source node IDtargetId
(string): Target node IDlabel
(string, optional): Edge labelweight
(number, optional): Edge weightmetadata
(object, optional): Edge metadata
update_edge
- Update edge information
- Parameters:
graphId
(string): Graph IDedgeId
(string): Edge IDlabel
(string, optional): New edge labelweight
(number, optional): New edge weightmetadata
(object, optional): New metadata
delete_edge
- Delete an edge
- Parameters:
graphId
(string): Graph IDedgeId
(string): Edge IDconfirmDelete
(boolean): Delete confirmation
Resource Management
get_creation_guidelines
- Get resource creation guidelines
- Parameters:
type
(string): Guideline type (svg/markdown/all)
save_resource
- Save a resource
- Parameters:
graphId
(string): Graph IDnodeId
(string, optional): Associated node IDresourceType
(string): Resource type (svg/markdown)title
(string): Resource titledescription
(string, optional): Resource descriptioncontent
(string): Resource content
update_resource
- Update resource information
- Parameters:
graphId
(string): Graph IDresourceId
(string): Resource IDname
(string, optional): New resource nametitle
(string, optional): New resource titledescription
(string, optional): New resource description
delete_resource
- Delete a resource
- Parameters:
graphId
(string): Graph IDresourceId
(string): Resource IDconfirmDelete
(boolean): Delete confirmation
unlink_resource
- Unlink a resource from a node
- Parameters:
graphId
(string): Graph IDnodeId
(string): Node IDresourceId
(string): Resource ID
Development
# Install dependencies
pnpm install
# Development mode
pnpm dev
# Build project
pnpm build
# Run tests
pnpm test
# Code check
pnpm lint
Error Handling
The service uses a standard error handling mechanism. All errors are logged to the md/error_log.txt
file, including timestamps, error messages, and stack traces.
License
This project is licensed under the MIT License - see the LICENSE file for details.