知识图谱AI连接服务

Moonshine MCP Server是一个连接AI助手(如Claude、ChatGPT、Gemini等)与Moonshine知识图谱的协议服务器,支持直接读取SQLite数据库文件,无需运行Moonshine主程序。

  • by JangVincent
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 Cognito-Distillery/Moonshine-MCP

使用说明

Moonshine MCP Server

Let AI assistants tap into your knowledge graph.

한국어


一 MCP(模型上下文协议) 将人工智能助手(Claude、ChatGPT、Gemini等)直接连接到您的服务器 月光酒 知识图谱。

它直接读取SQLite数据库文件,因此 Moonshine不需要运行.


先决条件

  • Node.js v20+
  • 月光酒 安装时至少创建了一个mash
  • (可选) 来自的API密钥 开放人工智能 或 谷歌双子座 --只需要 search_semantic

设置

克劳德桌面

添加到您的Claude Desktop配置中:

平台 配置路径
Linux ~/.config/Claude/claude_desktop_config.json
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
视窗 %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "moonshine": {
      "command": "npx",
      "args": ["@cognito-distillery/moonshine-mcp"]
    }
  }
}

克劳德代码

claude mcp add moonshine -- npx @cognito-distillery/moonshine-mcp

其他MCP客户端

任何兼容MCP的客户端都可以通过以下方式连接 stdio传输:

npx @cognito-distillery/moonshine-mcp

数据库路径

服务器会自动找到您的Moonshine数据库:

平台 默认路径
Linux ~/.local/share/com.moonshine.app/moonshine.db
macOS ~/Library/Application Support/com.moonshine.app/moonshine.db
视窗 C:\Users\{user}\AppData\Roaming\com.moonshine.app\moonshine.db

用覆盖 MOONSHINE_DB_PATH 环境变量(如果需要):

{
  "mcpServers": {
    "moonshine": {
      "command": "npx",
      "args": ["@cognito-distillery/moonshine-mcp"],
      "env": {
        "MOONSHINE_DB_PATH": "/custom/path/to/moonshine.db"
      }
    }
  }
}

工具

捣碎CRUD

工具 说明
list_mashes 列出掩码,可选择按状态和类型进行筛选
get_mash 按ID获取单个mash
create_mash 创建一个新的mash(以mash_TUN开头)
update_mash 部分更新mash的类型、摘要、上下文或备忘录
delete_mash 删除mash及其关联边

搜索

工具 说明
search_keyword 使用FTS5三元组标记器进行全文关键字搜索(韩语友好)
search_semantic 使用嵌入的语义相似性搜索(需要Moonshine设置中的API密钥)

知识图谱

工具 说明
get_graph 通过按类型、关系或源进行可选过滤,获取JARRED mashes的完整图
get_node_detail 获取一个节点及其邻居和连接边
add_edge 添加或打乱两个面具之间的关系
update_edge 更新边的关系类型或置信度
delete_edge 删除边

统计

工具 说明
get_stats 按状态/类型和总边缘计数获取mash计数

环境变量

变量 描述 默认值
MOONSHINE_DB_PATH 覆盖数据库文件路径 按平台自动检测
MOONSHINE_READ_ONLY 设置为 true 阻止所有写入操作 false
MOONSHINE_DEBUG 设置为 true 用于详细的stderr日志记录 false

验证

跑吧 MCP检查员 交互式测试工具:

npx @modelcontextprotocol/inspector node dist/index.js

安全

  • password_hash 和 session_token 是 从不暴露 通过任何工具
  • API键在内部从设置表中读取,但是 再也没有回来 在工具响应中
  • 使用 MOONSHINE_READ_ONLY=true 防止任何数据库写入
  • WAL模式允许在运行Moonshine应用程序的同时进行安全的并发读取

许可证

麻省理工学院


under the moonlight, in silence.