内容
# Shinkuro - 通用提示加载器 MCP 服务器
[](https://www.npmjs.com/package/shinkuro)
[](https://github.com/DiscreteTom/shinkuro-rs/releases)
从本地文件夹或 Git 仓库加载 Markdown 文件,并将它们作为 [MCP 提示](https://modelcontextprotocol.io/specification/2025-06-18/server/prompts) 提供。
适用于将提示从各种来源和格式加载到支持 MCP 的应用程序中,并在组织间共享提示。
## 用法
**重要**: 确保您的 MCP 客户端支持 MCP 提示功能。参见 [功能支持矩阵](https://modelcontextprotocol.io/clients#feature-support-matrix)。
### 完整 CLI 用法
<details>
<summary><code>shinkuro --help</code></summary>
```sh
通用提示加载器 MCP 服务器
用法:shinkuro [选项]
选项:
--folder <文件夹> [环境变量:FOLDER=]
--git-url <Git URL> [环境变量:GIT_URL=]
--cache-dir <缓存目录> [环境变量:CACHE_DIR=] [默认值:~/.shinkuro/remote]
--auto-pull [环境变量:AUTO_PULL=]
--variable-format <变量格式> [环境变量:VARIABLE_FORMAT=] [默认值:brace]
--auto-discover-args [环境变量:AUTO_DISCOVER_ARGS=]
--skip-frontmatter [环境变量:SKIP_FRONTMATTER=]
-h, --help 打印帮助信息
-V, --version 打印版本信息
```
</details>
### 本地文件
在您的 MCP 客户端配置中添加:
```json
{
"mcpServers": {
"shinkuro": {
"command": "npx",
"args": ["-y", "shinkuro"],
"env": {
"FOLDER": "/path/to/prompts"
}
}
}
}
```
### 远程 Git 仓库
在您的 MCP 客户端配置中添加:
```json
{
"mcpServers": {
"shinkuro": {
"command": "npx",
"args": ["-y", "shinkuro"],
"env": {
"GIT_URL": "https://github.com/owner/repo.git",
"FOLDER": "prompts" // 可选,Git 仓库中的子文件夹
}
}
}
}
```
> 这将克隆仓库到本地缓存目录。确保您具有正确的权限。
> 支持私有仓库,例如 `"GIT_URL": "git@github.com:DiscreteTom/shinkuro.git"` (使用 SSH 密钥),`"GIT_URL": "https://<username>:<PAT>@github.com/owner/repo.git"` (使用个人访问令牌)
### 与 [Spec-Kit](https://github.com/github/spec-kit) 配合使用
<details>
<summary>展开</summary>
首先,将 Spec-Kit 提示移动到 `./.shinkuro/prompts` 文件夹中。
然后在您的 MCP 客户端配置中添加:
```json
{
"mcpServers": {
"shinkuro": {
"command": "npx",
"args": ["-y", "shinkuro"],
"env": {
"FOLDER": "./.shinkuro/prompts",
"VARIABLE_FORMAT": "dollar",
"AUTO_DISCOVER_ARGS": "true",
"SKIP_FRONTMATTER": "true"
}
}
}
}
```
这将把 Spec-Kit 说明公开为 MCP 提示。
</details>
## 提示加载
指定文件夹(包括嵌套文件夹)中的每个 Markdown 文件都将加载为一个提示。
示例文件夹结构:
```
my-prompts/
├── think.md
└── dev/
├── code-review.md
└── commit.md
```
上述示例将加载为 3 个提示:`think`、`code-review` 和 `commit`。
## 示例提示文件
### 最简单的
```markdown
使用约定提交方式提交到 Git。
```
### 带有元数据的提示
```markdown
---
name: "code-review" # 可选,默认为文件名
title: "代码审查助手" # 可选,默认为文件名
description: "" # 可选,默认为文件路径
---
# 代码审查
请审查此代码以确保其符合最佳实践并且没有潜在问题。
```
### 带有参数的提示
```markdown
---
name: "greeting"
description: "生成个性化的问候消息"
arguments:
- name: "user"
description: "用户的姓名"
# 没有默认值 = 必需参数
- name: "project"
description: "项目名称"
default: "MyApp"
---
说:你好 {user}!欢迎来到 {project}。希望你在这里过得愉快!
```
像 `{user}` 和 `{project}` 这样的变量将在检索提示时替换为实际值。
使用 `{{var}}` (双括号)来转义并在使用的花括号格式化程序时显示字面括号。
> **不同的变量格式:**
>
> - `brace` (默认): `{user}`, `{project}`
> - `dollar`: `$user`, `$project`
## 安装独立二进制文件
<details>
<summary>Shell (macOS/Linux)</summary>
```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/DiscreteTom/shinkuro-rs/releases/latest/download/shinkuro-installer.sh | sh
```
</details>
<details>
<summary>PowerShell (Windows)</summary>
```powershell
irm https://github.com/DiscreteTom/shinkuro-rs/releases/latest/download/shinkuro-installer.ps1 | iex
```
</details>
<details>
<summary>npm</summary>
```sh
npm install -g shinkuro
```
</details>
## 示例提示仓库
- [DiscreteTom/prompts](https://github.com/DiscreteTom/prompts).
## [更新日志](./CHANGELOG.md)