zhin-mcp-server

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Zhin MCP Server Guide

Zhin MCP 服务器指南

Use this skill to set up the
@zhin.js/mcp
plugin, enabling AI assistants (Claude, Cursor, etc.) to understand and generate Zhin plugins via the Model Context Protocol.
使用本技能来设置
@zhin.js/mcp
插件,让Claude、Cursor等AI助手能够通过Model Context Protocol理解并生成Zhin插件。

Installation

安装

bash
pnpm add @zhin.js/mcp
bash
pnpm add @zhin.js/mcp

Configuration

配置

MCP requires the HTTP plugin. Enable both in
zhin.config.yml
:
yaml
plugins:
  - http
  - mcp

http:
  port: 8086

mcp:
  enabled: true
  path: /mcp
The MCP endpoint is available at
http://localhost:8086/mcp
.
MCP依赖HTTP插件。在
zhin.config.yml
中启用两者:
yaml
plugins:
  - http
  - mcp

http:
  port: 8086

mcp:
  enabled: true
  path: /mcp
MCP端点地址为
http://localhost:8086/mcp

Connecting AI Assistants

连接AI助手

Claude Desktop

Claude Desktop

Edit
~/Library/Application Support/Claude/claude_desktop_config.json
:
json
{
  "mcpServers": {
    "zhin": {
      "command": "curl",
      "args": ["-N", "http://localhost:8086/mcp"]
    }
  }
}
编辑
~/Library/Application Support/Claude/claude_desktop_config.json
json
{
  "mcpServers": {
    "zhin": {
      "command": "curl",
      "args": ["-N", "http://localhost:8086/mcp"]
    }
  }
}

Cursor/VSCode

Cursor/VSCode

Install an MCP extension and configure the server URL in settings.
安装MCP扩展并在设置中配置服务器URL。

Available Tools

可用工具

create_plugin

create_plugin

Create a new Zhin plugin file.
ParameterRequiredDescription
name
YesPlugin name
description
YesPlugin description
features
NoFeature list:
command
,
middleware
,
component
,
context
,
database
directory
NoSave directory (default:
src/plugins
)
创建新的Zhin插件文件。
参数是否必填描述
name
插件名称
description
插件描述
features
功能列表:
command
,
middleware
,
component
,
context
,
database
directory
保存目录(默认:
src/plugins

create_command

create_command

Generate command code snippets.
ParameterRequiredDescription
pattern
YesCommand pattern, e.g.
hello <name:text>
description
YesCommand description
hasPermission
NoWhether to include permission checks
生成命令代码片段。
参数是否必填描述
pattern
命令模式,例如
hello <name:text>
description
命令描述
hasPermission
是否包含权限检查

create_component

create_component

Generate message component code.
ParameterRequiredDescription
name
YesComponent name
props
YesProperty definitions
usesJsx
NoWhether to use JSX syntax
生成消息组件代码。
参数是否必填描述
name
组件名称
props
属性定义
usesJsx
是否使用JSX语法

create_adapter

create_adapter

Generate platform adapter code.
ParameterRequiredDescription
name
YesAdapter name
description
YesAdapter description
hasWebhook
NoWhether webhook support is needed
生成平台适配器代码。
参数是否必填描述
name
适配器名称
description
适配器描述
hasWebhook
是否需要支持Webhook

create_model

create_model

Generate database model definition.
ParameterRequiredDescription
name
YesModel name
fields
YesField definitions
生成数据库模型定义。
参数是否必填描述
name
模型名称
fields
字段定义

query_plugin

query_plugin

Query details of an existing plugin.
ParameterRequiredDescription
pluginName
YesPlugin name to query
查询现有插件的详细信息。
参数是否必填描述
pluginName
要查询的插件名称

list_plugins

list_plugins

List all loaded plugins (no parameters).
列出所有已加载的插件(无参数)。

Available Resources

可用资源

MCP exposes documentation as resources:
URIDescription
zhin://docs/architecture
Zhin architecture design
zhin://docs/plugin-development
Plugin development guide
zhin://docs/best-practices
Development best practices
zhin://docs/command-system
Command system docs
zhin://docs/component-system
Component system docs
zhin://docs/context-system
Context system docs
zhin://examples/basic-plugin
Basic plugin example
zhin://examples/command-plugin
Command plugin example
zhin://examples/adapter
Adapter example
MCP将文档作为资源暴露:
URI描述
zhin://docs/architecture
Zhin架构设计
zhin://docs/plugin-development
插件开发指南
zhin://docs/best-practices
开发最佳实践
zhin://docs/command-system
命令系统文档
zhin://docs/component-system
组件系统文档
zhin://docs/context-system
上下文系统文档
zhin://examples/basic-plugin
基础插件示例
zhin://examples/command-plugin
命令插件示例
zhin://examples/adapter
适配器示例

Available Prompts

可用提示词

create-plugin-workflow

create-plugin-workflow

Guides the full plugin creation workflow.
Parameter:
feature_type
command
,
middleware
,
component
, or
adapter
.
指导完整的插件创建流程。
参数:
feature_type
command
,
middleware
,
component
, 或
adapter

debug-plugin

debug-plugin

Step-by-step plugin debugging guidance.
Parameter:
error_message
(optional) — the error to diagnose.
分步指导插件调试。
参数:
error_message
(可选)—— 要诊断的错误信息。

best-practices

best-practices

Returns Zhin development best practices.
返回Zhin开发最佳实践。

Usage Scenarios

使用场景

Create a Plugin via AI

通过AI创建插件

User: Create a plugin named "welcome" that replies when users say hello

AI: [Uses create_plugin tool] Created plugin with command feature...
用户:创建一个名为"welcome"的插件,当用户说hello时进行回复

AI:[使用create_plugin工具] 创建了包含命令功能的插件...

Debug a Plugin via AI

通过AI调试插件

User: My plugin reports "Context not found"

AI: [Uses query_plugin to inspect] This error usually means the context
    dependency hasn't been registered yet...
用户:我的插件提示"Context not found"

AI:[使用query_plugin工具检查] 这个错误通常意味着上下文依赖尚未注册...

Generate an Adapter via AI

通过AI生成适配器

User: Create a WhatsApp adapter with webhook support

AI: [Uses create_adapter tool] Generated WhatsApp adapter scaffold...
用户:创建一个支持Webhook的WhatsApp适配器

AI:[使用create_adapter工具] 生成了WhatsApp适配器脚手架...

Checklist

检查清单

  • Install
    @zhin.js/mcp
    and
    @zhin.js/http
    .
  • Add both
    http
    and
    mcp
    to the plugins list.
  • Configure
    mcp.path
    (default
    /mcp
    ).
  • Start the Zhin app, then connect your AI assistant.
  • Use MCP tools to scaffold plugins, commands, components, and adapters.
  • Access
    zhin://docs/*
    resources for framework documentation.
  • 安装
    @zhin.js/mcp
    @zhin.js/http
  • http
    mcp
    添加到插件列表中。
  • 配置
    mcp.path
    (默认值为
    /mcp
    )。
  • 启动Zhin应用,然后连接你的AI助手。
  • 使用MCP工具快速生成插件、命令、组件和适配器的脚手架。
  • 访问
    zhin://docs/*
    资源获取框架文档。