Skip to main content
Glama
liuqihonggit

@jingjingbox/mcp-cli-bridge

by liuqihonggit

@jingjingbox/mcp-cli-bridge

MCP-CLI Bridge Server - Invokes CLI tools via the MCP protocol, providing AI assistants with powerful knowledge graph and file reading capabilities.

Introduction

@jingjingbox/mcp-cli-bridge is a bridge server based on the Model Context Protocol (MCP), which exposes CLI tool capabilities to AI assistants (such as TraeCN) via the MCP protocol.

Core Features

  • Knowledge Graph Management: Create entities, establish relationships, and search nodes to build a complete knowledge network.

  • File Reading: Efficiently read the beginning or end of files, with support for large file processing.

  • Process Isolation: CLI plugins run in independent processes, ensuring crashes do not affect the main service.

  • NativeAOT Compilation: Ultimate performance, ultra-small footprint, and fast startup.

  • Progressive Loading: Tools are loaded on demand, saving context space.

Related MCP server: mcp_server_for_claudes_toolbox

System Requirements

  • OS: Windows x64

  • Node.js: >= 14.0.0

  • Runtime: .NET 10.0 Runtime (included in the package)

Installation

Global Installation

npm install -g @jingjingbox/mcp-cli-bridge

No installation required, run directly:

npx @jingjingbox/mcp-cli-bridge

Configuration

Environment Variables

Variable

Description

Required

MCP_MEMORY_PATH

MemoryCli knowledge graph data storage directory

Yes

Data files will be created automatically:

  • memory.jsonl - Entity data

  • memory_relations.jsonl - Relationship data

TraeCN Configuration Example

Add to the MCP configuration in TraeCN:

{
  "mcpServers": {
    "cli-bridge": {
      "type": "stdio",
      "command": "npx",
      "args": ["@jingjingbox/mcp-cli-bridge"],
      "enabled": true,
      "env": {
        "MCP_MEMORY_PATH": "D:\\MCP\\Memory"
      }
    }
  }
}

Global Installation Configuration

{
  "mcpServers": {
    "cli-bridge": {
      "type": "stdio",
      "command": "mcp-cli-bridge",
      "enabled": true,
      "env": {
        "MCP_MEMORY_PATH": "D:\\MCP\\Memory"
      }
    }
  }
}

Tool List

Host Layer Tools (Directly Exposed)

Tool Name

Description

tool_search

Search for available CLI tools

tool_execute

Execute a specified CLI tool command

tool_describe

Get tool description information

tool_list

List all available tools

package_status

Check package installation status

package_install

Install a specified package

MemoryCli Tools (Knowledge Graph)

Invoked via tool_execute, command prefix is memory_:

Tool Name

Description

memory_create_entities

Create multiple entities in the knowledge graph

memory_create_relations

Create relationships between entities

memory_read_graph

Read the entire knowledge graph

memory_search_nodes

Search for nodes in the knowledge graph

memory_add_observations

Add observation records to entities

memory_delete_entities

Delete entities and their relationships

memory_open_nodes

Get specific nodes by name

FileReaderCli Tools (File Reading)

Invoked via tool_execute, command prefix is file_reader_:

Tool Name

Description

file_reader_read_head

Read the first N lines of a file

file_reader_read_tail

Read the last N lines of a file

Usage Examples

Create Knowledge Entities

{
  "command": "memory_create_entities",
  "entities": [
    {
      "name": "React",
      "entityType": "Framework",
      "observations": ["用于构建用户界面的 JavaScript 库", "由 Meta 维护"]
    },
    {
      "name": "TypeScript",
      "entityType": "Language",
      "observations": ["JavaScript 的超集", "添加了静态类型检查"]
    }
  ]
}

Establish Entity Relationships

{
  "command": "memory_create_relations",
  "relations": [
    {
      "from": "React",
      "to": "TypeScript",
      "relationType": "supports"
    }
  ]
}

Search Knowledge Nodes

{
  "command": "memory_search_nodes",
  "query": "React"
}

Read File Head

{
  "command": "file_reader_read_head",
  "filePath": "C:\\project\\logs\\app.log",
  "lineCount": 20
}

Read File Tail

{
  "command": "file_reader_read_tail",
  "filePath": "C:\\project\\logs\\error.log",
  "lineCount": 50
}

Architecture Design

McpHost/
├── McpHost.exe          # MCP 主机服务
├── MemoryCli.exe        # 知识图谱 CLI 插件
├── FileReaderCli.exe    # 文件读取 CLI 插件
└── index.js             # npm 入口文件
  • McpHost: MCP protocol server, responsible for tool exposure and CLI process management.

  • MemoryCli: Knowledge graph management, supporting CRUD for entities, relationships, and observation records.

  • FileReaderCli: Efficient file reading, supporting head/tail reading for large files.

Tech Stack

  • .NET 10.0 - Runtime platform

  • NativeAOT - Native compilation, ultimate performance

  • C# 13 - Programming language

  • JSON-RPC 2.0 - CLI communication protocol

  • MCP Protocol - AI assistant communication protocol

Development

Source Repository

git clone https://gitee.com/JJbox/memory.git

Build

# 使用 PowerShell
.\build.ps1

Testing

# 单元测试
dotnet test McpHost.slnx

# E2E 测试
dotnet run --project tests\E2E\MyMemoryServer.E2E.csproj -c Release

Detailed Documentation

License

MIT

Author

JJbox

Related MCP Connectors

Related MCP Servers