@aaronsb/kg-cli
v0.8.0
Published
Knowledge Graph CLI and MCP server - interact with knowledge graph systems
Maintainers
Readme
@aaronsb/kg-cli
CLI and MCP server for interacting with Knowledge Graph System deployments.
Installation
Global install (requires sudo or npm configured for user-local):
npm install -g @aaronsb/kg-cliUser-local install (no sudo required):
npm install -g @aaronsb/kg-cli --prefix ~/.localThen ensure ~/.local/bin is in your PATH.
Run without installing:
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
Quick Start
# Configure your knowledge graph endpoint
kg config set api.url https://kg.example.com/api
# Login
kg login
# Check health
kg health
# Ingest a document
kg ingest document.pdf
# Search concepts
kg search "machine learning"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 <file> | Submit document for extraction |
| kg search <query> | Search concepts |
| kg jobs | List extraction jobs |
| kg artifact | Manage artifacts |
| kg document | Manage documents |
Run kg --help or kg <command> --help for detailed usage.
MCP Server
The MCP server allows AI assistants (like Claude) to interact with your knowledge graph.
Claude Desktop Configuration
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or ~/.config/Claude/claude_desktop_config.json (Linux):
{
"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):
{
"mcpServers": {
"knowledge-graph": {
"command": "kg-mcp-server",
"env": {
"KG_API_URL": "https://kg.example.com/api",
"KG_API_TOKEN": "your-token-here"
}
}
}
}Available MCP Tools
search_concepts- Semantic search across the knowledge graphget_concept- Get details about a specific conceptlist_sources- List ingested documentsget_relationships- Find connections between conceptsingest_document- Submit new documents (with approval)
Configuration
Configuration is stored in ~/.config/kg/config.json:
{
"api": {
"url": "https://kg.example.com/api"
},
"auth": {
"token": "..."
}
}Or use environment variables:
KG_API_URL- API endpointKG_API_TOKEN- Authentication token
Requirements
- Node.js 18+
- A running Knowledge Graph System instance
Shell Alias (optional)
If using npx, add an alias to your shell profile:
alias kg='npx @aaronsb/kg-cli'Links
License
MIT
