Knowledge Graph CLI and MCP server - interact with knowledge graph systems
npm install @aaronsb/kg-cliCLI and MCP server for interacting with Knowledge Graph System deployments.
Global install (requires sudo or npm configured for user-local):
``bash`
npm install -g @aaronsb/kg-cli
User-local install (no sudo required):
`bash`
npm install -g @aaronsb/kg-cli --prefix ~/.local~/.local/bin
Then ensure is in your PATH.
Run without installing:
`bash`
npx @aaronsb/kg-cli health
npx @aaronsb/kg-cli search "query"
This installs two commands:
- kg - Command-line interface for the knowledge graphkg-mcp-server
- - MCP server for AI assistant integration
`bashConfigure your knowledge graph endpoint
kg config set api.url https://kg.example.com/api
CLI Commands
| Command | Description |
|---------|-------------|
|
kg health | Check API connection |
| kg login | Authenticate with the API |
| kg logout | Clear saved credentials |
| kg config | View/edit configuration |
| kg ingest | Submit document for extraction |
| kg search | Search concepts |
| kg jobs | List extraction jobs |
| kg artifact | Manage artifacts |
| kg document | Manage documents |Run
kg --help or kg for detailed usage.MCP Server
The MCP server allows AI assistants (like Claude) to interact with your knowledge graph.
$3
Add to
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or ~/.config/Claude/claude_desktop_config.json (Linux):`json
{
"mcpServers": {
"knowledge-graph": {
"command": "npx",
"args": ["-p", "@aaronsb/kg-cli", "kg-mcp-server"],
"env": {
"KG_API_URL": "https://kg.example.com/api",
"KG_API_TOKEN": "your-token-here"
}
}
}
}
`Or if installed globally/user-local (simpler):
`json
{
"mcpServers": {
"knowledge-graph": {
"command": "kg-mcp-server",
"env": {
"KG_API_URL": "https://kg.example.com/api",
"KG_API_TOKEN": "your-token-here"
}
}
}
}
`$3
-
search_concepts - Semantic search across the knowledge graph
- get_concept - Get details about a specific concept
- list_sources - List ingested documents
- get_relationships - Find connections between concepts
- ingest_document - Submit new documents (with approval)Configuration
Configuration is stored in
~/.config/kg/config.json:`json
{
"api": {
"url": "https://kg.example.com/api"
},
"auth": {
"token": "..."
}
}
`Or use environment variables:
-
KG_API_URL - API endpoint
- KG_API_TOKEN - Authentication tokenRequirements
- Node.js 18+
- A running Knowledge Graph System instance
Shell Alias (optional)
If using npx, add an alias to your shell profile:
`bash
alias kg='npx @aaronsb/kg-cli'
``- Knowledge Graph System
- Documentation
- Issues
MIT