QuantumKuba/dsh-graphify-plugin1

dsh-graphify

适用于DeepSeek Harness的原生Graphify知识图谱插件

AI 分析

核心用途是为DSH集成Graphify知识图谱生成器与后台MCP服务器。适合需要利用知识图谱增强Agent信息检索、关联分析和复杂推理能力的用户。

套件
dsh-graphify
版本
0.1.0
授權
MIT
最近更新
2026年8月31日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:QuantumKuba/dsh-graphify-plugin

Step 4: Enable the Plugin in Configuration

Option A: Bundle Patch (cordis.patch.yml)

If you use DSH bundle layers, add the plugin patch:

- insert:
    - id: graphify
      name: dsh-graphify
      config:
        autoDetect: true
        enablePromptSection: true
        timeoutMs: 60000

Option B: Application Config (cordis.yml)

If you configure plugins in your profile cordis.yml:

plugins:
  dsh-graphify:
    autoDetect: true
    enablePromptSection: true
    timeoutMs: 60000

Option C: Programmatic Mounting

In a custom Cordis runtime application:

import { Context } from '@deepseek-ai/cordis'
import * as GraphifyPlugin from 'dsh-graphify'

const ctx = new Context()
await ctx.plugin(GraphifyPlugin, {
  autoDetect: true,
  enablePromptSection: true,
})

Configuration Reference

Options can be defined in cordis.yml, cordis.patch.yml, or passed to ctx.plugin():

OptionTypeDefaultDescription
commandstring'graphify'CLI executable command (auto-resolves uv or python3 -m graphify.serve).
argsstring[]['serve', '--transport', 'stdio']Subprocess arguments for the Graphify MCP server.
graphPathstringundefinedExplicit path to graph.json (bypasses auto-detection when set).
autoDetectbooleantrueProbes parent directories for graphify-out/graph.json.
enablePromptSectionbooleantrueInjects knowledge graph guidance into the agent system prompt.
timeoutMsnumber60000Cooperative timeout per tool execution in milliseconds.
serverNamestring'graphify'Stable identifier used for server registration and logs.
toolPrefixstring''Optional prefix for registered tools (e.g. 'kg_' -> 'kg_query_graph').
cwdstringundefinedWorking directory for the Graphify subprocess.

Programmatic Usage

You can also use the underlying GraphifyMcpClient or detectGraph utilities independently:

import { GraphifyMcpClient, detectGraph } from 'dsh-graphify'

// 1. Detect existing graph
const detected = detectGraph(process.cwd())
console.log('Detected graph:', detected?.graphJsonPath)

// 2. Initialize MCP client
const client = new GraphifyMcpClient({
  command: 'uv',
  args: ['run', '--with', 'graphifyy', '--with', 'mcp', '-m', 'graphify.serve', detected?.graphJsonPath || ''],
  cwd: process.cwd(),
})

// 3. Execute queries
const stats = await client.callTool('graph_stats', {})
console.log(stats)

// 4. Dispose client when done
await client.dispose()