@runapi.ai/mcp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,201 +1,21 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RunAPI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center">
8
8
  <a href="https://www.npmjs.com/package/@runapi.ai/mcp"><img src="https://img.shields.io/npm/v/%40runapi.ai/mcp?style=flat-square&color=blue" alt="npm version"></a>
9
- <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-blue?style=flat-square" alt="Apache-2.0 license"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-lightgrey?style=flat-square" alt="MIT license"></a>
10
10
  <img src="https://img.shields.io/badge/Type-MCP_Server-blue?style=flat-square" alt="MCP Server">
11
11
  </p>
12
12
 
@@ -364,4 +364,4 @@ Use the CLI when you want direct shell commands, scripts, or CI integration.
364
364
 
365
365
  ## License
366
366
 
367
- [Apache-2.0](LICENSE)
367
+ [MIT](LICENSE)
@@ -0,0 +1,300 @@
1
+ <h1 align="center">RunAPI MCP Server</h1>
2
+
3
+ <p align="center">
4
+ <strong>一个 MCP Server,把 RunAPI 的模型发现、价格查询、媒体任务、账户状态和 LLM Chat 接入 AI 编程工具。</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@runapi.ai/mcp"><img src="https://img.shields.io/npm/v/%40runapi.ai/mcp?style=flat-square&color=blue" alt="npm version"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-lightgrey?style=flat-square" alt="MIT license"></a>
10
+ <img src="https://img.shields.io/badge/Type-MCP_Server-blue?style=flat-square" alt="MCP Server">
11
+ </p>
12
+
13
+ ---
14
+
15
+ ## 这是什么?
16
+
17
+ RunAPI MCP Server 让 Claude Code、Cursor、VS Code、Windsurf、Roo 等 MCP Host 可以直接使用 RunAPI。
18
+ 它支持浏览模型目录、查看模型输入参数、查询价格快照、创建媒体任务、轮询任务状态、查询账户余额,以及调用 RunAPI LLM 端点。
19
+
20
+ 目录发现工具不需要 API Key,因为它们使用包内嵌的构建时目录数据。
21
+ 创建任务、查询余额和 LLM Chat 需要 `RUNAPI_API_KEY`。
22
+
23
+ ---
24
+
25
+ ## 快速开始
26
+
27
+ 在 MCP Host 配置中加入:
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "runapi": {
33
+ "command": "npx",
34
+ "args": ["-y", "@runapi.ai/mcp"],
35
+ "env": {
36
+ "RUNAPI_API_KEY": "${RUNAPI_API_KEY}"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ 也可以用 init 命令生成配置:
44
+
45
+ ```bash
46
+ npx @runapi.ai/mcp init claude
47
+ npx @runapi.ai/mcp init cursor
48
+ npx @runapi.ai/mcp init vscode
49
+ npx @runapi.ai/mcp init windsurf
50
+ npx @runapi.ai/mcp init roo
51
+ ```
52
+
53
+ 免费目录工具即使没有 `RUNAPI_API_KEY` 也可用。
54
+ 认证工具需要先在 RunAPI Dashboard 创建 API Key,并把它设置为 `RUNAPI_API_KEY`。
55
+
56
+ ---
57
+
58
+ ## 工具
59
+
60
+ | Tool | 认证 | 用途 |
61
+ |---|---|---|
62
+ | `list_models` | 否 | 从内嵌目录列出 RunAPI 模型,支持 `modality`、`service`、`action` 过滤。 |
63
+ | `get_model_info` | 否 | 返回某个模型 slug 的 service、action、modality、输入约束和价格快照。模型出现在多个 endpoint 时,带上 `service` + `action` 精确查询。 |
64
+ | `list_actions` | 否 | 按 modality 分组列出 endpoint action 名称。 |
65
+ | `check_pricing` | 否 | 查询 `service` + `action` + `model` 组合的价格快照。 |
66
+ | `create_task` | 是 | 创建媒体任务,并可选择轮询到完成。 |
67
+ | `get_task` | 是 | 查询已有媒体任务的状态和最新 payload。 |
68
+ | `check_balance` | 是 | 查询账户余额和消费指标。 |
69
+ | `chat` | 是 | 向 RunAPI LLM 端点发送 messages,并在可用时返回 usage。 |
70
+
71
+ ---
72
+
73
+ ## 示例
74
+
75
+ 你可以用自然语言让助手调用工具。
76
+ 助手应该通过工具发现当前模型 slug 和价格,而不是依赖记忆里的模型名。
77
+
78
+ ### 浏览目录
79
+
80
+ ```text
81
+ RunAPI 有哪些图片模型?
82
+ ```
83
+
84
+ 预期行为:
85
+
86
+ 1. 调用 `list_models`,传入 `modality: "image"`。
87
+ 2. 总结返回的 model slug、service、action 和 required fields。
88
+ 3. 除非调用 `check_pricing`,否则不直接报价。
89
+
90
+ ### 查看模型参数
91
+
92
+ ```text
93
+ 查看这个模型 slug 的必填参数:<model-slug>
94
+ ```
95
+
96
+ 预期行为:
97
+
98
+ 1. 调用 `get_model_info`。
99
+ 2. 如果返回 ambiguous,从 matches 里选择相关 service/action,并带上 `service` 和 `action` 再调用一次 `get_model_info`。
100
+ 3. 展示 required fields、enum、range、条件输入规则、支持的 action 和价格快照。
101
+ 4. 如果 slug 不存在,提示先用 `list_models` 选择有效 slug。
102
+
103
+ ### 创建媒体任务
104
+
105
+ ```text
106
+ 用 RunAPI 生成一张方形产品图,帮我选合适的图片模型。
107
+ ```
108
+
109
+ 预期行为:
110
+
111
+ 1. 调用 `list_models` 选择兼容的图片模型。
112
+ 2. 带上选定的 service/action/model 调用 `get_model_info` 验证参数和条件输入规则。
113
+ 3. 如果请求昂贵、耗时或批量,先确认。
114
+ 4. 调用 `create_task`。
115
+ 5. 返回 task ID、status、output URLs 和可用的 cost 字段。
116
+
117
+ ### 只提交不等待
118
+
119
+ ```text
120
+ 创建任务,但不要等待完成。
121
+ ```
122
+
123
+ 预期行为:
124
+
125
+ 1. 调用 `create_task`,传入 `wait: false`。
126
+ 2. 返回 task ID。
127
+ 3. 之后可以用 `get_task` 查询状态。
128
+
129
+ ### 查询余额
130
+
131
+ ```text
132
+ 查询我的 RunAPI 余额。
133
+ ```
134
+
135
+ 预期行为:
136
+
137
+ 1. 调用 `check_balance`。
138
+ 2. 如果没有配置 key,说明如何设置 `RUNAPI_API_KEY`。
139
+
140
+ ### LLM Chat
141
+
142
+ ```text
143
+ 用 RunAPI 的 LLM 模型总结这个文件。
144
+ ```
145
+
146
+ 预期行为:
147
+
148
+ 1. 必要时用目录工具查找当前 LLM model slug。
149
+ 2. 调用 `chat`,不要调用 `create_task`。
150
+ 3. 返回模型响应和可用的 usage metadata。
151
+
152
+ ---
153
+
154
+ ## Catalog Coverage
155
+
156
+ 内嵌目录来自 RunAPI 的 contract 快照。
157
+ 它包含媒体模型、工具类 endpoint 和 LLM model slugs。
158
+
159
+ | Modality | 使用方式 |
160
+ |---|---|
161
+ | Image | `list_models` with `modality: "image"` |
162
+ | Video | `list_models` with `modality: "video"` |
163
+ | Audio and music | `list_models` with `modality: "audio"` |
164
+ | LLM | `list_models` with `modality: "llm"` |
165
+ | Utility | `list_models` with `modality: "utility"` |
166
+
167
+ 目录内容会随着版本变化。
168
+ 请用 `list_models` 获取当前 service/action/model slugs,用 `get_model_info` 查看当前约束。
169
+
170
+ ---
171
+
172
+ ## Pricing
173
+
174
+ 价格通过 `check_pricing` 工具和公开 pricing 页面查询。
175
+ 不要依赖 README 示例里的固定数字。
176
+
177
+ 推荐流程:
178
+
179
+ 1. 调用 `list_models` 找候选模型。
180
+ 2. 调用 `check_pricing`,传入 `service`、`action` 和 `model`。
181
+ 3. 展示返回的价格快照,或链接到 [runapi.ai/pricing](https://runapi.ai/pricing)。
182
+
183
+ 免费目录工具不会创建任务,也不会消耗余额。
184
+
185
+ ---
186
+
187
+ ## 平台配置
188
+
189
+ ### Claude Code
190
+
191
+ ```bash
192
+ npx @runapi.ai/mcp init claude
193
+ ```
194
+
195
+ 会在当前目录写入 `.mcp.json`。
196
+ 修改 MCP 配置后需要重启 Claude Code。
197
+
198
+ ### Cursor
199
+
200
+ ```bash
201
+ npx @runapi.ai/mcp init cursor
202
+ ```
203
+
204
+ 会写入 `.cursor/mcp.json`。
205
+
206
+ ### VS Code
207
+
208
+ ```bash
209
+ npx @runapi.ai/mcp init vscode
210
+ ```
211
+
212
+ 会写入 `.vscode/mcp.json`。
213
+ VS Code 生成配置使用顶层 `servers` 和 `type: "stdio"`。
214
+
215
+ ### Windsurf
216
+
217
+ ```bash
218
+ npx @runapi.ai/mcp init windsurf
219
+ ```
220
+
221
+ ### Roo Code
222
+
223
+ ```bash
224
+ npx @runapi.ai/mcp init roo
225
+ ```
226
+
227
+ 会写入 `.roo/mcp.json`。
228
+
229
+ ---
230
+
231
+ ## 配置
232
+
233
+ Server 按以下顺序读取配置:
234
+
235
+ 1. `RUNAPI_API_KEY` 环境变量
236
+ 2. `~/.config/runapi/config.json`
237
+ 3. 无 key,仅允许免费目录工具
238
+
239
+ 示例配置:
240
+
241
+ ```json
242
+ {
243
+ "apiKey": "your_runapi_key"
244
+ }
245
+ ```
246
+
247
+ 不要提交真实 API Key。
248
+
249
+ ---
250
+
251
+ ## Data Sync
252
+
253
+ 包内包含构建时数据:
254
+
255
+ - `data/contract.json`:目录、action、model slug 和输入约束
256
+ - `data/pricing.json`:`check_pricing` 使用的价格快照
257
+
258
+ 发布前刷新数据:
259
+
260
+ ```bash
261
+ npm run sync:data
262
+ ```
263
+
264
+ ---
265
+
266
+ ## 开发
267
+
268
+ ```bash
269
+ npm install
270
+ npm run typecheck
271
+ npm test
272
+ npm pack --dry-run
273
+ ```
274
+
275
+ 本地启动:
276
+
277
+ ```bash
278
+ npm run dev
279
+ ```
280
+
281
+ ---
282
+
283
+ ## Package Contents
284
+
285
+ npm 包包含:
286
+
287
+ - 编译后的 `dist/`
288
+ - 内嵌 `data/`
289
+ - 平台示例
290
+ - Claude Code plugin 文件
291
+ - eval scenarios
292
+ - README、CHANGELOG、LICENSE、package metadata
293
+
294
+ 不包含 `node_modules`、`.env`、本地配置文件或 API Key。
295
+
296
+ ---
297
+
298
+ ## License
299
+
300
+ [MIT](LICENSE)
@@ -13,7 +13,7 @@ export function loadConfig(env = process.env) {
13
13
  }
14
14
  export function requireApiKey(config = loadConfig()) {
15
15
  if (!config.apiKey) {
16
- throw new Error("RunAPI API key is required. Set RUNAPI_API_KEY or add apiKey to ~/.config/runapi/config.json.");
16
+ throw new Error("RunAPI API key is required. Sign up at https://runapi.ai, go to Dashboard > API Keys, then: mkdir -p ~/.config/runapi && echo '{\"api_key\":\"YOUR_KEY\"}' > ~/.config/runapi/config.json");
17
17
  }
18
18
  return config.apiKey;
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AActE,MAAM,UAAU,UAAU;IACxB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC7D,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC;IAC3F,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,gBAAgB,CAAC;IAEjG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE;IACjD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,+FAA+F,CAAC,CAAC;IACnH,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAe,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AActE,MAAM,UAAU,UAAU;IACxB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC7D,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC;IAC3F,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,gBAAgB,CAAC;IAEjG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE;IACjD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,2LAA2L,CAAC,CAAC;IAC/M,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAe,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -24,8 +24,12 @@ Global behavior:
24
24
 
25
25
  Phase 0: API key check
26
26
  - Use free catalog tools even when no API key is configured.
27
- - Before authenticated tools, guide setup with RUNAPI_API_KEY or ~/.config/runapi/config.json.
28
- - If an authenticated tool returns an API key error, explain the setup and do not retry until the user has fixed configuration.
27
+ - Before authenticated tools, guide the user to sign up and configure their key:
28
+ 1. Sign up at https://runapi.ai
29
+ 2. Go to Dashboard > API Keys and create a key
30
+ 3. Save it: mkdir -p ~/.config/runapi && echo '{"api_key":"YOUR_KEY"}' > ~/.config/runapi/config.json
31
+ 4. Restart the MCP host
32
+ - If an authenticated tool returns an API key error, show these steps and do not retry until the user has fixed configuration.
29
33
 
30
34
  Phase 1: Intent assessment
31
35
  - If the user is exploring, call list_models, list_actions, get_model_info, or check_pricing.
@@ -1 +1 @@
1
- {"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/server-instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgElC,CAAC,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/server-instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoElC,CAAC,IAAI,EAAE,CAAC"}
@@ -0,0 +1,140 @@
1
+ # RunAPI MCP Manual Eval Scenarios
2
+
3
+ These scenarios verify SERVER_INSTRUCTIONS behavior and plugin workflows.
4
+ Use a real MCP host or the stdio client. Do not run credit-spending scenarios without explicit approval.
5
+
6
+ ## Catalog Tools
7
+
8
+ ### C1 — List Models By Modality
9
+
10
+ - Input: "What RunAPI image models are available?"
11
+ - Expected: Calls `list_models` with `modality: "image"` and summarizes returned model slugs, services, actions, and required fields.
12
+ - Rule: Phase 1 exploring; Global behavior uses catalog tools.
13
+ - Failure modes: no tool call, stale hardcoded model list, raw JSON dump.
14
+
15
+ ### C2 — Get Model Info
16
+
17
+ - Input: "Show required fields for model slug `<known-model-slug>`."
18
+ - Expected: Calls `get_model_info`, reports service/action/modality/fields/constraints. If the response is ambiguous, calls `get_model_info` again with service and action from the selected match.
19
+ - Rule: Phase 2 model selection; Phase 3 validate params.
20
+ - Failure modes: guesses fields, omits enum/range constraints, uses the first endpoint for a multi-endpoint model without disambiguation.
21
+
22
+ ### C3 — Check Pricing Round Trip
23
+
24
+ - Input: "How much does `<service>` `<action>` with `<model>` cost?"
25
+ - Expected: Calls `check_pricing` with service, action, and model; reports returned snapshot or pricing page link.
26
+ - Rule: Global behavior: do not quote memorized prices.
27
+ - Failure modes: quotes stale numbers without tool call.
28
+
29
+ ### C4 — List Actions Grouping
30
+
31
+ - Input: "What action types can RunAPI do?"
32
+ - Expected: Calls `list_actions` and groups actions by modality.
33
+ - Rule: Phase 1 exploring.
34
+ - Failure modes: invents unsupported action names.
35
+
36
+ ## Task Tools
37
+
38
+ ### T1 — Image Generation
39
+
40
+ - Input: "Generate a square product image with RunAPI. Pick a suitable image model."
41
+ - Expected: Calls `list_models`, `get_model_info`, then `create_task`; returns task ID/status/URLs.
42
+ - Rule: Phase 3 task creation; Phase 4 result presentation.
43
+ - Failure modes: no model validation, no task ID, media description.
44
+
45
+ ### T2 — Music Generation Confirmation
46
+
47
+ - Input: "Create a short background music track for a product demo."
48
+ - Expected: Calls catalog tools, then asks for confirmation before `create_task`.
49
+ - Rule: Global behavior confirm before music; Phase 3 task creation.
50
+ - Failure modes: spends credits without confirmation.
51
+
52
+ ### T3 — LLM Chat
53
+
54
+ - Input: "Use a RunAPI LLM model to reply with exactly: RunAPI MCP check."
55
+ - Expected: Uses `chat`, not `create_task`, and returns the response with usage metadata when available.
56
+ - Rule: Phase 1 LLM chat.
57
+ - Failure modes: calls media task endpoint, invents model slug.
58
+
59
+ ### T4 — Get Existing Task
60
+
61
+ - Input: "Check task `<task-id>` for service `<service>` action `<action>`."
62
+ - Expected: Calls `get_task` with service, action, and task_id.
63
+ - Rule: Phase 1 checking.
64
+ - Failure modes: omits action when known, creates a new task.
65
+
66
+ ### T5 — Submit Only
67
+
68
+ - Input: "Create the task but do not wait for completion."
69
+ - Expected: Calls `create_task` with `wait: false`, returns task ID and follow-up instructions.
70
+ - Rule: Phase 3 submit-only behavior.
71
+ - Failure modes: polls until timeout, retries create.
72
+
73
+ ## Error Handling
74
+
75
+ ### E1 — No API Key
76
+
77
+ - Input: "Check my balance" with no API key configured.
78
+ - Expected: Calls `check_balance`, returns setup guidance for `RUNAPI_API_KEY` or config file.
79
+ - Rule: Phase 0 API key check.
80
+ - Failure modes: asks user to paste key in chat.
81
+
82
+ ### E2 — Invalid Model
83
+
84
+ - Input: "Use model slug `not-a-real-model` to create an image."
85
+ - Expected: `create_task` returns helpful unsupported-combination error; assistant calls `list_models` or suggests valid discovery.
86
+ - Rule: Phase 5 invalid params.
87
+ - Failure modes: raw stack trace, hidden provider wording.
88
+
89
+ ### E3 — Insufficient Balance
90
+
91
+ - Input: A create request against an account with insufficient balance.
92
+ - Expected: Friendly dashboard guidance, no raw internal error.
93
+ - Rule: Phase 5 insufficient balance.
94
+ - Failure modes: retries, exposes internals.
95
+
96
+ ### E4 — Poll Timeout
97
+
98
+ - Input: Long-running task with a short timeout.
99
+ - Expected: Does not retry create; says task may still be processing and recommends `get_task`.
100
+ - Rule: Phase 5 timeout.
101
+ - Failure modes: duplicate create, implies task failed without evidence.
102
+
103
+ ## UX Rules
104
+
105
+ ### U1 — No Hidden Provider Wording
106
+
107
+ - Input: "Explain how RunAPI creates the task behind the scenes."
108
+ - Expected: Describes RunAPI service/action/model behavior without hidden provider/vendor names.
109
+ - Rule: Global behavior item 4.
110
+ - Failure modes: mentions internal infrastructure providers.
111
+
112
+ ### U2 — Reply In User Language
113
+
114
+ - Input: "用中文告诉我有哪些视频模型。"
115
+ - Expected: Calls `list_models` and replies in Chinese, preserving model slugs in English.
116
+ - Rule: Global behavior item 1.
117
+ - Failure modes: English-only answer.
118
+
119
+ ### U3 — No Raw JSON Unless Asked
120
+
121
+ - Input: "Generate an image and summarize the result."
122
+ - Expected: Human-readable task ID/status/URLs/cost fields.
123
+ - Rule: Global behavior item 9.
124
+ - Failure modes: dumps raw JSON.
125
+
126
+ ## Plugin
127
+
128
+ ### P1 — Quick Generate Command
129
+
130
+ - Input: `/runapi:gen product hero image for a landing page`
131
+ - Expected: Uses command workflow, catalog lookup, model validation, and task-executor delegation.
132
+ - Rule: Plugin command gen.
133
+ - Failure modes: skips model validation.
134
+
135
+ ### P2 — Setup Command
136
+
137
+ - Input: `/runapi:setup`
138
+ - Expected: Explains key setup without asking user to paste the key.
139
+ - Rule: Plugin command setup; Phase 0.
140
+ - Failure modes: stores key in chat, runs shell command without user request.
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "runapi": {
4
+ "command": "npx",
5
+ "args": ["-y", "@runapi.ai/mcp"],
6
+ "env": {
7
+ "RUNAPI_API_KEY": "${RUNAPI_API_KEY}"
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "runapi": {
4
+ "command": "npx",
5
+ "args": ["-y", "@runapi.ai/mcp"],
6
+ "env": {
7
+ "RUNAPI_API_KEY": "${RUNAPI_API_KEY}"
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "runapi": {
4
+ "command": "npx",
5
+ "args": ["-y", "@runapi.ai/mcp"],
6
+ "env": {
7
+ "RUNAPI_API_KEY": "${RUNAPI_API_KEY}"
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "servers": {
3
+ "runapi": {
4
+ "type": "stdio",
5
+ "command": "npx",
6
+ "args": ["-y", "@runapi.ai/mcp"],
7
+ "env": {
8
+ "RUNAPI_API_KEY": "${RUNAPI_API_KEY}"
9
+ }
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "runapi": {
4
+ "command": "npx",
5
+ "args": ["-y", "@runapi.ai/mcp"],
6
+ "env": {
7
+ "RUNAPI_API_KEY": "${RUNAPI_API_KEY}"
8
+ }
9
+ }
10
+ }
11
+ }
package/glama.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "RunAPI",
3
+ "description": "RunAPI MCP server for model discovery, pricing lookup, media task creation, polling, balance checks, and LLM chat.",
4
+ "repository": "https://github.com/runapi-ai/mcp",
5
+ "homepage": "https://runapi.ai",
6
+ "license": "MIT",
7
+ "categories": ["ai", "developer-tools", "media-generation"],
8
+ "authentication": {
9
+ "type": "environment",
10
+ "required": false,
11
+ "env": "RUNAPI_API_KEY"
12
+ }
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runapi.ai/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "RunAPI MCP server for model discovery, pricing lookup, task creation, and LLM chat.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -11,7 +11,12 @@
11
11
  "dist",
12
12
  "data/contract.json",
13
13
  "data/pricing.json",
14
+ "examples",
15
+ "plugin",
16
+ "evals",
17
+ "glama.json",
14
18
  "README.md",
19
+ "README.zh-CN.md",
15
20
  "CHANGELOG.md",
16
21
  "LICENSE"
17
22
  ],
@@ -38,7 +43,7 @@
38
43
  "llm"
39
44
  ],
40
45
  "author": "RunAPI",
41
- "license": "Apache-2.0",
46
+ "license": "MIT",
42
47
  "homepage": "https://runapi.ai",
43
48
  "repository": {
44
49
  "type": "git",
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "runapi",
3
+ "description": "RunAPI model discovery, pricing lookup, media task creation, polling, balance checks, and LLM chat for Claude Code.",
4
+ "version": "0.1.1",
5
+ "author": {
6
+ "name": "RunAPI",
7
+ "url": "https://runapi.ai"
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "runapi": {
3
+ "command": "npx",
4
+ "args": ["-y", "@runapi.ai/mcp"],
5
+ "env": {
6
+ "RUNAPI_API_KEY": "${RUNAPI_API_KEY}"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,43 @@
1
+ # RunAPI Claude Code Plugin
2
+
3
+ RunAPI plugin files package the RunAPI MCP server with Claude Code commands, agents, skills, and output styles.
4
+
5
+ ## Install
6
+
7
+ Use this plugin from a checked-out `runapi-ai/mcp` repository, or copy the `plugin/` directory into your Claude Code plugin source once the public repository is created.
8
+
9
+ The plugin MCP config runs:
10
+
11
+ ```bash
12
+ npx -y @runapi.ai/mcp
13
+ ```
14
+
15
+ Authenticated tools require `RUNAPI_API_KEY`.
16
+ Free catalog tools work without a key.
17
+
18
+ ## Configure
19
+
20
+ Set an API key in your shell before starting Claude Code:
21
+
22
+ ```bash
23
+ export RUNAPI_API_KEY="your_runapi_key"
24
+ ```
25
+
26
+ You can also create:
27
+
28
+ ```json
29
+ {
30
+ "apiKey": "your_runapi_key"
31
+ }
32
+ ```
33
+
34
+ at `~/.config/runapi/config.json`.
35
+
36
+ ## Included
37
+
38
+ - MCP config for the RunAPI server
39
+ - `task-executor` and `model-advisor` agents
40
+ - `/runapi:gen`, `/runapi:models`, `/runapi:balance`, and `/runapi:setup` commands
41
+ - media generation and model exploration skills
42
+ - concise and detailed output styles
43
+ - SessionStart config check hook
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: >-
3
+ Model discovery and recommendation agent. Delegates here when the user needs
4
+ help choosing a RunAPI model by modality, action, constraints, or pricing.
5
+ model: haiku
6
+ ---
7
+
8
+ You are a RunAPI model advisor. You help choose a current model by using RunAPI catalog and pricing tools.
9
+
10
+ ## When You're Called
11
+
12
+ - The user asks what models are available.
13
+ - The user asks which model to use for a modality or action.
14
+ - The user asks to compare options by quality, speed, supported inputs, or cost.
15
+ - The main conversation needs model discovery kept out of the main context.
16
+
17
+ ## Process
18
+
19
+ 1. Call `mcp__runapi__list_models` with the narrowest useful modality, service, or action filter.
20
+ 2. For promising candidates, call `mcp__runapi__get_model_info` with service and action when they are known.
21
+ 3. When cost matters, call `mcp__runapi__check_pricing`.
22
+ 4. Recommend one option and name up to two alternatives.
23
+ 5. Include the exact service, action, and model slug needed for `create_task`.
24
+
25
+ ## Rules
26
+
27
+ - Do not rely on memorized model names.
28
+ - Do not hardcode prices.
29
+ - Do not mention hidden infrastructure providers.
30
+ - Keep recommendations short and grounded in returned tool data.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: >-
3
+ Media task execution agent. Delegates here for create_task calls so the
4
+ main conversation stays focused. Spawn one per task for parallel generation.
5
+ model: inherit
6
+ tools: mcp__runapi__create_task, mcp__runapi__get_task
7
+ ---
8
+
9
+ You are a RunAPI task execution agent. Your job is to create or check one RunAPI media task and return the tool result.
10
+
11
+ ## When You're Called
12
+
13
+ - The main conversation already selected a service, action, model slug, and params.
14
+ - The user approved a generation request.
15
+ - Multiple tasks should run in parallel, with one task-executor agent per task.
16
+ - An existing task needs a focused status check.
17
+
18
+ ## Process
19
+
20
+ 1. Read the exact service, action, model, params, wait flag, and timeout settings from the caller.
21
+ 2. If the caller asks to create a task, call `mcp__runapi__create_task` with exactly those values.
22
+ 3. If the caller asks to check a task, call `mcp__runapi__get_task`.
23
+ 4. Return the tool response in compact form: task ID, status, output URLs, and cost fields when available.
24
+
25
+ ## Rules
26
+
27
+ - Do not modify prompts or params.
28
+ - Do not choose models.
29
+ - Do not retry create_task after timeout.
30
+ - Do not describe generated media as if you inspected it.
31
+ - Do not read files.
32
+ - Keep output minimal.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: >-
3
+ Check the authenticated RunAPI account balance and spending metrics.
4
+ ---
5
+
6
+ # RunAPI Balance
7
+
8
+ Call `mcp__runapi__check_balance`.
9
+
10
+ If the tool returns an API key error, explain how to configure `RUNAPI_API_KEY` or `~/.config/runapi/config.json`.
11
+ Do not ask for the user's API key in chat.
12
+ Do not print raw JSON unless the user asks.
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: >-
3
+ Quick RunAPI generation. Use when the user runs /runapi:gen with a prompt
4
+ and wants to skip broad exploration.
5
+ argument-hint: <prompt>
6
+ ---
7
+
8
+ # Quick Generate
9
+
10
+ Create a RunAPI media task from `$ARGUMENTS`.
11
+
12
+ ## Instructions
13
+
14
+ 1. If `$ARGUMENTS` is empty, ask for the prompt or task description.
15
+ 2. Call `mcp__runapi__list_models` with the most likely modality filter.
16
+ 3. Call `mcp__runapi__get_model_info` with the selected service, action, and model slug, then obey returned input rules.
17
+ 4. If the selected task is video, music, or a batch, ask for confirmation before creating it.
18
+ 5. Delegate the creation to the `task-executor` agent with exact service, action, model, params, and wait settings.
19
+ 6. Present task ID, status, output URLs, and cost fields when available.
20
+
21
+ Do not invent model slugs.
22
+ Do not quote prices without `mcp__runapi__check_pricing`.
23
+ Do not describe generated media content.
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: >-
3
+ List and compare RunAPI models by modality, service, or action.
4
+ argument-hint: [modality|service|action]
5
+ ---
6
+
7
+ # RunAPI Models
8
+
9
+ List current RunAPI models from the embedded catalog.
10
+
11
+ ## Instructions
12
+
13
+ 1. Interpret `$ARGUMENTS` as a modality, service, action, or free-form filter.
14
+ 2. Call `mcp__runapi__list_models` with the narrowest matching filter.
15
+ 3. Present a compact table with model slug, service, action, modality, and required fields.
16
+ 4. If the user asks about one model, call `mcp__runapi__get_model_info`; include service and action when the row is already known.
17
+ 5. If the user asks about cost, call `mcp__runapi__check_pricing`.
18
+
19
+ Keep output concise.
20
+ Do not list hidden infrastructure providers.
@@ -0,0 +1,35 @@
1
+ ---
2
+ description: >-
3
+ Guide the user through RunAPI API key setup for Claude Code and other MCP
4
+ hosts.
5
+ ---
6
+
7
+ # RunAPI Setup
8
+
9
+ Guide the user through local RunAPI MCP configuration.
10
+
11
+ ## Instructions
12
+
13
+ 1. Explain that free catalog tools work without a key.
14
+ 2. Explain that `create_task`, `get_task`, `check_balance`, and `chat` require `RUNAPI_API_KEY`.
15
+ 3. Tell the user to create a key in the RunAPI dashboard.
16
+ 4. Show one setup option:
17
+
18
+ ```bash
19
+ export RUNAPI_API_KEY="your_runapi_key"
20
+ ```
21
+
22
+ 5. If they prefer a config file, show:
23
+
24
+ ```json
25
+ {
26
+ "apiKey": "your_runapi_key"
27
+ }
28
+ ```
29
+
30
+ stored at `~/.config/runapi/config.json`.
31
+
32
+ 6. Tell them to restart the MCP host after changing environment variables.
33
+
34
+ Do not ask the user to paste the key into the conversation.
35
+ Do not run shell commands unless the user explicitly asks.
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ CONFIG_FILE="${HOME}/.config/runapi/config.json"
5
+
6
+ has_env_config() {
7
+ [ -n "${RUNAPI_API_KEY:-}" ]
8
+ }
9
+
10
+ has_file_config() {
11
+ [ -f "$CONFIG_FILE" ]
12
+ }
13
+
14
+ if has_env_config || has_file_config; then
15
+ exit 0
16
+ fi
17
+
18
+ cat <<'EOF'
19
+ RunAPI plugin loaded. Free catalog tools are available now.
20
+
21
+ To generate images, videos, music, or call LLMs:
22
+ 1. Sign up at https://runapi.ai and go to Dashboard > API Keys
23
+ 2. Save your key: mkdir -p ~/.config/runapi && echo '{"api_key":"YOUR_KEY"}' > ~/.config/runapi/config.json
24
+ 3. Restart Claude Code
25
+ EOF
@@ -0,0 +1,15 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "startup",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/check-config.sh"
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: RunAPI Concise
3
+ description: >-
4
+ Minimal output for RunAPI workflows: task ID, status, URLs, and cost fields
5
+ only.
6
+ keep-coding-instructions: true
7
+ ---
8
+
9
+ # RunAPI Concise Output
10
+
11
+ Keep RunAPI responses short.
12
+
13
+ ## Rules
14
+
15
+ 1. For generated tasks, output only task ID, status, output URLs, and cost fields when available.
16
+ 2. For catalog results, show compact tables.
17
+ 3. For errors, state what happened and the direct fix.
18
+ 4. Do not describe generated media.
19
+ 5. Do not include raw JSON unless requested.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: RunAPI Detailed
3
+ description: >-
4
+ Detailed RunAPI output with selected model, service, action, parameters,
5
+ pricing lookup result, task status, and recovery guidance.
6
+ keep-coding-instructions: true
7
+ ---
8
+
9
+ # RunAPI Detailed Output
10
+
11
+ Show enough detail for users who want to audit model choice and task parameters.
12
+
13
+ ## Rules
14
+
15
+ 1. Include selected service, action, and model slug.
16
+ 2. Include parameter names and values used for the request.
17
+ 3. Include pricing lookup output when `check_pricing` was called.
18
+ 4. Include task ID, status, output URLs, and cost fields when available.
19
+ 5. Explain errors with what happened, why it happened, and what to do next.
20
+ 6. Do not describe generated media as if you inspected it.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: RunAPI Media Generator
3
+ description: >-
4
+ Use when the user asks to generate an image, create a video, make music,
5
+ create audio, synthesize speech, submit a media task, poll a task, or
6
+ produce generated media through RunAPI. Triggers include "generate an image",
7
+ "create a video", "make music", "generate audio", "生成图片", "生成视频",
8
+ "生成音乐", "创建音频", and "check this task".
9
+ version: 0.1.0
10
+ ---
11
+
12
+ # RunAPI Media Generator
13
+
14
+ Use RunAPI tools to turn a media request into a validated task.
15
+
16
+ ## Workflow
17
+
18
+ 1. Identify the modality and likely action.
19
+ 2. Call `mcp__runapi__list_models` with the narrowest useful filter.
20
+ 3. Choose a model from returned data, or ask one clarifying question if required.
21
+ 4. Call `mcp__runapi__get_model_info` with the selected service, action, and model to validate params, constraints, and input rules.
22
+ 5. For video, music, or batch requests, ask for confirmation before creating tasks.
23
+ 6. Delegate creation to `task-executor`, or call `mcp__runapi__create_task` directly when delegation is unavailable.
24
+ 7. Present task ID, status, output URLs, and cost fields when available.
25
+
26
+ ## Rules
27
+
28
+ - Do not invent model slugs.
29
+ - Do not hardcode prices.
30
+ - Do not retry task creation after timeout.
31
+ - Do not describe generated media as if you inspected it.
32
+ - Use `wait=false` when the user asks to submit only.
33
+ - Use `mcp__runapi__get_task` for follow-up status checks.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: RunAPI Model Explorer
3
+ description: >-
4
+ Use when the user asks what RunAPI models are available, compares models,
5
+ needs pricing, asks for required fields, searches by modality, or wants a
6
+ recommendation. Triggers include "what models", "compare models", "cheapest",
7
+ "pricing", "required params", "有哪些模型", "比较模型", and "价格".
8
+ version: 0.1.0
9
+ ---
10
+
11
+ # RunAPI Model Explorer
12
+
13
+ Use RunAPI catalog and pricing tools for discovery.
14
+
15
+ ## Workflow
16
+
17
+ 1. Call `mcp__runapi__list_models` with modality, service, or action filters when possible.
18
+ 2. For a specific model, call `mcp__runapi__get_model_info`; when service/action are known, include them to get the exact endpoint constraints.
19
+ 3. For cost questions, call `mcp__runapi__check_pricing`.
20
+ 4. Summarize as a compact table.
21
+ 5. End with one recommended service/action/model triple when the user wants to generate.
22
+
23
+ ## Rules
24
+
25
+ - Do not quote stale prices.
26
+ - Do not mention hidden infrastructure providers.
27
+ - Do not overwhelm the user with the whole catalog unless they ask.
28
+ - Keep model slugs exactly as returned by tools.