@runapi.ai/midjourney-mcp 0.1.0
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 +201 -0
- package/README.md +167 -0
- package/data/contract.json +139 -0
- package/data/pricing.json +19 -0
- package/dist/bin/midjourney-mcp.d.ts +2 -0
- package/dist/bin/midjourney-mcp.js +3 -0
- package/dist/bin/midjourney-mcp.js.map +1 -0
- package/dist/src/data.d.ts +3 -0
- package/dist/src/data.js +22 -0
- package/dist/src/data.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/meta.d.ts +5 -0
- package/dist/src/meta.js +6 -0
- package/dist/src/meta.js.map +1 -0
- package/dist/src/server.d.ts +2 -0
- package/dist/src/server.js +178 -0
- package/dist/src/server.js.map +1 -0
- package/examples/claude.mcp.json +11 -0
- package/examples/cursor.mcp.json +11 -0
- package/examples/roo.mcp.json +11 -0
- package/examples/vscode.mcp.json +12 -0
- package/examples/windsurf.mcp.json +11 -0
- package/package.json +76 -0
- package/server.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<h1 align="center">RunAPI Midjourney MCP Server</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Midjourney API access for AI agents: run image and video generation operations, poll asynchronous results, and check pricing through one focused MCP server.</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<sub>Works with Claude Code, Codex, Cursor, Windsurf, VS Code, Roo Code, and any MCP-compatible host.</sub>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@runapi.ai/midjourney-mcp"><img src="https://img.shields.io/npm/v/%40runapi.ai/midjourney-mcp?style=flat-square&color=blue" alt="npm version"></a>
|
|
13
|
+
<a href="https://github.com/runapi-ai/midjourney-mcp"><img src="https://img.shields.io/badge/GitHub-runapi--ai%2Fmidjourney--mcp-24292f?style=flat-square" alt="GitHub repository"></a>
|
|
14
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-blue?style=flat-square" alt="Apache-2.0 license"></a>
|
|
15
|
+
<img src="https://img.shields.io/badge/Type-MCP_Server-blue?style=flat-square" alt="MCP Server">
|
|
16
|
+
<img src="https://img.shields.io/badge/Models-3-16a34a?style=flat-square" alt="3 models">
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="#install">Install</a> |
|
|
21
|
+
<a href="#tools">Tools</a> |
|
|
22
|
+
<a href="#models">Models</a> |
|
|
23
|
+
<a href="#agent-prompts">Agent Prompts</a> |
|
|
24
|
+
<a href="#configuration">Configuration</a> |
|
|
25
|
+
<a href="#links">Links</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Why This Package?
|
|
31
|
+
|
|
32
|
+
`@runapi.ai/midjourney-mcp` is a focused Model Context Protocol server for the **Midjourney** model line on RunAPI.
|
|
33
|
+
It gives MCP-compatible assistants direct access to 5 endpoints and 3 model variants without loading the full RunAPI catalog.
|
|
34
|
+
|
|
35
|
+
Use this per-model server when an agent should stay scoped to Midjourney. Use [`@runapi.ai/mcp`](https://github.com/runapi-ai/mcp) when one assistant should discover every RunAPI model line.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
Add it to Claude Code:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
claude mcp add midjourney -s user -- npx -y @runapi.ai/midjourney-mcp
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Use project scope when the server should be shared with a repository:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
claude mcp add midjourney -s project -- npx -y @runapi.ai/midjourney-mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Codex, Cursor, Windsurf, VS Code, Roo Code, and other MCP hosts can use the same stdio command:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"mcpServers": {
|
|
58
|
+
"midjourney": {
|
|
59
|
+
"command": "npx",
|
|
60
|
+
"args": ["-y", "@runapi.ai/midjourney-mcp"]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`check_pricing` works before sign-in. For task creation and status polling, ask your assistant to call the `login` tool. It opens a browser login and saves credentials to `~/.config/runapi/config.json`, the same file used by `runapi login`.
|
|
67
|
+
Headless and CI hosts can still set `RUNAPI_API_KEY` before starting the MCP host.
|
|
68
|
+
|
|
69
|
+
Ready-made examples are in [`examples/`](examples/) for Claude, Cursor, Windsurf, VS Code, and Roo Code.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Tools
|
|
74
|
+
|
|
75
|
+
| Tool | Auth | Purpose |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `edit_image` | Yes | Create a Midjourney edit image task and optionally wait for a terminal status. Returns the task id, status, output URLs, and pricing snapshot. |
|
|
78
|
+
| `get_seed` | Yes | Run a Midjourney get seed operation synchronously. Returns the operation result and pricing snapshot. |
|
|
79
|
+
| `image_to_prompt` | Yes | Run a Midjourney image to prompt operation synchronously. Returns the operation result and pricing snapshot. |
|
|
80
|
+
| `image_to_video` | Yes | Create a Midjourney image to video task and optionally wait for a terminal status. Returns the task id, status, output URLs, and pricing snapshot. |
|
|
81
|
+
| `text_to_image` | Yes | Create a Midjourney text to image task and optionally wait for a terminal status. Returns the task id, status, output URLs, and pricing snapshot. |
|
|
82
|
+
| `get_task` | Yes | Fetch the current status and latest payload for an existing task. |
|
|
83
|
+
| `check_pricing` | No | Look up the current pricing snapshot for a Midjourney model and endpoint. |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Models
|
|
88
|
+
|
|
89
|
+
Midjourney covers 3 model variants across 5 endpoints. Each tool accepts the models listed for it:
|
|
90
|
+
|
|
91
|
+
| Tool | Models |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `edit_image` | `midjourney-edit-image` |
|
|
94
|
+
| `get_seed` | _no model parameter_ |
|
|
95
|
+
| `image_to_prompt` | _no model parameter_ |
|
|
96
|
+
| `image_to_video` | `midjourney-image-to-video` |
|
|
97
|
+
| `text_to_image` | `midjourney-v8.1` |
|
|
98
|
+
|
|
99
|
+
Model availability can change between releases. Use `check_pricing` or the [Midjourney model page](https://runapi.ai/models/midjourney) for the current catalog view.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Agent Prompts
|
|
104
|
+
|
|
105
|
+
Ask your assistant in natural language; it can inspect pricing, create the task, and return the task id plus output URLs.
|
|
106
|
+
|
|
107
|
+
### Create a task
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
Run a Midjourney edit image task with RunAPI.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The assistant can call `check_pricing`, then `edit_image`, and return the task id, status, and output URLs.
|
|
114
|
+
|
|
115
|
+
### Submit without waiting
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
Create the task but don't wait for it to finish.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The assistant calls the create tool with `wait: false` and returns the task id. Check on it later with `get_task`.
|
|
122
|
+
|
|
123
|
+
### Check pricing before creating
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
Check current Midjourney pricing, then create the task if it matches my request.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The assistant calls `check_pricing` and can link to the [Midjourney model page](https://runapi.ai/models/midjourney) for the canonical catalog entry.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Configuration
|
|
134
|
+
|
|
135
|
+
The server resolves auth in this order:
|
|
136
|
+
|
|
137
|
+
1. `RUNAPI_API_KEY` environment variable, useful for headless and CI hosts
|
|
138
|
+
2. `~/.config/runapi/config.json`, created by the MCP `login` tool or `runapi login`
|
|
139
|
+
3. No key, which still allows `check_pricing`
|
|
140
|
+
|
|
141
|
+
The config file is normally managed by login. A pre-provisioned headless config can use:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"apiKey": "your_runapi_key"
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Do not commit real API keys.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Links
|
|
154
|
+
|
|
155
|
+
| Resource | URL |
|
|
156
|
+
|---|---|
|
|
157
|
+
| Midjourney model page | [https://runapi.ai/models/midjourney](https://runapi.ai/models/midjourney) |
|
|
158
|
+
| npm package | [@runapi.ai/midjourney-mcp](https://www.npmjs.com/package/@runapi.ai/midjourney-mcp) |
|
|
159
|
+
| GitHub repository | [runapi-ai/midjourney-mcp](https://github.com/runapi-ai/midjourney-mcp) |
|
|
160
|
+
| RunAPI MCP overview | [runapi.ai/mcp](https://runapi.ai/mcp) |
|
|
161
|
+
| RunAPI docs | [runapi.ai/docs](https://runapi.ai/docs) |
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
Licensed under the [Apache License, Version 2.0](LICENSE).
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
{
|
|
2
|
+
"catalog_models": [
|
|
3
|
+
"midjourney-edit-image",
|
|
4
|
+
"midjourney-image-to-video",
|
|
5
|
+
"midjourney-v8.1"
|
|
6
|
+
],
|
|
7
|
+
"actions": {
|
|
8
|
+
"midjourney/edit-image": {
|
|
9
|
+
"model": "Midjourney",
|
|
10
|
+
"endpoint": "edit_image",
|
|
11
|
+
"task_type": "asynchronous",
|
|
12
|
+
"models": [
|
|
13
|
+
"midjourney-edit-image"
|
|
14
|
+
],
|
|
15
|
+
"fields_by_model": {
|
|
16
|
+
"midjourney-edit-image": {
|
|
17
|
+
"model": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"prompt": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"required": true
|
|
23
|
+
},
|
|
24
|
+
"source_image_url": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"required": true
|
|
27
|
+
},
|
|
28
|
+
"mask_url": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"include_split_images": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"default": false
|
|
34
|
+
},
|
|
35
|
+
"callback_url": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"midjourney/get-seed": {
|
|
42
|
+
"model": "Midjourney",
|
|
43
|
+
"endpoint": "get_seed",
|
|
44
|
+
"task_type": "synchronous",
|
|
45
|
+
"models": [],
|
|
46
|
+
"fields_by_model": {
|
|
47
|
+
"_": {
|
|
48
|
+
"image_id": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"required": true
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"midjourney/image-to-prompt": {
|
|
56
|
+
"model": "Midjourney",
|
|
57
|
+
"endpoint": "image_to_prompt",
|
|
58
|
+
"task_type": "synchronous",
|
|
59
|
+
"models": [],
|
|
60
|
+
"fields_by_model": {
|
|
61
|
+
"_": {
|
|
62
|
+
"source_image_url": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"required": true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"midjourney/image-to-video": {
|
|
70
|
+
"model": "Midjourney",
|
|
71
|
+
"endpoint": "image_to_video",
|
|
72
|
+
"task_type": "asynchronous",
|
|
73
|
+
"models": [
|
|
74
|
+
"midjourney-image-to-video"
|
|
75
|
+
],
|
|
76
|
+
"fields_by_model": {
|
|
77
|
+
"midjourney-image-to-video": {
|
|
78
|
+
"model": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"prompt": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
"source_image_url": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"required": true
|
|
87
|
+
},
|
|
88
|
+
"last_frame_image_url": {
|
|
89
|
+
"type": "string"
|
|
90
|
+
},
|
|
91
|
+
"output_resolution": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"enum": [
|
|
94
|
+
"480p"
|
|
95
|
+
],
|
|
96
|
+
"default": "480p"
|
|
97
|
+
},
|
|
98
|
+
"enable_loop": {
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"default": false
|
|
101
|
+
},
|
|
102
|
+
"callback_url": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"midjourney/text-to-image": {
|
|
109
|
+
"model": "Midjourney",
|
|
110
|
+
"endpoint": "text_to_image",
|
|
111
|
+
"task_type": "asynchronous",
|
|
112
|
+
"models": [
|
|
113
|
+
"midjourney-v8.1"
|
|
114
|
+
],
|
|
115
|
+
"fields_by_model": {
|
|
116
|
+
"midjourney-v8.1": {
|
|
117
|
+
"model": {
|
|
118
|
+
"type": "string"
|
|
119
|
+
},
|
|
120
|
+
"prompt": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"required": true
|
|
123
|
+
},
|
|
124
|
+
"enable_prompt_translation": {
|
|
125
|
+
"type": "boolean",
|
|
126
|
+
"default": false
|
|
127
|
+
},
|
|
128
|
+
"include_split_images": {
|
|
129
|
+
"type": "boolean",
|
|
130
|
+
"default": false
|
|
131
|
+
},
|
|
132
|
+
"callback_url": {
|
|
133
|
+
"type": "string"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"endpoints": {
|
|
3
|
+
"midjourney-edit-image/edit_image": {
|
|
4
|
+
"unit_price_cents": 8
|
|
5
|
+
},
|
|
6
|
+
"midjourney-image-to-video/image_to_video": {
|
|
7
|
+
"unit_price_cents": 62
|
|
8
|
+
},
|
|
9
|
+
"midjourney-v8.1/text_to_image": {
|
|
10
|
+
"unit_price_cents": 6
|
|
11
|
+
},
|
|
12
|
+
"_/get_seed": {
|
|
13
|
+
"unit_price_cents": 0
|
|
14
|
+
},
|
|
15
|
+
"_/image_to_prompt": {
|
|
16
|
+
"unit_price_cents": 6
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"midjourney-mcp.js","sourceRoot":"","sources":["../../bin/midjourney-mcp.ts"],"names":[],"mappings":";AACA,OAAO,iBAAiB,CAAC"}
|
package/dist/src/data.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
function dataRoot() {
|
|
5
|
+
const current = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const candidates = [
|
|
7
|
+
path.resolve(current, "..", "..", "data"),
|
|
8
|
+
path.resolve(current, "..", "data")
|
|
9
|
+
];
|
|
10
|
+
const root = candidates.find((candidate) => existsSync(path.join(candidate, "contract.json")));
|
|
11
|
+
if (!root) {
|
|
12
|
+
throw new Error("Unable to locate the embedded RunAPI data directory.");
|
|
13
|
+
}
|
|
14
|
+
return root;
|
|
15
|
+
}
|
|
16
|
+
export function readContract() {
|
|
17
|
+
return JSON.parse(readFileSync(path.join(dataRoot(), "contract.json"), "utf8"));
|
|
18
|
+
}
|
|
19
|
+
export function readPricing() {
|
|
20
|
+
return JSON.parse(readFileSync(path.join(dataRoot(), "pricing.json"), "utf8"));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,SAAS,QAAQ;IACf,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC;KACpC,CAAC;IAEF,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAC/F,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,eAAe,CAAC,EAAE,MAAM,CAAC,CAAa,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAkB,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { createServer } from "./server.js";
|
|
4
|
+
const server = createServer();
|
|
5
|
+
await server.connect(new StdioServerTransport());
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;AAC9B,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC"}
|
package/dist/src/meta.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/meta.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,YAAY;CACd,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createModelServer, declaredFieldsForAction, findModelForAction, findModels, friendlyError, jsonText, priceForModel, RunApiClient, taskStatus, validateInputRules, validateParams, zodShapeForFields } from "@runapi.ai/mcp-core";
|
|
3
|
+
import { readContract, readPricing } from "./data.js";
|
|
4
|
+
import { META } from "./meta.js";
|
|
5
|
+
function taskType(action) {
|
|
6
|
+
return action.task_type ?? "asynchronous";
|
|
7
|
+
}
|
|
8
|
+
function lineService(contract) {
|
|
9
|
+
return Object.keys(contract.actions)[0]?.split("/")[0] ?? META.lineSlug;
|
|
10
|
+
}
|
|
11
|
+
function lineEndpoints(contract, filter) {
|
|
12
|
+
const seen = new Set();
|
|
13
|
+
for (const action of Object.values(contract.actions)) {
|
|
14
|
+
if (filter && taskType(action) !== filter) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
seen.add(action.endpoint);
|
|
18
|
+
}
|
|
19
|
+
return [...seen];
|
|
20
|
+
}
|
|
21
|
+
function lineModels(contract) {
|
|
22
|
+
const seen = new Set();
|
|
23
|
+
for (const action of Object.values(contract.actions)) {
|
|
24
|
+
for (const model of action.models) {
|
|
25
|
+
seen.add(model);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return [...seen];
|
|
29
|
+
}
|
|
30
|
+
function rulesForAction(action) {
|
|
31
|
+
return action.rules ?? [];
|
|
32
|
+
}
|
|
33
|
+
function buildTools(contract) {
|
|
34
|
+
const tools = [];
|
|
35
|
+
const inputRules = {};
|
|
36
|
+
for (const [key, action] of Object.entries(contract.actions)) {
|
|
37
|
+
if (taskType(action) === "synchronous") {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const service = key.split("/")[0];
|
|
41
|
+
const endpoint = action.endpoint;
|
|
42
|
+
tools.push({
|
|
43
|
+
name: endpoint,
|
|
44
|
+
description: `Create a ${action.model} task on RunAPI (${endpoint.replace(/_/g, " ")}). Returns a task id, status, and output URLs.`,
|
|
45
|
+
service,
|
|
46
|
+
action: endpoint,
|
|
47
|
+
models: action.models
|
|
48
|
+
});
|
|
49
|
+
inputRules[endpoint] = rulesForAction(action);
|
|
50
|
+
}
|
|
51
|
+
return { tools, inputRules };
|
|
52
|
+
}
|
|
53
|
+
function registerSynchronousTools(server, contract, pricing, client) {
|
|
54
|
+
for (const [key, action] of Object.entries(contract.actions)) {
|
|
55
|
+
if (taskType(action) !== "synchronous") {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const service = key.split("/")[0];
|
|
59
|
+
const endpoint = action.endpoint;
|
|
60
|
+
const shape = zodShapeForFields(declaredFieldsForAction(action));
|
|
61
|
+
if (action.models.length > 0) {
|
|
62
|
+
shape.model = z.enum(action.models).optional().describe("RunAPI model slug for this model line.");
|
|
63
|
+
}
|
|
64
|
+
server.tool(endpoint, `Run a synchronous ${action.model} operation on RunAPI (${endpoint.replace(/_/g, " ")}). Returns the operation result and pricing snapshot.`, shape, async (args) => {
|
|
65
|
+
const { model, ...params } = args;
|
|
66
|
+
try {
|
|
67
|
+
const info = findModelForAction(service, endpoint, model, contract);
|
|
68
|
+
if (!info) {
|
|
69
|
+
return jsonText({
|
|
70
|
+
error: "Unsupported RunAPI service/action/model combination.",
|
|
71
|
+
hint: "This model server was generated for a specific model line; verify the requested model."
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const body = validateParams(info.fields, {
|
|
75
|
+
...params,
|
|
76
|
+
...(info.model ? { model: info.model } : {})
|
|
77
|
+
});
|
|
78
|
+
const ruleError = validateInputRules(action.rules ?? [], body);
|
|
79
|
+
if (ruleError) {
|
|
80
|
+
return jsonText({
|
|
81
|
+
error: `Invalid RunAPI parameters: ${ruleError}`,
|
|
82
|
+
hint: "Adjust the parameters to satisfy the endpoint input rules before retrying."
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const result = await client.createTask(service, endpoint, body);
|
|
86
|
+
return jsonText({ result, price: priceForModel(info, pricing) });
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
return jsonText({ error: friendlyError(error) });
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function registerLineTools(server, contract, pricing, client) {
|
|
95
|
+
const service = lineService(contract);
|
|
96
|
+
const endpoints = lineEndpoints(contract);
|
|
97
|
+
const asynchronousEndpoints = lineEndpoints(contract, "asynchronous");
|
|
98
|
+
const models = lineModels(contract);
|
|
99
|
+
const endpointEnum = endpoints.length > 0 ? z.enum(endpoints) : z.string();
|
|
100
|
+
const modelEnum = models.length > 0 ? z.enum(models) : z.string();
|
|
101
|
+
if (asynchronousEndpoints.length > 0) {
|
|
102
|
+
const asynchronousEndpointEnum = z.enum(asynchronousEndpoints);
|
|
103
|
+
// With one endpoint, action defaults safely. With several, a wrong default
|
|
104
|
+
// would query the wrong task route, so the caller must name the endpoint.
|
|
105
|
+
const getTaskAction = asynchronousEndpoints.length > 1
|
|
106
|
+
? asynchronousEndpointEnum.describe("Asynchronous endpoint the task was created on.")
|
|
107
|
+
: asynchronousEndpointEnum.optional().describe("Asynchronous endpoint the task was created on. Defaults to the line's only asynchronous endpoint.");
|
|
108
|
+
server.tool("get_task", `Fetch the current status and latest result payload for a ${META.lineSlug} task.`, {
|
|
109
|
+
task_id: z.string().describe("Task id returned when the task was created."),
|
|
110
|
+
action: getTaskAction
|
|
111
|
+
}, async ({ task_id, action }) => {
|
|
112
|
+
try {
|
|
113
|
+
const task = await client.getTask(service, task_id, action ?? asynchronousEndpoints[0]);
|
|
114
|
+
return jsonText({ task_id, status: taskStatus(task), task });
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
return jsonText({ error: friendlyError(error) });
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
server.tool("check_pricing", `Look up RunAPI pricing for the ${META.lineSlug} model line.`, {
|
|
122
|
+
model: modelEnum.optional().describe("Model slug. Defaults to the line's primary model."),
|
|
123
|
+
action: endpointEnum.optional().describe("Endpoint name. Defaults to the endpoint that offers the model.")
|
|
124
|
+
}, async ({ model, action }) => {
|
|
125
|
+
const noMatch = { supported: false, message: "No matching model/endpoint in this model line." };
|
|
126
|
+
// Explicit endpoint: price exactly that model on that endpoint.
|
|
127
|
+
if (action) {
|
|
128
|
+
const info = findModelForAction(service, action, model, contract);
|
|
129
|
+
return info
|
|
130
|
+
? jsonText({ supported: true, model: info.model, service: info.service, action: info.action, price: priceForModel(info, pricing) })
|
|
131
|
+
: jsonText(noMatch);
|
|
132
|
+
}
|
|
133
|
+
// No endpoint and no model: price the line's primary model/endpoint.
|
|
134
|
+
if (!model) {
|
|
135
|
+
const info = findModelForAction(service, endpoints[0], undefined, contract);
|
|
136
|
+
return info
|
|
137
|
+
? jsonText({ supported: true, model: info.model, service: info.service, action: info.action, price: priceForModel(info, pricing) })
|
|
138
|
+
: jsonText(noMatch);
|
|
139
|
+
}
|
|
140
|
+
// No endpoint named: a model may be offered on several endpoints at
|
|
141
|
+
// different prices, so report every endpoint that offers it rather than
|
|
142
|
+
// silently pricing only the first one found.
|
|
143
|
+
const matches = findModels(model, contract);
|
|
144
|
+
if (matches.length === 0) {
|
|
145
|
+
return jsonText(noMatch);
|
|
146
|
+
}
|
|
147
|
+
if (matches.length === 1) {
|
|
148
|
+
const info = matches[0];
|
|
149
|
+
return jsonText({ supported: true, model: info.model, service: info.service, action: info.action, price: priceForModel(info, pricing) });
|
|
150
|
+
}
|
|
151
|
+
return jsonText({
|
|
152
|
+
supported: true,
|
|
153
|
+
model: matches[0].model,
|
|
154
|
+
service: matches[0].service,
|
|
155
|
+
endpoints: matches.map((info) => ({ action: info.action, price: priceForModel(info, pricing) }))
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export function createServer() {
|
|
160
|
+
const contract = readContract();
|
|
161
|
+
const pricing = readPricing();
|
|
162
|
+
const { tools, inputRules } = buildTools(contract);
|
|
163
|
+
const client = new RunApiClient();
|
|
164
|
+
const server = createModelServer({
|
|
165
|
+
name: META.name,
|
|
166
|
+
version: META.version,
|
|
167
|
+
lineSlug: META.lineSlug,
|
|
168
|
+
contract,
|
|
169
|
+
pricing,
|
|
170
|
+
inputRules,
|
|
171
|
+
tools,
|
|
172
|
+
client
|
|
173
|
+
});
|
|
174
|
+
registerSynchronousTools(server, contract, pricing, client);
|
|
175
|
+
registerLineTools(server, contract, pricing, client);
|
|
176
|
+
return server;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EAMlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMjC,SAAS,QAAQ,CAAC,MAAsB;IACtC,OAAQ,MAAgC,CAAC,SAAS,IAAI,cAAc,CAAC;AACvE,CAAC;AAED,SAAS,WAAW,CAAC,QAAkB;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC;AAC1E,CAAC;AAED,SAAS,aAAa,CAAC,QAAkB,EAAE,MAAuC;IAChF,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACrD,IAAI,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC;YAC1C,SAAS;QACX,CAAC;QACD,IAAI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C,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAElC,MAAM,MAAM,GAAG,iBAAiB,CAAC;QAC/B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ;QACR,OAAO;QACP,UAAU;QACV,KAAK;QACL,MAAM;KACP,CAAC,CAAC;IAEH,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@runapi.ai/midjourney-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "RunAPI Midjourney MCP server for image and video generation: create tasks, poll results, and check pricing across 3 model variants from Claude Code, Codex, Cursor, and VS Code.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"midjourney-mcp": "dist/bin/midjourney-mcp.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"data/contract.json",
|
|
13
|
+
"data/pricing.json",
|
|
14
|
+
"examples",
|
|
15
|
+
"server.json",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"dev": "tsx src/index.ts",
|
|
22
|
+
"prepack": "npm run build",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"test": "vitest run"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"runapi",
|
|
28
|
+
"runapi-ai",
|
|
29
|
+
"mcp",
|
|
30
|
+
"mcp-server",
|
|
31
|
+
"model-context-protocol",
|
|
32
|
+
"ai-agents",
|
|
33
|
+
"claude-code",
|
|
34
|
+
"cursor",
|
|
35
|
+
"vscode",
|
|
36
|
+
"midjourney",
|
|
37
|
+
"midjourney-mcp",
|
|
38
|
+
"midjourney-api",
|
|
39
|
+
"video-generation",
|
|
40
|
+
"ai-video",
|
|
41
|
+
"image-generation",
|
|
42
|
+
"ai-image",
|
|
43
|
+
"edit-image",
|
|
44
|
+
"get-seed",
|
|
45
|
+
"image-to-prompt",
|
|
46
|
+
"image-to-video"
|
|
47
|
+
],
|
|
48
|
+
"author": "RunAPI",
|
|
49
|
+
"license": "Apache-2.0",
|
|
50
|
+
"homepage": "https://runapi.ai/models/midjourney",
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/runapi-ai/midjourney-mcp.git"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/runapi-ai/midjourney-mcp/issues"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=22.0.0"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
63
|
+
"@runapi.ai/mcp-core": "0.1.6",
|
|
64
|
+
"zod": "^3.25.76"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@types/node": "^24.10.1",
|
|
68
|
+
"tsx": "^4.20.6",
|
|
69
|
+
"typescript": "^5.9.3",
|
|
70
|
+
"vitest": "^4.0.14"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public"
|
|
74
|
+
},
|
|
75
|
+
"mcpName": "io.github.runapi-builder/midjourney-mcp"
|
|
76
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.runapi-builder/midjourney-mcp",
|
|
4
|
+
"description": "RunAPI MCP server for Midjourney: create tasks, poll status, check pricing.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/runapi-ai/midjourney-mcp",
|
|
7
|
+
"source": "github"
|
|
8
|
+
},
|
|
9
|
+
"version": "0.1.0",
|
|
10
|
+
"packages": [
|
|
11
|
+
{
|
|
12
|
+
"registryType": "npm",
|
|
13
|
+
"identifier": "@runapi.ai/midjourney-mcp",
|
|
14
|
+
"version": "0.1.0",
|
|
15
|
+
"transport": {
|
|
16
|
+
"type": "stdio"
|
|
17
|
+
},
|
|
18
|
+
"environmentVariables": [
|
|
19
|
+
{
|
|
20
|
+
"description": "Optional RunAPI API key for headless hosts. Interactive MCP hosts can use the login tool, which writes shared RunAPI config.",
|
|
21
|
+
"isRequired": false,
|
|
22
|
+
"format": "string",
|
|
23
|
+
"isSecret": true,
|
|
24
|
+
"name": "RUNAPI_API_KEY"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|