> ## Documentation Index
> Fetch the complete documentation index at: https://platform.stepfun.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 插件

Step Code 通过资源包和插件市场分发扩展、Skills、主题、Agent 和 MCP 服务器。

## 两种分发形态

| 形态           | 管理入口               | 内容                                |
| ------------ | ------------------ | --------------------------------- |
| Packages 资源包 | `step install` 等命令 | TypeScript 扩展、Skills、prompt 模板、主题 |
| 插件市场         | `/plugin`          | 声明式 manifest、Skills、Agent、命令、MCP  |

二者的安装入口和生命周期不同，不应把 `step install` 与 `/plugin install` 当作同一命令。

## Packages：安装与管理

以下包名和地址仅用于展示来源格式，请替换为实际可信资源：

```bash theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
step install npm:@example/package@1.0.0
step install git:github.com/example/repo@v1
step install https://github.com/example/repo
step install /absolute/path/to/package
step list
step remove npm:@example/package
step update --all
step update --extensions
```

* 默认安装到用户范围并写入全局配置。
* `-l` 写入项目 `.stepcode/config.toml`；团队成员信任项目后，启动时自动补装。
* `step -e <来源>` 可临时加载扩展，不将它写入持久配置，但仍会执行扩展代码。
* `step update --all` 更新 Step 与全部包；`step update --extensions` 只更新包与钉住的 Git ref。

## 包来源与 manifest

| 来源             | 行为                              |
| -------------- | ------------------------------- |
| `npm:`         | 通过包管理器安装；指定版本的条目保持锁定            |
| `git:` 或仓库 URL | 克隆仓库；配置的 tag 或 commit 不自动移动到新引用 |
| 本地文件           | 作为单个扩展加载                        |
| 本地目录           | 按资源包规则发现内容                      |

资源包通过 `package.json` 声明 `extensions`、`skills`、`prompts`、`themes` 四类资源路径，支持 glob 和 `!` 排除；无 manifest 时按同名约定目录加载。资源路径相对包根目录解析。

用户级包通常保存在 `~/.stepcode/agent/npm/` 和 `git/`；项目级包保存在 `.stepcode/npm/` 或 `.stepcode/git/`。不要在托管克隆中保留唯一的未提交修改，更新可能重新对齐锁定引用。

## 依赖与打包

第三方运行时依赖放在 `dependencies`，安装时使用 `npm install --omit=dev`。由运行时提供的核心包放在 `peerDependencies: "*"`，不重复打包。

依赖其他 Step 包时，在 `dependencies` 和 `bundledDependencies` 中声明，并通过 `node_modules/` 路径引用资源。

安装包或 Git 依赖可能执行包管理器操作。应审查来源、版本和安装脚本，不能因为扩展入口是 Markdown 或 JSON 就认为没有执行代码的风险。

## 包过滤与启停

在 `config.toml` 中指定加载范围：

```toml theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
[[packages]]
source = "npm:@example/package"
extensions = ["extensions/*.ts", "!extensions/legacy.ts"]
```

按需使用 glob、`!` 排除，以及 `+path` / `-path` 精确增删资源。也可以运行 `step config`，使用 Tab 切换全局与项目范围并管理启停。

同名包的项目级配置覆盖全局条目，项目资源仍受信任设置控制。

## 插件市场

| 命令                           | 作用     |
| ---------------------------- | ------ |
| `/plugin`                    | 打开管理菜单 |
| `/plugin install <插件>`       | 安装插件   |
| `/plugin remove <插件>`        | 卸载插件   |
| `/plugin marketplace list`   | 列出市场源  |
| `/plugin marketplace add`    | 添加市场源  |
| `/plugin marketplace update` | 更新市场索引 |
| `/plugin marketplace remove` | 移除市场源  |

原生 manifest 使用 `step.plugin.json`，兼容 `.claude-plugin/plugin.json` 和市场清单 `marketplace.json`。字段包括 `id`、`name`、`description`、`version`、`entry`、`skills`、`agents`、`commands`、`mcpServers` 和 `provision`。`id` 必填，大小上限为 512 KiB；`entry` 是可执行入口字段，仅记录，不加载。

安装或卸载包含 MCP 的插件后，重启 Step Code 才会启动或停用对应服务器。使用 `/mcp` 检查加载结果。

## StepPage：发布静态网站

```text theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
/plugin install steppage
```

`steppage` 是内置市场插件，可发布静态目录或 ZIP、列出站点与版本、promote / 回滚，并生成分享预览链接。需要 `STEPFUN_API_KEY` 或已登录 Step 账号；缺少 `steppage-mcp` 时经官方安装器自动补齐，Windows 暂不自动安装。具体步骤见 [steppage](/docs/zh/step-code/reference/steppage)。

发布后在 [platform.stepfun.com/sites](https://platform.stepfun.com/sites) 管理站点。内置市场还提供 `playwright` 浏览器操控插件，使用 `npx @playwright/mcp@latest`。

## 安全注意

扩展、包和 stdio MCP 可以按当前系统用户权限执行代码；Skills 和 Agent 指令也可能引导执行命令。只安装可信来源，并为项目提供最小必要凭据。

Step Code 没有文件式 Hooks；等价的自动化拦截使用扩展事件 `tool_call`、`tool_result`、`input` 等实现。

## 下一步

* [Agent Skills](/docs/zh/step-code/customization/skills)
* [MCP](/docs/zh/step-code/customization/mcp)
* [Agent 与 subagent](/docs/zh/step-code/customization/agents)
