ue-mcp-tripo 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +85 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/cli.d.ts +52 -0
- package/dist/shared/cli.js +174 -0
- package/dist/shared/cli.js.map +1 -0
- package/dist/tasks/Cli.d.ts +18 -0
- package/dist/tasks/Cli.js +33 -0
- package/dist/tasks/Cli.js.map +1 -0
- package/dist/tasks/Generate.d.ts +57 -0
- package/dist/tasks/Generate.js +283 -0
- package/dist/tasks/Generate.js.map +1 -0
- package/knowledge/tripo.md +141 -0
- package/package.json +52 -4
- package/skills/cli/SKILL.md +146 -0
- package/ue-mcp.plugin.yml +101 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David Lyon
|
|
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
|
@@ -1,3 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ue-mcp-tripo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A [ue-mcp](https://github.com/db-lyon/ue-mcp) plugin that brings [Tripo](https://www.tripo3d.ai) into Unreal Engine through Tripo's own command-line tool, [tripo-cli](https://www.npmjs.com/package/tripo-cli). One call turns a prompt or an image into a rigged, textured skeletal mesh with Unreal Mannequin bone names, and every other CLI command is available through a passthrough.
|
|
4
|
+
|
|
5
|
+
The plugin pins an exact tripo-cli version as a dependency and runs it from its own `node_modules`, so there is nothing else to install.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- ue-mcp 1.4.16-beta.10 or later
|
|
10
|
+
- A Tripo account with credits
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
ue-mcp plugin install tripo
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Sign in through the CLI's device login, which works without a terminal. It prints a URL and a one-time code; authorize in the browser, then run the same call again to finish:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
tripo(action="cli", args=["login", "--region", "ov", "--no-wait"])
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use `--region cn` for an account on the China site. Setting `TRIPO_API_KEY` in the ue-mcp server environment works too, and takes priority over a stored login. Confirm the key, network and balance with:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
tripo(action="cli", args=["doctor"])
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Generate
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
tripo(action="generate", prompt="a stylized knight in plate armor", animation="idle")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This runs a single `tripo make` with Unreal defaults, writes its output to `<project>/Saved/Tripo/<name>`, and imports the model with ue-mcp's `asset(action="import_model")`. For the call above, the command is:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
tripo make "a stylized knight in plate armor" --for anim
|
|
40
|
+
--then "rig-check,rig:rig_type=biped,spec=unreal,retarget:animation=preset:idle,convert:fbx"
|
|
41
|
+
-p pbr=true -o <project>/Saved/Tripo/AStylizedKnightInPlateArmor --json --yes --no-open
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The result carries the Tripo task ids, the credits spent, the import result and the import's warnings.
|
|
45
|
+
|
|
46
|
+
| Option | Effect |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `prompt`, `images` or `task` | The input: text, one image or 2 to 4 views (absolute paths or URLs), or an existing task id to continue from. |
|
|
49
|
+
| `rig=false` | Uses `--for game-pc` and imports a static mesh. |
|
|
50
|
+
| `rigType` | `biped` (default, with `spec=unreal`), another body type, or `auto` to let rig-check decide. |
|
|
51
|
+
| `animation` | One preset animation, such as `walk`. |
|
|
52
|
+
| `format=glb` | Skips the FBX conversion. |
|
|
53
|
+
| `params`, `model`, `then` | Extra `-p key=value` pairs, a generation model, or a replacement `--then` chain. |
|
|
54
|
+
| `dryRun=true` | Returns the plan and the credit estimate without spending anything. |
|
|
55
|
+
| `place`, `location`, `destination`, `name`, ... | Passed to `asset(import_model)`. |
|
|
56
|
+
|
|
57
|
+
A full run takes a few minutes. The call waits up to `waitSec` (default 300); `wait=false` returns at once. If `make` is still running, the result is `status=pending` with a `jobDir`, and `tripo(action="generate", resume="<jobDir>")` waits for it and imports the model. The CLI keeps running on its own in the meantime.
|
|
58
|
+
|
|
59
|
+
A model file already on disk does not need Tripo at all: import it with `asset(action="import_model", filePath="...", kind="skeletal")`.
|
|
60
|
+
|
|
61
|
+
## Any other CLI command
|
|
62
|
+
|
|
63
|
+
`tripo(action="cli", args=[...])` runs the pinned CLI with the given arguments plus `--json --yes --no-open`, and returns the parsed JSON result. A failed command returns the CLI's error message and the end of its stderr.
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
tripo(action="cli", args=["balance"])
|
|
67
|
+
tripo(action="cli", args=["task", "get", "<task id>"])
|
|
68
|
+
tripo(action="cli", args=["anim", "retarget", "<task id>", "-p", "animation=preset:run"])
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Commands stop after `timeoutSec` (default 300). For long jobs, pass `--no-wait` and follow up with `["task", "watch", "<id>", "--download"]`.
|
|
72
|
+
|
|
73
|
+
Tripo's agent guide, generated from `tripo docs` of the pinned version, ships as the plugin's knowledge file and as a `tripo-cli` skill.
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install
|
|
79
|
+
npm run build # compiles, then generates knowledge/ and skills/ from `tripo docs`
|
|
80
|
+
npm run check # the manifest validates against the ue-mcp loader; every task resolves
|
|
81
|
+
npm test # both actions against a fake CLI, plus offline dry runs of the real one
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package entry for ue-mcp-tripo.
|
|
3
|
+
*
|
|
4
|
+
* ue-mcp loads task classes by `class_path` from the manifest, so this file is
|
|
5
|
+
* not on the load path. It gives consumers a typed import surface.
|
|
6
|
+
*/
|
|
7
|
+
export { default as Generate, makeArgs, chainFor } from "./tasks/Generate.js";
|
|
8
|
+
export { default as Cli } from "./tasks/Cli.js";
|
|
9
|
+
export { cliPath, cliVersion, runCli, withAddedFlags, ADDED_FLAGS } from "./shared/cli.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package entry for ue-mcp-tripo.
|
|
3
|
+
*
|
|
4
|
+
* ue-mcp loads task classes by `class_path` from the manifest, so this file is
|
|
5
|
+
* not on the load path. It gives consumers a typed import surface.
|
|
6
|
+
*/
|
|
7
|
+
export { default as Generate, makeArgs, chainFor } from "./tasks/Generate.js";
|
|
8
|
+
export { default as Cli } from "./tasks/Cli.js";
|
|
9
|
+
export { cliPath, cliVersion, runCli, withAddedFlags, ADDED_FLAGS } from "./shared/cli.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs the tripo-cli binary this package pins.
|
|
3
|
+
*
|
|
4
|
+
* The binary is resolved from the plugin's own node_modules and started with
|
|
5
|
+
* the server's own Node (process.execPath): no global install, no npx, no
|
|
6
|
+
* shell. UE_MCP_TRIPO_CLI points at another script, which the tests use for a
|
|
7
|
+
* fake CLI.
|
|
8
|
+
*/
|
|
9
|
+
import { type ChildProcess } from "node:child_process";
|
|
10
|
+
/** Flags the plugin adds to every command unless the caller already passed them. */
|
|
11
|
+
export declare const ADDED_FLAGS: readonly ["--json", "--yes", "--no-open"];
|
|
12
|
+
export declare function cliPath(): string;
|
|
13
|
+
/** The pinned tripo-cli version, or null when it cannot be read (an override path). */
|
|
14
|
+
export declare function cliVersion(): string | null;
|
|
15
|
+
/** Append --json, --yes and --no-open, skipping any the caller already passed. */
|
|
16
|
+
export declare function withAddedFlags(args: string[]): string[];
|
|
17
|
+
export declare function refusal(args: string[]): string | null;
|
|
18
|
+
export interface CliResult {
|
|
19
|
+
exitCode: number | null;
|
|
20
|
+
stdout: string;
|
|
21
|
+
stderr: string;
|
|
22
|
+
/** stdout parsed as JSON, or undefined when it is not JSON (docs, completion). */
|
|
23
|
+
json?: unknown;
|
|
24
|
+
timedOut: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Parse the last non-empty stdout line as JSON; the CLI prints exactly one result line. */
|
|
27
|
+
export declare function parseJsonLine(stdout: string): unknown;
|
|
28
|
+
export declare function tail(text: string, lines?: number): string;
|
|
29
|
+
export declare function stripAnsi(text: string): string;
|
|
30
|
+
/** Run the CLI to completion (or until the timeout), capturing stdout and stderr. */
|
|
31
|
+
export declare function runCli(args: string[], opts?: {
|
|
32
|
+
cwd?: string;
|
|
33
|
+
timeoutMs?: number;
|
|
34
|
+
}): Promise<CliResult>;
|
|
35
|
+
/** Message for a failed run: the CLI's own error JSON, its suggestion, and a stderr tail. */
|
|
36
|
+
export declare function failureMessage(args: string[], r: CliResult, timeoutMs?: number): string;
|
|
37
|
+
/**
|
|
38
|
+
* Start the CLI detached, with stdout and stderr going to files, so it keeps
|
|
39
|
+
* running when the MCP call (or the server) goes away.
|
|
40
|
+
*/
|
|
41
|
+
export declare function startDetached(args: string[], opts: {
|
|
42
|
+
cwd?: string;
|
|
43
|
+
stdoutFile: string;
|
|
44
|
+
stderrFile: string;
|
|
45
|
+
}): ChildProcess;
|
|
46
|
+
/**
|
|
47
|
+
* Where the CLI runs: <project>/Saved/Tripo, so its `.tripo` directory
|
|
48
|
+
* context and default output stay out of the project root and `@last`
|
|
49
|
+
* resolves the same way for every call. Without a project, a temp folder.
|
|
50
|
+
*/
|
|
51
|
+
export declare function workDir(projectDir: string | null | undefined): string;
|
|
52
|
+
export declare function isAlive(pid: number | undefined): boolean;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs the tripo-cli binary this package pins.
|
|
3
|
+
*
|
|
4
|
+
* The binary is resolved from the plugin's own node_modules and started with
|
|
5
|
+
* the server's own Node (process.execPath): no global install, no npx, no
|
|
6
|
+
* shell. UE_MCP_TRIPO_CLI points at another script, which the tests use for a
|
|
7
|
+
* fake CLI.
|
|
8
|
+
*/
|
|
9
|
+
import { spawn } from "node:child_process";
|
|
10
|
+
import { closeSync, mkdirSync, openSync } from "node:fs";
|
|
11
|
+
import { createRequire } from "node:module";
|
|
12
|
+
import { tmpdir } from "node:os";
|
|
13
|
+
import { dirname, join } from "node:path";
|
|
14
|
+
/** Flags the plugin adds to every command unless the caller already passed them. */
|
|
15
|
+
export const ADDED_FLAGS = ["--json", "--yes", "--no-open"];
|
|
16
|
+
/** Commands the passthrough refuses, with the way to get the same result. */
|
|
17
|
+
const REFUSED = {
|
|
18
|
+
mcp: "`tripo mcp` starts a stdio server that never exits. Run the individual commands through tripo(action=\"cli\") instead.",
|
|
19
|
+
update: "`tripo update` installs tripo-cli globally, which this plugin does not use. Update the plugin instead: ue-mcp plugin update tripo.",
|
|
20
|
+
};
|
|
21
|
+
export function cliPath() {
|
|
22
|
+
const override = process.env.UE_MCP_TRIPO_CLI;
|
|
23
|
+
if (override)
|
|
24
|
+
return override;
|
|
25
|
+
const require = createRequire(import.meta.url);
|
|
26
|
+
const pkgPath = require.resolve("tripo-cli/package.json");
|
|
27
|
+
const pkg = require(pkgPath);
|
|
28
|
+
const bin = typeof pkg.bin === "string" ? pkg.bin : pkg.bin?.tripo;
|
|
29
|
+
if (!bin)
|
|
30
|
+
throw new Error(`tripo-cli at ${dirname(pkgPath)} declares no "tripo" bin.`);
|
|
31
|
+
return join(dirname(pkgPath), bin);
|
|
32
|
+
}
|
|
33
|
+
/** The pinned tripo-cli version, or null when it cannot be read (an override path). */
|
|
34
|
+
export function cliVersion() {
|
|
35
|
+
try {
|
|
36
|
+
const require = createRequire(import.meta.url);
|
|
37
|
+
return require("tripo-cli/package.json").version;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Append --json, --yes and --no-open, skipping any the caller already passed. */
|
|
44
|
+
export function withAddedFlags(args) {
|
|
45
|
+
const out = [...args];
|
|
46
|
+
for (const f of ADDED_FLAGS)
|
|
47
|
+
if (!out.includes(f))
|
|
48
|
+
out.push(f);
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
export function refusal(args) {
|
|
52
|
+
const command = args.find((a) => !a.startsWith("-"));
|
|
53
|
+
return command && REFUSED[command] ? REFUSED[command] : null;
|
|
54
|
+
}
|
|
55
|
+
/** Parse the last non-empty stdout line as JSON; the CLI prints exactly one result line. */
|
|
56
|
+
export function parseJsonLine(stdout) {
|
|
57
|
+
const text = stdout.trim();
|
|
58
|
+
if (!text)
|
|
59
|
+
return undefined;
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(text);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
const lines = text.split(/\r?\n/).filter((l) => l.trim());
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(lines[lines.length - 1]);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function tail(text, lines = 20) {
|
|
74
|
+
return text.split(/\r?\n/).filter((l) => l.trim()).slice(-lines).join("\n");
|
|
75
|
+
}
|
|
76
|
+
const ANSI = /\x1b\[[0-9;]*m/g;
|
|
77
|
+
export function stripAnsi(text) {
|
|
78
|
+
return text.replace(ANSI, "");
|
|
79
|
+
}
|
|
80
|
+
/** Run the CLI to completion (or until the timeout), capturing stdout and stderr. */
|
|
81
|
+
export function runCli(args, opts = {}) {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
const child = spawn(process.execPath, [cliPath(), ...args], {
|
|
84
|
+
cwd: opts.cwd,
|
|
85
|
+
env: process.env,
|
|
86
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
87
|
+
windowsHide: true,
|
|
88
|
+
});
|
|
89
|
+
let stdout = "";
|
|
90
|
+
let stderr = "";
|
|
91
|
+
let timedOut = false;
|
|
92
|
+
child.stdout.setEncoding("utf8").on("data", (d) => (stdout += d));
|
|
93
|
+
child.stderr.setEncoding("utf8").on("data", (d) => (stderr += d));
|
|
94
|
+
const timer = opts.timeoutMs
|
|
95
|
+
? setTimeout(() => {
|
|
96
|
+
timedOut = true;
|
|
97
|
+
child.kill();
|
|
98
|
+
}, opts.timeoutMs)
|
|
99
|
+
: undefined;
|
|
100
|
+
child.on("error", (e) => {
|
|
101
|
+
if (timer)
|
|
102
|
+
clearTimeout(timer);
|
|
103
|
+
reject(e);
|
|
104
|
+
});
|
|
105
|
+
child.on("close", (code) => {
|
|
106
|
+
if (timer)
|
|
107
|
+
clearTimeout(timer);
|
|
108
|
+
resolve({ exitCode: code, stdout, stderr: stripAnsi(stderr), json: parseJsonLine(stdout), timedOut });
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/** Message for a failed run: the CLI's own error JSON, its suggestion, and a stderr tail. */
|
|
113
|
+
export function failureMessage(args, r, timeoutMs) {
|
|
114
|
+
const j = (r.json ?? {});
|
|
115
|
+
const head = r.timedOut
|
|
116
|
+
? `tripo ${args[0] ?? ""} did not finish within ${Math.round((timeoutMs ?? 0) / 1000)}s and was stopped. ` +
|
|
117
|
+
`A task it already submitted keeps running on Tripo's side: find it with tripo(action="cli", args=["history"]), ` +
|
|
118
|
+
`or pass --no-wait and follow up with ["task","watch","<id>"].`
|
|
119
|
+
: `tripo ${args[0] ?? ""} exited ${r.exitCode}: ${j.error ?? "no error message"}`;
|
|
120
|
+
const parts = [head];
|
|
121
|
+
if (j.suggestion)
|
|
122
|
+
parts.push(`Suggestion: ${j.suggestion}`);
|
|
123
|
+
if (j.task_id)
|
|
124
|
+
parts.push(`Task: ${j.task_id}`);
|
|
125
|
+
const err = tail(r.stderr);
|
|
126
|
+
if (err)
|
|
127
|
+
parts.push(`stderr:\n${err}`);
|
|
128
|
+
return parts.join("\n");
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Start the CLI detached, with stdout and stderr going to files, so it keeps
|
|
132
|
+
* running when the MCP call (or the server) goes away.
|
|
133
|
+
*/
|
|
134
|
+
export function startDetached(args, opts) {
|
|
135
|
+
const out = openSync(opts.stdoutFile, "w");
|
|
136
|
+
const err = openSync(opts.stderrFile, "w");
|
|
137
|
+
try {
|
|
138
|
+
const child = spawn(process.execPath, [cliPath(), ...args], {
|
|
139
|
+
cwd: opts.cwd,
|
|
140
|
+
env: process.env,
|
|
141
|
+
stdio: ["ignore", out, err],
|
|
142
|
+
detached: true,
|
|
143
|
+
windowsHide: true,
|
|
144
|
+
});
|
|
145
|
+
child.unref();
|
|
146
|
+
return child;
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
closeSync(out);
|
|
150
|
+
closeSync(err);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Where the CLI runs: <project>/Saved/Tripo, so its `.tripo` directory
|
|
155
|
+
* context and default output stay out of the project root and `@last`
|
|
156
|
+
* resolves the same way for every call. Without a project, a temp folder.
|
|
157
|
+
*/
|
|
158
|
+
export function workDir(projectDir) {
|
|
159
|
+
const dir = projectDir ? join(projectDir, "Saved", "Tripo") : join(tmpdir(), "ue-mcp-tripo");
|
|
160
|
+
mkdirSync(dir, { recursive: true });
|
|
161
|
+
return dir;
|
|
162
|
+
}
|
|
163
|
+
export function isAlive(pid) {
|
|
164
|
+
if (!pid)
|
|
165
|
+
return false;
|
|
166
|
+
try {
|
|
167
|
+
process.kill(pid, 0);
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
return e.code === "EPERM";
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +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KAAK,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC;YAC3B,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,SAAS,CAAC,GAAG,CAAC,CAAC;QACf,SAAS,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,UAAqC;IAC3D,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC;IAC7F,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,GAAuB;IAC7C,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAQ,CAA2B,CAAC,IAAI,KAAK,OAAO,CAAC;IACvD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tripo.cli - run any tripo-cli command and return its JSON result.
|
|
3
|
+
*
|
|
4
|
+
* Adds --json --yes --no-open unless already present. The server's
|
|
5
|
+
* environment passes through, so TRIPO_API_KEY or a stored `tripo login`
|
|
6
|
+
* profile both work.
|
|
7
|
+
*/
|
|
8
|
+
import { UeMcpTask, type TaskResult } from "ue-mcp/task";
|
|
9
|
+
interface Options {
|
|
10
|
+
args?: string[];
|
|
11
|
+
timeoutSec?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const DEFAULT_CLI_TIMEOUT_SEC = 300;
|
|
14
|
+
export default class Cli extends UeMcpTask<Options> {
|
|
15
|
+
get taskName(): string;
|
|
16
|
+
execute(): Promise<TaskResult>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tripo.cli - run any tripo-cli command and return its JSON result.
|
|
3
|
+
*
|
|
4
|
+
* Adds --json --yes --no-open unless already present. The server's
|
|
5
|
+
* environment passes through, so TRIPO_API_KEY or a stored `tripo login`
|
|
6
|
+
* profile both work.
|
|
7
|
+
*/
|
|
8
|
+
import { UeMcpTask } from "ue-mcp/task";
|
|
9
|
+
import { failureMessage, refusal, runCli, withAddedFlags, workDir } from "../shared/cli.js";
|
|
10
|
+
export const DEFAULT_CLI_TIMEOUT_SEC = 300;
|
|
11
|
+
export default class Cli extends UeMcpTask {
|
|
12
|
+
get taskName() { return "tripo.cli"; }
|
|
13
|
+
async execute() {
|
|
14
|
+
const raw = this.options.args;
|
|
15
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
16
|
+
throw new Error('Pass args, the tripo command line as an array, e.g. args=["doctor"] or args=["balance"].');
|
|
17
|
+
}
|
|
18
|
+
const args = raw.map(String);
|
|
19
|
+
const refused = refusal(args);
|
|
20
|
+
if (refused)
|
|
21
|
+
throw new Error(refused);
|
|
22
|
+
const full = withAddedFlags(args);
|
|
23
|
+
const timeoutMs = (this.options.timeoutSec ?? DEFAULT_CLI_TIMEOUT_SEC) * 1000;
|
|
24
|
+
const r = await runCli(full, { cwd: workDir(this.ctx?.project?.projectDir), timeoutMs });
|
|
25
|
+
if (r.exitCode !== 0 || r.timedOut)
|
|
26
|
+
throw new Error(failureMessage(args, r, timeoutMs));
|
|
27
|
+
return {
|
|
28
|
+
success: true,
|
|
29
|
+
data: r.json !== undefined ? { args: full, result: r.json } : { args: full, output: r.st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AAU,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QACzF,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QAExF,OAAO;YACL,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;SACtG,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { UeMcpTask, type TaskResult } from "ue-mcp/task";
|
|
2
|
+
export interface Vec3 {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z: number;
|
|
6
|
+
}
|
|
7
|
+
interface Options {
|
|
8
|
+
prompt?: string;
|
|
9
|
+
images?: string[] | string;
|
|
10
|
+
task?: string;
|
|
11
|
+
rig?: boolean;
|
|
12
|
+
rigType?: string;
|
|
13
|
+
spec?: string;
|
|
14
|
+
animation?: string;
|
|
15
|
+
retexture?: boolean;
|
|
16
|
+
pbr?: boolean;
|
|
17
|
+
format?: "fbx" | "glb";
|
|
18
|
+
model?: string;
|
|
19
|
+
params?: string[];
|
|
20
|
+
then?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
wait?: boolean;
|
|
23
|
+
waitSec?: number;
|
|
24
|
+
dryRun?: boolean;
|
|
25
|
+
resume?: string;
|
|
26
|
+
destination?: string;
|
|
27
|
+
kind?: "auto" | "static" | "skeletal";
|
|
28
|
+
importMaterials?: boolean;
|
|
29
|
+
importTextures?: boolean;
|
|
30
|
+
importAnimations?: boolean;
|
|
31
|
+
createPhysicsAsset?: boolean;
|
|
32
|
+
nanite?: boolean;
|
|
33
|
+
place?: boolean;
|
|
34
|
+
location?: Vec3;
|
|
35
|
+
rotation?: Vec3 | {
|
|
36
|
+
pitch: number;
|
|
37
|
+
yaw: number;
|
|
38
|
+
roll: number;
|
|
39
|
+
};
|
|
40
|
+
onConflict?: string;
|
|
41
|
+
save?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare function sanitizeAssetName(raw: string): string;
|
|
44
|
+
/** "walk" -> "preset:walk"; anything already prefixed passes through. */
|
|
45
|
+
export declare function presetName(name: string): string;
|
|
46
|
+
/** The --then chain for these options, or "" when make needs none. */
|
|
47
|
+
export declare function chainFor(o: Options): string;
|
|
48
|
+
/** The full `tripo make` argument list generate runs. */
|
|
49
|
+
export declare function makeArgs(o: Options, outDir: string): string[];
|
|
50
|
+
export default class Generate extends UeMcpTask<Options> {
|
|
51
|
+
get taskName(): string;
|
|
52
|
+
execute(): Promise<TaskResult>;
|
|
53
|
+
private resume;
|
|
54
|
+
private pending;
|
|
55
|
+
private finish;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tripo.generate - prompt, image(s) or a task ref to an imported Unreal asset.
|
|
3
|
+
*
|
|
4
|
+
* Builds one `tripo make` command with Unreal defaults, runs it detached with
|
|
5
|
+
* its output under <project>/Saved/Tripo/<name>, and hands the downloaded
|
|
6
|
+
* model to core asset(import_model). When make outlasts the call's wait, the
|
|
7
|
+
* result is pending and `generate(resume=<jobDir>)` picks it up later; the
|
|
8
|
+
* CLI process keeps running on its own in the meantime.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { basename, extname, isAbsolute, join, resolve } from "node:path";
|
|
12
|
+
import { UeMcpTask } from "ue-mcp/task";
|
|
13
|
+
import { isAlive, parseJsonLine, runCli, startDetached, stripAnsi, tail, withAddedFlags, workDir, } from "../shared/cli.js";
|
|
14
|
+
/** Options passed through to asset(import_model) as given. */
|
|
15
|
+
const IMPORT_PASS = [
|
|
16
|
+
"importMaterials",
|
|
17
|
+
"importTextures",
|
|
18
|
+
"importAnimations",
|
|
19
|
+
"createPhysicsAsset",
|
|
20
|
+
"nanite",
|
|
21
|
+
"place",
|
|
22
|
+
"location",
|
|
23
|
+
"rotation",
|
|
24
|
+
"onConflict",
|
|
25
|
+
"save",
|
|
26
|
+
];
|
|
27
|
+
const DEFAULT_WAIT_SEC = 300;
|
|
28
|
+
const POLL_MS = 1000;
|
|
29
|
+
export function sanitizeAssetName(raw) {
|
|
30
|
+
const words = raw.replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
31
|
+
let out = words.map((w) => w[0].toUpperCase() + w.slice(1)).join("").slice(0, 48);
|
|
32
|
+
if (!out)
|
|
33
|
+
out = "TripoModel";
|
|
34
|
+
if (/^[0-9]/.test(out))
|
|
35
|
+
out = `T${out}`;
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
/** "walk" -> "preset:walk"; anything already prefixed passes through. */
|
|
39
|
+
export function presetName(name) {
|
|
40
|
+
return name.startsWith("preset:") ? name : `preset:${name}`;
|
|
41
|
+
}
|
|
42
|
+
function imagesOf(o) {
|
|
43
|
+
if (o.images == null)
|
|
44
|
+
return [];
|
|
45
|
+
return (Array.isArray(o.images) ? o.images : [o.images]).filter((s) => s !== "");
|
|
46
|
+
}
|
|
47
|
+
/** The --then chain for these options, or "" when make needs none. */
|
|
48
|
+
export function chainFor(o) {
|
|
49
|
+
if (o.then != null)
|
|
50
|
+
return o.then;
|
|
51
|
+
const steps = [];
|
|
52
|
+
const pbr = o.pbr !== false;
|
|
53
|
+
if (o.retexture)
|
|
54
|
+
steps.push(pbr ? "texture:pbr=true" : "texture");
|
|
55
|
+
if (o.rig !== false) {
|
|
56
|
+
steps.push("rig-check");
|
|
57
|
+
const rigType = o.rigType ?? "biped";
|
|
58
|
+
if (rigType === "auto")
|
|
59
|
+
steps.push("rig");
|
|
60
|
+
else if (rigType === "biped")
|
|
61
|
+
steps.push(`rig:rig_type=biped,spec=${o.spec ?? "unreal"}`);
|
|
62
|
+
else
|
|
63
|
+
steps.push(`rig:rig_type=${rigType}`);
|
|
64
|
+
if (o.animation)
|
|
65
|
+
steps.push(`retarget:animation=${presetName(o.animation)}`);
|
|
66
|
+
}
|
|
67
|
+
if ((o.format ?? "fbx") === "fbx")
|
|
68
|
+
steps.push("convert:fbx");
|
|
69
|
+
return steps.join(",");
|
|
70
|
+
}
|
|
71
|
+
/** The full `tripo make` argument list generate runs. */
|
|
72
|
+
export function makeArgs(o, outDir) {
|
|
73
|
+
const inputs = o.prompt ? [o.prompt] : o.task ? [o.task] : imagesOf(o);
|
|
74
|
+
const args = ["make", ...inputs];
|
|
75
|
+
const chain = chainFor(o);
|
|
76
|
+
// --for sets generation defaults; it means nothing for a task ref, and with
|
|
77
|
+
// rig=false and glb its own convert step is not wanted.
|
|
78
|
+
if (!o.task && (chain || o.rig !== false))
|
|
79
|
+
args.push("--for", o.rig !== false ? "anim" : "game-pc");
|
|
80
|
+
if (chain)
|
|
81
|
+
args.push("--then", chain);
|
|
82
|
+
args.push("-p", `pbr=${o.pbr !== false}`);
|
|
83
|
+
if (o.model)
|
|
84
|
+
args.push("--model", o.model);
|
|
85
|
+
for (const p of o.params ?? [])
|
|
86
|
+
args.push("-p", String(p));
|
|
87
|
+
args.push("-o", outDir);
|
|
88
|
+
if (o.dryRun)
|
|
89
|
+
args.push("--dry-run");
|
|
90
|
+
return withAddedFlags(args);
|
|
91
|
+
}
|
|
92
|
+
function importOptions(o, name) {
|
|
93
|
+
const params = {
|
|
94
|
+
destination: o.destination ?? "/Game/Tripo",
|
|
95
|
+
name,
|
|
96
|
+
kind: o.kind ?? (o.rig !== false ? "skeletal" : "static"),
|
|
97
|
+
};
|
|
98
|
+
for (const k of IMPORT_PASS)
|
|
99
|
+
if (o[k] !== undefined)
|
|
100
|
+
params[k] = o[k];
|
|
101
|
+
return params;
|
|
102
|
+
}
|
|
103
|
+
/** A job folder under base that is not already in use: Knight, Knight_2, ... */
|
|
104
|
+
function freshJobDir(base, name) {
|
|
105
|
+
let dir = join(base, name);
|
|
106
|
+
for (let i = 2; existsSync(join(dir, "job.json")); i++)
|
|
107
|
+
dir = join(base, `${name}_${i}`);
|
|
108
|
+
return dir;
|
|
109
|
+
}
|
|
110
|
+
function taskIdsInLog(log) {
|
|
111
|
+
return [...stripAnsi(log).matchAll(/task created (\S+)/g)].map((m) => m[1]);
|
|
112
|
+
}
|
|
113
|
+
function readText(path) {
|
|
114
|
+
try {
|
|
115
|
+
return readFileSync(path, "utf8");
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return "";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function waitForExit(child, pid, ms) {
|
|
122
|
+
if (child) {
|
|
123
|
+
if (child.exitCode !== null)
|
|
124
|
+
return Promise.resolve(true);
|
|
125
|
+
return new Promise((done) => {
|
|
126
|
+
const timer = setTimeout(() => done(false), ms);
|
|
127
|
+
child.once("exit", () => {
|
|
128
|
+
clearTimeout(timer);
|
|
129
|
+
done(true);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return new Promise((done) => {
|
|
134
|
+
const until = Date.now() + ms;
|
|
135
|
+
const tick = () => {
|
|
136
|
+
if (!isAlive(pid))
|
|
137
|
+
return done(true);
|
|
138
|
+
if (Date.now() >= until)
|
|
139
|
+
return done(false);
|
|
140
|
+
setTimeout(tick, Math.min(POLL_MS, Math.max(0, until - Date.now())));
|
|
141
|
+
};
|
|
142
|
+
tick();
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
export default class Generate extends UeMcpTask {
|
|
146
|
+
get taskName() { return "tripo.generate"; }
|
|
147
|
+
async execute() {
|
|
148
|
+
const o = this.options;
|
|
149
|
+
const waitMs = o.wait === false ? 0 : (o.waitSec ?? DEFAULT_WAIT_SEC) * 1000;
|
|
150
|
+
if (o.resume)
|
|
151
|
+
return this.resume(o, waitMs);
|
|
152
|
+
const images = imagesOf(o);
|
|
153
|
+
const given = [o.prompt ? 1 : 0, images.length ? 1 : 0, o.task ? 1 : 0].reduce((a, b) => a + b, 0);
|
|
154
|
+
if (given !== 1)
|
|
155
|
+
throw new Error("Pass exactly one of prompt, images or task.");
|
|
156
|
+
if (images.length > 4)
|
|
157
|
+
throw new Error("images takes one image, or 2 to 4 views of the same object.");
|
|
158
|
+
if (o.task && !chainFor(o)) {
|
|
159
|
+
throw new Error("A task ref needs at least one step: keep rig=true, set format=fbx, retexture=true, or pass then.");
|
|
160
|
+
}
|
|
161
|
+
const base = workDir(this.ctx?.project?.projectDir);
|
|
162
|
+
const hint = o.name ?? o.prompt ?? (images[0] ? basename(images[0], extname(images[0])) : `Tripo_${o.task.slice(0, 8)}`);
|
|
163
|
+
const jobDir = freshJobDir(base, sanitizeAssetName(hint));
|
|
164
|
+
const name = basename(jobDir);
|
|
165
|
+
const args = makeArgs(o, jobDir);
|
|
166
|
+
if (o.dryRun) {
|
|
167
|
+
const r = await runCli(args, { cwd: base, timeoutMs: 60_000 });
|
|
168
|
+
const plan = r.json;
|
|
169
|
+
if (!plan || plan.dry_run !== true) {
|
|
170
|
+
throw new Error(`tripo make --dry-run exited ${r.exitCode} without a plan.\n${tail(r.stderr)}`);
|
|
171
|
+
}
|
|
172
|
+
const data = { status: "dry_run", args, plan, import: importOptions(o, name) };
|
|
173
|
+
if (plan.valid === false) {
|
|
174
|
+
return { success: false, data, error: new Error(`The plan is not valid: ${plan.errors?.join("; ")}`) };
|
|
175
|
+
}
|
|
176
|
+
return { success: true, data };
|
|
177
|
+
}
|
|
178
|
+
mkdirSync(jobDir, { recursive: true });
|
|
179
|
+
const child = startDetached(args, { cwd: base, stdoutFile: join(jobDir, "make.json"), stderrFile: join(jobDir, "make.log") });
|
|
180
|
+
const job = { name, args, cwd: base, pid: child.pid, startedAt: new Date().toISOString(), import: importOptions(o, name) };
|
|
181
|
+
writeFileSync(join(jobDir, "job.json"), JSON.stringify(job, null, 2));
|
|
182
|
+
this.logger?.info?.(`tripo make started (pid ${child.pid}) into ${jobDir}`);
|
|
183
|
+
const done = await waitForExit(child, child.pid, waitMs);
|
|
184
|
+
return done ? this.finish(jobDir, job, o) : this.pending(jobDir, job);
|
|
185
|
+
}
|
|
186
|
+
async resume(o, waitMs) {
|
|
187
|
+
const base = workDir(this.ctx?.project?.projectDir);
|
|
188
|
+
const jobDir = isAbsolute(o.resume) ? o.resume : resolve(base, o.resume);
|
|
189
|
+
const jobFile = join(jobDir, "job.json");
|
|
190
|
+
if (!existsSync(jobFile)) {
|
|
191
|
+
throw new Error(`No generate job at ${jobDir}. Pass the jobDir a pending generate returned.`);
|
|
192
|
+
}
|
|
193
|
+
const job = JSON.parse(readFileSync(jobFile, "utf8"));
|
|
194
|
+
const done = await waitForExit(undefined, job.pid, waitMs);
|
|
195
|
+
return done ? this.finish(jobDir, job, o) : this.pending(jobDir, job);
|
|
196
|
+
}
|
|
197
|
+
pending(jobDir, job) {
|
|
198
|
+
const ids = taskIdsInLog(readText(join(jobDir, "make.log")));
|
|
199
|
+
const last = ids[ids.length - 1];
|
|
200
|
+
return {
|
|
201
|
+
success: true,
|
|
202
|
+
data: {
|
|
203
|
+
status: "pending",
|
|
204
|
+
name: job.name,
|
|
205
|
+
jobDir,
|
|
206
|
+
pid: job.pid,
|
|
207
|
+
taskIds: ids,
|
|
208
|
+
resume: { action: "generate", resume: jobDir },
|
|
209
|
+
message: `tripo make is still running and keeps going on its own. ` +
|
|
210
|
+
`tripo(action="generate", resume=${JSON.stringify(jobDir)}) waits for it and imports the model.` +
|
|
211
|
+
(last ? ` tripo(action="cli", args=["task","get","${last}"]) shows the current task.` : ""),
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
async finish(jobDir, job, o) {
|
|
216
|
+
const log = readText(join(jobDir, "make.log"));
|
|
217
|
+
const ids = taskIdsInLog(log);
|
|
218
|
+
const result = parseJsonLine(readText(join(jobDir, "make.json")));
|
|
219
|
+
if (!result) {
|
|
220
|
+
throw new Error(`tripo make ended without a result.` +
|
|
221
|
+
(ids.length ? ` Tasks it created: ${ids.join(", ")}. Download the last one with ` +
|
|
222
|
+
`tripo(action="cli", args=["task","get","${ids[ids.length - 1]}","--download","-o",${JSON.stringify(jobDir)}]), ` +
|
|
223
|
+
`then import it with asset(action="import_model").` : "") +
|
|
224
|
+
`\nlog:\n${tail(stripAnsi(log))}`);
|
|
225
|
+
}
|
|
226
|
+
if (result.error) {
|
|
227
|
+
const parts = [`tripo make failed (exit ${result.exit_code ?? "?"}): ${result.error}`];
|
|
228
|
+
if (result.suggestion)
|
|
229
|
+
parts.push(`Suggestion: ${result.suggestion}`);
|
|
230
|
+
const taskId = result.task_id ?? ids[ids.length - 1];
|
|
231
|
+
if (taskId) {
|
|
232
|
+
parts.push(`Task: ${taskId}. If it is still running or only the download failed, ` +
|
|
233
|
+
`tripo(action="cli", args=["task","watch","${taskId}","--download","-o",${JSON.stringify(jobDir)}]) fetches it, ` +
|
|
234
|
+
`then asset(action="import_model") imports the file.`);
|
|
235
|
+
}
|
|
236
|
+
parts.push(`log:\n${tail(stripAnsi(log))}`);
|
|
237
|
+
throw new Error(parts.join("\n"));
|
|
238
|
+
}
|
|
239
|
+
const warnings = [];
|
|
240
|
+
let modelFile = result.model_file;
|
|
241
|
+
const params = { ...job.import };
|
|
242
|
+
for (const k of IMPORT_PASS)
|
|
243
|
+
if (o[k] !== undefined)
|
|
244
|
+
params[k] = o[k];
|
|
245
|
+
if (o.destination)
|
|
246
|
+
params.destination = o.destination;
|
|
247
|
+
if (o.kind)
|
|
248
|
+
params.kind = o.kind;
|
|
249
|
+
if (!modelFile && result.source_model_file) {
|
|
250
|
+
modelFile = result.source_model_file;
|
|
251
|
+
warnings.push("The chain stopped early (the model may not be riggable), so the unrigged source model is imported as a static mesh.");
|
|
252
|
+
params.kind = "static";
|
|
253
|
+
}
|
|
254
|
+
if (!modelFile)
|
|
255
|
+
throw new Error(`tripo make succeeded but reported no model_file: ${JSON.stringify(result)}`);
|
|
256
|
+
modelFile = resolve(job.cwd, modelFile);
|
|
257
|
+
params.filePath = modelFile;
|
|
258
|
+
const breakdown = result.credits_breakdown ?? [];
|
|
259
|
+
const taskIds = breakdown.length ? breakdown.map((b) => b.task_id) : ids.length ? ids : [result.task_id];
|
|
260
|
+
const summary = {
|
|
261
|
+
name: job.name,
|
|
262
|
+
jobDir,
|
|
263
|
+
modelFile,
|
|
264
|
+
preview: result.preview,
|
|
265
|
+
taskId: result.task_id,
|
|
266
|
+
taskIds,
|
|
267
|
+
credits: result.credits_consumed,
|
|
268
|
+
creditsBreakdown: result.credits_breakdown,
|
|
269
|
+
};
|
|
270
|
+
const res = await this.call("asset.import_model", params);
|
|
271
|
+
if (!res.success) {
|
|
272
|
+
const why = res.error?.message ?? JSON.stringify(res.data ?? {});
|
|
273
|
+
throw new Error(`asset(import_model) failed for ${modelFile}: ${why}. The file is still on disk; retry with ` +
|
|
274
|
+
`asset(action="import_model", filePath=${JSON.stringify(modelFile)}, kind="${params.kind}"). ` +
|
|
275
|
+
`import_model needs ue-mcp 1.4.16-beta.10 or later.`);
|
|
276
|
+
}
|
|
277
|
+
const imported = (res.data ?? {});
|
|
278
|
+
if (Array.isArray(imported.warnings))
|
|
279
|
+
warnings.push(...imported.warnings.map(String));
|
|
280
|
+
return { success: true, data: { status: "imported", ...summary, import: imported, warnings } };
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=Generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Generate.js","sourceRoot":"","sources":["../../src/tasks/Generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO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I,IAAI,EAAE,CAAC,CAAC;YACjE,MAAM,IAAI,KAAK,CACb,kCAAkC,SAAS,KAAK,GAAG,0CAA0C;gBAC3F,yCAAyC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,MAAM,CAAC,IAAI,MAAM;gBAC9F,oDAAoD,CACvD,CAAC;QACJ,CAAC;QACD,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;QAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACtF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC;IACjG,CAAC;CACF"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Tripo through ue-mcp
|
|
2
|
+
|
|
3
|
+
This plugin runs tripo-cli 0.11.2, pinned in its package, so nothing needs installing. Every `tripo ...` command in the guide below is a call to `tripo(action="cli", args=[...])` with the words after `tripo` as the array: `tripo balance` is `tripo(action="cli", args=["balance"])`, and `tripo task get <id>` is `tripo(action="cli", args=["task","get","<id>"])`. The plugin adds `--json`, `--yes` and `--no-open` to every command and returns the parsed JSON result. Relative paths resolve against `<project>/Saved/Tripo`, so pass absolute paths.
|
|
4
|
+
|
|
5
|
+
- Sign in with `tripo(action="cli", args=["login","--region","ov","--no-wait"])` (`cn` for the China site), or set `TRIPO_API_KEY` in the ue-mcp server environment. Then check with `tripo(action="cli", args=["doctor"])`.
|
|
6
|
+
- To get a model into Unreal, use `tripo(action="generate", prompt="...")`. It runs `tripo make` with Unreal defaults (`--for anim`, a rig with `spec=unreal`, `convert:fbx`, `-p pbr=true`), writes to `<project>/Saved/Tripo/<name>` and imports the result with `asset(action="import_model")`. `dryRun=true` returns the plan and credit estimate. A pending result names the `generate(resume=...)` call that finishes the import.
|
|
7
|
+
- A model file already on disk goes straight to `asset(action="import_model", filePath=..., kind="skeletal")`.
|
|
8
|
+
- The cli action stops a command after `timeoutSec` (default 300). For long jobs pass `--no-wait`, then `["task","watch","<id>","--download"]`. `tripo mcp` and `tripo update` are not available through the plugin.
|
|
9
|
+
- Ignore the guide's install, `TRIPO_CLIENT_APP` and `TRIPO_DISTRIBUTION_CHANNEL` instructions; the plugin handles the binary.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Tripo CLI Skill
|
|
14
|
+
|
|
15
|
+
**Bundled with tripo-cli 0.11.2.**
|
|
16
|
+
|
|
17
|
+
- PBR is off by default: an omitted `pbr` is sent as `false` on 3D generation (presets included) and on `texture`. Add `-p pbr=true` only when the user explicitly asks for PBR; it also applies to `--then texture` steps that don't set `pbr`.
|
|
18
|
+
- Display aliases `H3.1`, `H3.0`, `H2.5`, `P1.0`, `P2.0` (case-insensitive) normalize before validation; unknown 3D/image model IDs fail locally.
|
|
19
|
+
- `make` validates deterministic later steps before uploading or generating.
|
|
20
|
+
- Plan cards and `--dry-run` JSON (`generation_credits_estimate`) show the official list-price estimate for the generation step; P1, legacy models and `--then` chain steps are **not estimated**, which never means zero credits.
|
|
21
|
+
- Do not interpret `valid=true` as a quotation or proof that arbitrary passthrough fields are supported. Check warnings and the normalized payload: unsupported P-series fields are removed with warnings, not sent to the API.
|
|
22
|
+
- Image model `chat_image_1` is retired and rejected; `chat_image_1.5` is still valid until its retirement on 2026-12-01 (the CLI warns until then and rejects it afterwards).
|
|
23
|
+
- Never automatically swap models and resubmit a paid task.
|
|
24
|
+
- Without an explicit user choice, quadruped rigs use `rig-v2.5`; other body types keep v3.0. Chains apply that default after rig-check, including `--for anim`. A standalone `tripo anim rig` does not infer the body type: save the original model task id (the check changes `@last`), run `tripo anim check`, inspect it with `tripo task get <check_task_id> --json`, then rig the original model with the recommended `--rig-type`. An explicit rig model always wins.
|
|
25
|
+
|
|
26
|
+
You (an AI coding agent) can generate production-ready 3D assets with the `tripo` CLI.
|
|
27
|
+
One command turns a text prompt or an image into local files: a 3D model (glb/fbx/stl/...), a `preview.png` render, and a `task.json` record.
|
|
28
|
+
|
|
29
|
+
When the calling host is known, set `TRIPO_CLIENT_APP` to its actual name
|
|
30
|
+
(`codex`, `workbuddy`, `zcode`, `kimi`, `deepseek`, `claude`, `cursor`, or `chatgpt`) on each
|
|
31
|
+
CLI command, including every command in a pipeline. Do not guess from the model,
|
|
32
|
+
API key, account region, or an earlier call. Set `TRIPO_DISTRIBUTION_CHANNEL` only
|
|
33
|
+
when a packaged plugin provides it; a standalone CLI install is not a plugin.
|
|
34
|
+
These values are per-call metadata, never account-profile settings.
|
|
35
|
+
|
|
36
|
+
## Install & auth
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install -g tripo-cli # or: npx tripo-cli ...
|
|
40
|
+
export TRIPO_API_KEY=tsk_... # highest-priority auth; no interaction needed
|
|
41
|
+
# (PowerShell: $env:TRIPO_API_KEY = "tsk_...")
|
|
42
|
+
# China-site key? also export TRIPO_REGION=cn (env keys default to ov)
|
|
43
|
+
tripo doctor # verify key, network, balance
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If there is no key, run the device login **yourself** — it works without a TTY.
|
|
47
|
+
First ask the human which Tripo site their account is on, and do not guess: the
|
|
48
|
+
login only works on the site it was started for.
|
|
49
|
+
|
|
50
|
+
- `cn` — China mainland site developers.tripo3d.com (phone/SMS sign-in, Alipay)
|
|
51
|
+
- `ov` — international site developers.tripo3d.ai (email sign-in, Stripe)
|
|
52
|
+
- no account yet: mainland China → `cn`, everywhere else → `ov`
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
tripo login --region <cn|ov> --no-wait # the site the human named
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
It prints a verification URL and a one-time code and exits at once. Relay the
|
|
59
|
+
URL and code to the human and tell them: sign in on that page first if it asks
|
|
60
|
+
(sign-up gives free credits), enter the code, pick an API key if the account has
|
|
61
|
+
several (one is created automatically if there are none), click Authorize. When
|
|
62
|
+
they say it is done, run the same command again: it finishes the login with that
|
|
63
|
+
same code (`"status":"logged_in"`), or answers `"status":"pending"` if they have
|
|
64
|
+
not authorized yet. Without `--no-wait` the command itself waits for the approval
|
|
65
|
+
(up to ~15 minutes); if it gets cut off, rerunning resumes the same code. The
|
|
66
|
+
key is then saved locally; never ask the human to paste a key into the chat. If
|
|
67
|
+
the code expires (exit 3), just run the same command again; if the human says
|
|
68
|
+
the page is the wrong site, rerun with the other `--region`.
|
|
69
|
+
|
|
70
|
+
Regions (ov = international, cn = China mainland) share one CLI: `tripo login --key tsk_...` auto-detects which region the key belongs to. Already logged into the wrong site? `tripo login --region <other>` replaces the active profile's key and region. On exit code 3 (auth), run `tripo doctor` — it diagnoses key-vs-region mismatches and prints the exact fix (`tripo config set region cn|ov`).
|
|
71
|
+
|
|
72
|
+
## Behavior rules (read first)
|
|
73
|
+
|
|
74
|
+
1. **`tripo make` is synchronous and blocking.** It prints a plan card on stderr (one numbered line per API call: endpoint, purpose, args), then submits, polls, downloads artifacts, and exits. In a TTY it asks "Run this plan?" first; `--yes` (auto-enabled when headless) skips the prompt but still prints the card. Wait for the process to finish and read the final JSON from stdout. Do NOT re-implement polling, do NOT add your own timeout shorter than 15 minutes, do NOT stop just because you saw a task_id in the logs.
|
|
75
|
+
2. **stdout is the contract; stderr is commentary.** With `--json` (auto-enabled when piped), every result command prints exactly one JSON line on stdout (`docs`/`completion` print text, `mcp` speaks JSON-RPC). Progress/logs go to stderr.
|
|
76
|
+
3. **Artifacts are local files.** The result JSON has `output_dir`, `model_file`, `preview`. Look at `preview.png` to judge quality. Ask the human before re-rolling: `tripo redo` submits a new paid task at once, with no plan card and no confirmation.
|
|
77
|
+
4. **Exit codes are stable** — branch on them:
|
|
78
|
+
- 0 success · 1 unexpected error · 2 usage/params · 3 auth · 4 insufficient credits (stop at once: do not retry, resubmit with other params/models, or run other paid commands; give the human the top-up link from `suggestion` — or `tripo topup` — and wait until they confirm) · 5 content policy
|
|
79
|
+
- 6 task failed (credits auto-refunded; on `timeout` it is still running — `tripo task watch <id>`, never redo)
|
|
80
|
+
- 7 network: a failed submit is never resent and may already exist — check `tripo balance` before re-running. If the task succeeded but its download failed, the error JSON carries `task_id` — run `tripo task get <task_id> --download`, never re-make.
|
|
81
|
+
- 8 not found · 9 rate limit (retry with backoff)
|
|
82
|
+
5. **Never invent parameters.** Unknown `--param key=value` pairs pass through to the API; stick to documented ones. The full parameter/model/preset reference from the official API docs is bundled: `tripo docs --topic commands/generate` (3D + image generation) and `tripo docs --topic commands/process` (texture/convert/rig/retarget/mesh) — read those instead of browsing the website.
|
|
83
|
+
6. **Validate before spending: `--dry-run --json`.** `make` prints normalized `steps[].payload`, `warnings` and `errors` with zero network calls and no credits; `tripo model texture ... --dry-run --json` does the same for a standalone texture request, including one with a `texture_prompt` object. For an existing generated task where the user requests PBR without guidance, `make <task_id> --then texture:pbr=true --dry-run --json` also works. Other `generate`, `model`, `anim` and `mesh` commands do not support this flag. Local validation failures exit 2; `valid=true` does not verify remote resources or guarantee server acceptance. Fix errors and review parameter adjustments with the user; disclose offline limitations and unestimated execution costs, get confirmation, then execute the planned command. Details: `tripo docs --topic commands/make` and `commands/process`.
|
|
84
|
+
7. **For 3D generation, default to P2; change generation models only through an explicit parameter.**
|
|
85
|
+
- The CLI and both regional MCP servers default every 3D generation to `P2-20260801`, including all `--for` presets. Prompt wording, geometry options and face budgets never select a different model.
|
|
86
|
+
- Explicit `--model` wins over `-p model=<string>`. `tripo ai` uses `-p model=<string>` for this override. Use the user's requested model; do not let a scenario or an expert suggestion replace it.
|
|
87
|
+
- Use an explicit `--model H3.1` for H-only features such as `smart_low_poly`, `generate_parts` or `geometry_quality`. P2 keeps its face limits (48–50000 triangles; 48–25000 with quad); invalid limits fail rather than switch models. Unsupported parameters are removed with warnings, so review the normalized plan before execution.
|
|
88
|
+
- P2 costs 100–130 credits per generation by texture tier; relay the plan estimate and get confirmation before spending. P1 and legacy models have no local estimate.
|
|
89
|
+
- Aliases normalize to dated wire values (`tripo-p2` → `P2-20260801`). Every generation request explicitly includes the resolved `model`; the raw API requires it, so do not rely on an upstream default. Alias and capability details: `tripo docs --topic commands/generate`.
|
|
90
|
+
- Keep the confirmed generation model explicit when moving from a plan to the execution request. This rule applies only to 3D generation. Rigging has its own defaults: `v2.5-20260210` for quadruped, `v3.0-20260909` otherwise; respect an explicit user choice and never reuse the generation model for rigging. Texture and other processing capabilities keep their own model defaults.
|
|
91
|
+
|
|
92
|
+
## The one command you usually need
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
tripo make "a medieval knight, T-pose" --for game-mobile --json --yes
|
|
96
|
+
tripo make concept.png --for print --json --yes
|
|
97
|
+
tripo make front.png back.png --json --yes # 2-4 views → multiview
|
|
98
|
+
tripo make <task_id> --then texture:pbr=true --dry-run --json # plan PBR on an existing task without guidance
|
|
99
|
+
tripo make @last --then convert:fbx --json --yes # continue from last task
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- For an imported mesh, supply `texture_prompt`. For later PBR, reuse the original reference when available with `tripo model texture <task_id> -p pbr=true -p 'texture_prompt={"image":"<file_token>"}' --json`; without guidance, use the `make --then texture` preflight above. `--then` cannot carry the guidance object. Nested image references take URLs, file tokens or local paths; write local files as `./concept.png`, absolute or `~/` paths: they are uploaded first (as in `tripo mcp --toolset full`) and a missing one fails the preflight. Preflight with `--dry-run --json` (rule 6) and confirm the plan before executing. Re-texturing regenerates textures and keeps geometry.
|
|
103
|
+
- `--for` scenario presets: `film` `print` `game-mobile` `game-pc` `ar-web` `anim` `toy` all default to P2; use `--model` to select another model explicitly.
|
|
104
|
+
- `--then` chain steps: `texture convert rig-check rig retarget segment complete decimate uv`
|
|
105
|
+
- step args: `convert:format=FBX,texture_size=2048` (bare value = primary arg: `convert:fbx`, `decimate:5000`)
|
|
106
|
+
- Output JSON: `{"task_id","type","status","credits_consumed","output_dir","files",["model_file"],["source_model_file"],["preview"],["normalize_scale"],["chain"],["credits_breakdown"]}` — with `--then`, `credits_consumed` is the **total** for the run and `credits_breakdown` itemizes every task (`[{task_id,type,credits_consumed}]`, generation first)
|
|
107
|
+
- `-n 2`–`-n 4` prints `{"candidates":[<one result per candidate>],"chain":[...],"credits_consumed","credits_breakdown"}` instead; a candidate whose download failed carries `download_error` (exit 7)
|
|
108
|
+
- `normalize_scale` appears when the input was a model file / URL: the import rescaled it (final size = original size × normalize_scale; `1` = untouched) and nothing scales it back — divide by it to recover the original size
|
|
109
|
+
|
|
110
|
+
## Pipes (composing steps yourself)
|
|
111
|
+
|
|
112
|
+
Downstream commands read the upstream task from stdin:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
tripo make humanoid.png --json | tripo anim rig --model rig-v3.0 --json | tripo anim retarget --param animation=preset:walk --json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
If an upstream command fails or prints no task, the downstream submits nothing and exits with the upstream's exit code (or 2). Without a terminal on stdin, process commands never fall back to `@last`; pass the input explicitly.
|
|
119
|
+
|
|
120
|
+
## Other commands
|
|
121
|
+
|
|
122
|
+
| command | purpose |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `tripo task get/watch <id> --download` | inspect / block on / download an existing task |
|
|
125
|
+
| `tripo balance` / `tripo usage` | credits: `{"balance","frozen"}` / recent spend |
|
|
126
|
+
| `tripo models` | accepted model ids per capability, defaults and aliases (local, no API call) |
|
|
127
|
+
| `tripo redo [@last]` | same request, new seed |
|
|
128
|
+
| `tripo view [@last]` | (humans) open a local 3D preview; agents read `preview.png` instead |
|
|
129
|
+
| `tripo files upload <path>` | get a `file_token` |
|
|
130
|
+
| `tripo batch run manifest.yaml` | bulk jobs, resumable; no plan card, so estimate and confirm first (`commands/batch` § Cost) |
|
|
131
|
+
| `tripo mcp` | run as an MCP server (tools: tripo_make, tripo_task_get, tripo_task_wait, tripo_balance, tripo_history; `--toolset full`: the hosted Tripo MCP tools plus tripo_download) |
|
|
132
|
+
| `tripo docs --topic commands/<name>` | print detailed docs for any command |
|
|
133
|
+
|
|
134
|
+
## Detailed docs in this package
|
|
135
|
+
|
|
136
|
+
- `commands/` — one file per command with every flag and parameter
|
|
137
|
+
- model versions · H series (`tripo-v3.x`) · P series (`tripo-p1`, `tripo-p2`) · alias → wire value · GA / Legacy status · quad → `commands/generate` § "Models & Versions" (also the P Series endpoint entry points)
|
|
138
|
+
- `examples/` — copy-paste recipes per scenario (game/print/animation/...)
|
|
139
|
+
- `common-errors.md` — error table with fixes
|
|
140
|
+
|
|
141
|
+
Print any of them: `tripo docs --topic examples/game-asset`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ue-mcp-tripo",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Tripo plugin for ue-mcp. Runs Tripo's own CLI to turn a prompt or image into a rigged, textured Unreal Engine 5 character imported through ue-mcp core, and exposes every other CLI command through a passthrough.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"ue-mcp.plugin.yml",
|
|
10
|
+
"knowledge",
|
|
11
|
+
"skills",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ue-mcp-plugin",
|
|
17
|
+
"unreal-engine",
|
|
18
|
+
"ue5",
|
|
19
|
+
"tripo",
|
|
20
|
+
"text-to-3d",
|
|
21
|
+
"image-to-3d",
|
|
22
|
+
"auto-rig",
|
|
23
|
+
"ai-3d",
|
|
24
|
+
"mcp"
|
|
25
|
+
],
|
|
26
|
+
"author": "David Lyon",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/db-lyon/ue-mcp-tripo.git"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/db-lyon/ue-mcp-tripo#readme",
|
|
33
|
+
"bugs": "https://github.com/db-lyon/ue-mcp-tripo/issues",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^22.20.5",
|
|
36
|
+
"typescript": "^5.7.0",
|
|
37
|
+
"ue-mcp": "1.4.16-beta.9",
|
|
38
|
+
"vitest": "^3.2.4"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
42
|
+
"build": "npm run clean && tsc && node scripts/gen-docs.mjs",
|
|
43
|
+
"check": "node scripts/check.mjs",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"prepare": "npm run build",
|
|
46
|
+
"prepublishOnly": "npm run build && npm run check && npm test"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=20"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"tripo-cli": "0.11.2"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cli
|
|
3
|
+
description: Generate, rig, animate, convert and import 3D models with Tripo through ue-mcp's tripo tool. Use when the user wants a 3D asset made with Tripo, asks about Tripo credits or tasks, or wants an AI-generated character in Unreal.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tripo through ue-mcp
|
|
7
|
+
|
|
8
|
+
This plugin runs tripo-cli 0.11.2, pinned in its package, so nothing needs installing. Every `tripo ...` command in the guide below is a call to `tripo(action="cli", args=[...])` with the words after `tripo` as the array: `tripo balance` is `tripo(action="cli", args=["balance"])`, and `tripo task get <id>` is `tripo(action="cli", args=["task","get","<id>"])`. The plugin adds `--json`, `--yes` and `--no-open` to every command and returns the parsed JSON result. Relative paths resolve against `<project>/Saved/Tripo`, so pass absolute paths.
|
|
9
|
+
|
|
10
|
+
- Sign in with `tripo(action="cli", args=["login","--region","ov","--no-wait"])` (`cn` for the China site), or set `TRIPO_API_KEY` in the ue-mcp server environment. Then check with `tripo(action="cli", args=["doctor"])`.
|
|
11
|
+
- To get a model into Unreal, use `tripo(action="generate", prompt="...")`. It runs `tripo make` with Unreal defaults (`--for anim`, a rig with `spec=unreal`, `convert:fbx`, `-p pbr=true`), writes to `<project>/Saved/Tripo/<name>` and imports the result with `asset(action="import_model")`. `dryRun=true` returns the plan and credit estimate. A pending result names the `generate(resume=...)` call that finishes the import.
|
|
12
|
+
- A model file already on disk goes straight to `asset(action="import_model", filePath=..., kind="skeletal")`.
|
|
13
|
+
- The cli action stops a command after `timeoutSec` (default 300). For long jobs pass `--no-wait`, then `["task","watch","<id>","--download"]`. `tripo mcp` and `tripo update` are not available through the plugin.
|
|
14
|
+
- Ignore the guide's install, `TRIPO_CLIENT_APP` and `TRIPO_DISTRIBUTION_CHANNEL` instructions; the plugin handles the binary.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Tripo CLI Skill
|
|
19
|
+
|
|
20
|
+
**Bundled with tripo-cli 0.11.2.**
|
|
21
|
+
|
|
22
|
+
- PBR is off by default: an omitted `pbr` is sent as `false` on 3D generation (presets included) and on `texture`. Add `-p pbr=true` only when the user explicitly asks for PBR; it also applies to `--then texture` steps that don't set `pbr`.
|
|
23
|
+
- Display aliases `H3.1`, `H3.0`, `H2.5`, `P1.0`, `P2.0` (case-insensitive) normalize before validation; unknown 3D/image model IDs fail locally.
|
|
24
|
+
- `make` validates deterministic later steps before uploading or generating.
|
|
25
|
+
- Plan cards and `--dry-run` JSON (`generation_credits_estimate`) show the official list-price estimate for the generation step; P1, legacy models and `--then` chain steps are **not estimated**, which never means zero credits.
|
|
26
|
+
- Do not interpret `valid=true` as a quotation or proof that arbitrary passthrough fields are supported. Check warnings and the normalized payload: unsupported P-series fields are removed with warnings, not sent to the API.
|
|
27
|
+
- Image model `chat_image_1` is retired and rejected; `chat_image_1.5` is still valid until its retirement on 2026-12-01 (the CLI warns until then and rejects it afterwards).
|
|
28
|
+
- Never automatically swap models and resubmit a paid task.
|
|
29
|
+
- Without an explicit user choice, quadruped rigs use `rig-v2.5`; other body types keep v3.0. Chains apply that default after rig-check, including `--for anim`. A standalone `tripo anim rig` does not infer the body type: save the original model task id (the check changes `@last`), run `tripo anim check`, inspect it with `tripo task get <check_task_id> --json`, then rig the original model with the recommended `--rig-type`. An explicit rig model always wins.
|
|
30
|
+
|
|
31
|
+
You (an AI coding agent) can generate production-ready 3D assets with the `tripo` CLI.
|
|
32
|
+
One command turns a text prompt or an image into local files: a 3D model (glb/fbx/stl/...), a `preview.png` render, and a `task.json` record.
|
|
33
|
+
|
|
34
|
+
When the calling host is known, set `TRIPO_CLIENT_APP` to its actual name
|
|
35
|
+
(`codex`, `workbuddy`, `zcode`, `kimi`, `deepseek`, `claude`, `cursor`, or `chatgpt`) on each
|
|
36
|
+
CLI command, including every command in a pipeline. Do not guess from the model,
|
|
37
|
+
API key, account region, or an earlier call. Set `TRIPO_DISTRIBUTION_CHANNEL` only
|
|
38
|
+
when a packaged plugin provides it; a standalone CLI install is not a plugin.
|
|
39
|
+
These values are per-call metadata, never account-profile settings.
|
|
40
|
+
|
|
41
|
+
## Install & auth
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g tripo-cli # or: npx tripo-cli ...
|
|
45
|
+
export TRIPO_API_KEY=tsk_... # highest-priority auth; no interaction needed
|
|
46
|
+
# (PowerShell: $env:TRIPO_API_KEY = "tsk_...")
|
|
47
|
+
# China-site key? also export TRIPO_REGION=cn (env keys default to ov)
|
|
48
|
+
tripo doctor # verify key, network, balance
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If there is no key, run the device login **yourself** — it works without a TTY.
|
|
52
|
+
First ask the human which Tripo site their account is on, and do not guess: the
|
|
53
|
+
login only works on the site it was started for.
|
|
54
|
+
|
|
55
|
+
- `cn` — China mainland site developers.tripo3d.com (phone/SMS sign-in, Alipay)
|
|
56
|
+
- `ov` — international site developers.tripo3d.ai (email sign-in, Stripe)
|
|
57
|
+
- no account yet: mainland China → `cn`, everywhere else → `ov`
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
tripo login --region <cn|ov> --no-wait # the site the human named
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
It prints a verification URL and a one-time code and exits at once. Relay the
|
|
64
|
+
URL and code to the human and tell them: sign in on that page first if it asks
|
|
65
|
+
(sign-up gives free credits), enter the code, pick an API key if the account has
|
|
66
|
+
several (one is created automatically if there are none), click Authorize. When
|
|
67
|
+
they say it is done, run the same command again: it finishes the login with that
|
|
68
|
+
same code (`"status":"logged_in"`), or answers `"status":"pending"` if they have
|
|
69
|
+
not authorized yet. Without `--no-wait` the command itself waits for the approval
|
|
70
|
+
(up to ~15 minutes); if it gets cut off, rerunning resumes the same code. The
|
|
71
|
+
key is then saved locally; never ask the human to paste a key into the chat. If
|
|
72
|
+
the code expires (exit 3), just run the same command again; if the human says
|
|
73
|
+
the page is the wrong site, rerun with the other `--region`.
|
|
74
|
+
|
|
75
|
+
Regions (ov = international, cn = China mainland) share one CLI: `tripo login --key tsk_...` auto-detects which region the key belongs to. Already logged into the wrong site? `tripo login --region <other>` replaces the active profile's key and region. On exit code 3 (auth), run `tripo doctor` — it diagnoses key-vs-region mismatches and prints the exact fix (`tripo config set region cn|ov`).
|
|
76
|
+
|
|
77
|
+
## Behavior rules (read first)
|
|
78
|
+
|
|
79
|
+
1. **`tripo make` is synchronous and blocking.** It prints a plan card on stderr (one numbered line per API call: endpoint, purpose, args), then submits, polls, downloads artifacts, and exits. In a TTY it asks "Run this plan?" first; `--yes` (auto-enabled when headless) skips the prompt but still prints the card. Wait for the process to finish and read the final JSON from stdout. Do NOT re-implement polling, do NOT add your own timeout shorter than 15 minutes, do NOT stop just because you saw a task_id in the logs.
|
|
80
|
+
2. **stdout is the contract; stderr is commentary.** With `--json` (auto-enabled when piped), every result command prints exactly one JSON line on stdout (`docs`/`completion` print text, `mcp` speaks JSON-RPC). Progress/logs go to stderr.
|
|
81
|
+
3. **Artifacts are local files.** The result JSON has `output_dir`, `model_file`, `preview`. Look at `preview.png` to judge quality. Ask the human before re-rolling: `tripo redo` submits a new paid task at once, with no plan card and no confirmation.
|
|
82
|
+
4. **Exit codes are stable** — branch on them:
|
|
83
|
+
- 0 success · 1 unexpected error · 2 usage/params · 3 auth · 4 insufficient credits (stop at once: do not retry, resubmit with other params/models, or run other paid commands; give the human the top-up link from `suggestion` — or `tripo topup` — and wait until they confirm) · 5 content policy
|
|
84
|
+
- 6 task failed (credits auto-refunded; on `timeout` it is still running — `tripo task watch <id>`, never redo)
|
|
85
|
+
- 7 network: a failed submit is never resent and may already exist — check `tripo balance` before re-running. If the task succeeded but its download failed, the error JSON carries `task_id` — run `tripo task get <task_id> --download`, never re-make.
|
|
86
|
+
- 8 not found · 9 rate limit (retry with backoff)
|
|
87
|
+
5. **Never invent parameters.** Unknown `--param key=value` pairs pass through to the API; stick to documented ones. The full parameter/model/preset reference from the official API docs is bundled: `tripo docs --topic commands/generate` (3D + image generation) and `tripo docs --topic commands/process` (texture/convert/rig/retarget/mesh) — read those instead of browsing the website.
|
|
88
|
+
6. **Validate before spending: `--dry-run --json`.** `make` prints normalized `steps[].payload`, `warnings` and `errors` with zero network calls and no credits; `tripo model texture ... --dry-run --json` does the same for a standalone texture request, including one with a `texture_prompt` object. For an existing generated task where the user requests PBR without guidance, `make <task_id> --then texture:pbr=true --dry-run --json` also works. Other `generate`, `model`, `anim` and `mesh` commands do not support this flag. Local validation failures exit 2; `valid=true` does not verify remote resources or guarantee server acceptance. Fix errors and review parameter adjustments with the user; disclose offline limitations and unestimated execution costs, get confirmation, then execute the planned command. Details: `tripo docs --topic commands/make` and `commands/process`.
|
|
89
|
+
7. **For 3D generation, default to P2; change generation models only through an explicit parameter.**
|
|
90
|
+
- The CLI and both regional MCP servers default every 3D generation to `P2-20260801`, including all `--for` presets. Prompt wording, geometry options and face budgets never select a different model.
|
|
91
|
+
- Explicit `--model` wins over `-p model=<string>`. `tripo ai` uses `-p model=<string>` for this override. Use the user's requested model; do not let a scenario or an expert suggestion replace it.
|
|
92
|
+
- Use an explicit `--model H3.1` for H-only features such as `smart_low_poly`, `generate_parts` or `geometry_quality`. P2 keeps its face limits (48–50000 triangles; 48–25000 with quad); invalid limits fail rather than switch models. Unsupported parameters are removed with warnings, so review the normalized plan before execution.
|
|
93
|
+
- P2 costs 100–130 credits per generation by texture tier; relay the plan estimate and get confirmation before spending. P1 and legacy models have no local estimate.
|
|
94
|
+
- Aliases normalize to dated wire values (`tripo-p2` → `P2-20260801`). Every generation request explicitly includes the resolved `model`; the raw API requires it, so do not rely on an upstream default. Alias and capability details: `tripo docs --topic commands/generate`.
|
|
95
|
+
- Keep the confirmed generation model explicit when moving from a plan to the execution request. This rule applies only to 3D generation. Rigging has its own defaults: `v2.5-20260210` for quadruped, `v3.0-20260909` otherwise; respect an explicit user choice and never reuse the generation model for rigging. Texture and other processing capabilities keep their own model defaults.
|
|
96
|
+
|
|
97
|
+
## The one command you usually need
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
tripo make "a medieval knight, T-pose" --for game-mobile --json --yes
|
|
101
|
+
tripo make concept.png --for print --json --yes
|
|
102
|
+
tripo make front.png back.png --json --yes # 2-4 views → multiview
|
|
103
|
+
tripo make <task_id> --then texture:pbr=true --dry-run --json # plan PBR on an existing task without guidance
|
|
104
|
+
tripo make @last --then convert:fbx --json --yes # continue from last task
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- For an imported mesh, supply `texture_prompt`. For later PBR, reuse the original reference when available with `tripo model texture <task_id> -p pbr=true -p 'texture_prompt={"image":"<file_token>"}' --json`; without guidance, use the `make --then texture` preflight above. `--then` cannot carry the guidance object. Nested image references take URLs, file tokens or local paths; write local files as `./concept.png`, absolute or `~/` paths: they are uploaded first (as in `tripo mcp --toolset full`) and a missing one fails the preflight. Preflight with `--dry-run --json` (rule 6) and confirm the plan before executing. Re-texturing regenerates textures and keeps geometry.
|
|
108
|
+
- `--for` scenario presets: `film` `print` `game-mobile` `game-pc` `ar-web` `anim` `toy` all default to P2; use `--model` to select another model explicitly.
|
|
109
|
+
- `--then` chain steps: `texture convert rig-check rig retarget segment complete decimate uv`
|
|
110
|
+
- step args: `convert:format=FBX,texture_size=2048` (bare value = primary arg: `convert:fbx`, `decimate:5000`)
|
|
111
|
+
- Output JSON: `{"task_id","type","status","credits_consumed","output_dir","files",["model_file"],["source_model_file"],["preview"],["normalize_scale"],["chain"],["credits_breakdown"]}` — with `--then`, `credits_consumed` is the **total** for the run and `credits_breakdown` itemizes every task (`[{task_id,type,credits_consumed}]`, generation first)
|
|
112
|
+
- `-n 2`–`-n 4` prints `{"candidates":[<one result per candidate>],"chain":[...],"credits_consumed","credits_breakdown"}` instead; a candidate whose download failed carries `download_error` (exit 7)
|
|
113
|
+
- `normalize_scale` appears when the input was a model file / URL: the import rescaled it (final size = original size × normalize_scale; `1` = untouched) and nothing scales it back — divide by it to recover the original size
|
|
114
|
+
|
|
115
|
+
## Pipes (composing steps yourself)
|
|
116
|
+
|
|
117
|
+
Downstream commands read the upstream task from stdin:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
tripo make humanoid.png --json | tripo anim rig --model rig-v3.0 --json | tripo anim retarget --param animation=preset:walk --json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
If an upstream command fails or prints no task, the downstream submits nothing and exits with the upstream's exit code (or 2). Without a terminal on stdin, process commands never fall back to `@last`; pass the input explicitly.
|
|
124
|
+
|
|
125
|
+
## Other commands
|
|
126
|
+
|
|
127
|
+
| command | purpose |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `tripo task get/watch <id> --download` | inspect / block on / download an existing task |
|
|
130
|
+
| `tripo balance` / `tripo usage` | credits: `{"balance","frozen"}` / recent spend |
|
|
131
|
+
| `tripo models` | accepted model ids per capability, defaults and aliases (local, no API call) |
|
|
132
|
+
| `tripo redo [@last]` | same request, new seed |
|
|
133
|
+
| `tripo view [@last]` | (humans) open a local 3D preview; agents read `preview.png` instead |
|
|
134
|
+
| `tripo files upload <path>` | get a `file_token` |
|
|
135
|
+
| `tripo batch run manifest.yaml` | bulk jobs, resumable; no plan card, so estimate and confirm first (`commands/batch` § Cost) |
|
|
136
|
+
| `tripo mcp` | run as an MCP server (tools: tripo_make, tripo_task_get, tripo_task_wait, tripo_balance, tripo_history; `--toolset full`: the hosted Tripo MCP tools plus tripo_download) |
|
|
137
|
+
| `tripo docs --topic commands/<name>` | print detailed docs for any command |
|
|
138
|
+
|
|
139
|
+
## Detailed docs in this package
|
|
140
|
+
|
|
141
|
+
- `commands/` — one file per command with every flag and parameter
|
|
142
|
+
- model versions · H series (`tripo-v3.x`) · P series (`tripo-p1`, `tripo-p2`) · alias → wire value · GA / Legacy status · quad → `commands/generate` § "Models & Versions" (also the P Series endpoint entry points)
|
|
143
|
+
- `examples/` — copy-paste recipes per scenario (game/print/animation/...)
|
|
144
|
+
- `common-errors.md` — error table with fixes
|
|
145
|
+
|
|
146
|
+
Print any of them: `tripo docs --topic examples/game-asset`.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
actionPrefix: tripo
|
|
2
|
+
# asset(import_model), which generate imports through, ships in 1.4.16-beta.10.
|
|
3
|
+
minServerVersion: 1.4.16-beta.10
|
|
4
|
+
|
|
5
|
+
# Tripo owns a domain (AI 3D generation, rigging and animation) that fits no
|
|
6
|
+
# built-in category, so the plugin provides its own `tripo` tool. Every Tripo
|
|
7
|
+
# call goes through the tripo-cli version pinned in package.json; import into
|
|
8
|
+
# Unreal is core's job, asset(action="import_model").
|
|
9
|
+
#
|
|
10
|
+
# Auth: `tripo login` (stored in ~/.tripo) or TRIPO_API_KEY in the server
|
|
11
|
+
# environment.
|
|
12
|
+
|
|
13
|
+
registry:
|
|
14
|
+
tagline: Prompt or image to a rigged, textured Unreal character with Tripo
|
|
15
|
+
description: >-
|
|
16
|
+
Runs Tripo's own CLI from ue-mcp: one call generates a model, rigs it with
|
|
17
|
+
Unreal Mannequin bone names, optionally adds a preset animation, converts
|
|
18
|
+
it to FBX and imports it as a skeletal mesh. Every other CLI command is
|
|
19
|
+
available through a passthrough.
|
|
20
|
+
category: asset
|
|
21
|
+
tags: [tripo, ai-3d, text-to-3d, image-to-3d, rigging, skeletal-mesh]
|
|
22
|
+
|
|
23
|
+
provides:
|
|
24
|
+
tripo:
|
|
25
|
+
description: >-
|
|
26
|
+
Tripo AI 3D generation into Unreal, through the pinned tripo-cli.
|
|
27
|
+
generate turns a prompt, image or task into an imported asset; cli runs
|
|
28
|
+
any tripo command (doctor, balance, task, anim, mesh, model, ...) and
|
|
29
|
+
returns its JSON. Sign in with tripo(action="cli", args=["login","--region","ov","--no-wait"])
|
|
30
|
+
or set TRIPO_API_KEY.
|
|
31
|
+
actions:
|
|
32
|
+
generate:
|
|
33
|
+
task: tripo.generate
|
|
34
|
+
effect: mutate
|
|
35
|
+
description: >-
|
|
36
|
+
Prompt, image(s) or task ref to an imported Unreal asset. Runs one
|
|
37
|
+
`tripo make` with --for anim (rig=true, default) or --for game-pc,
|
|
38
|
+
a --then chain of rig-check, rig (biped with spec=unreal), an
|
|
39
|
+
optional retarget preset and convert:fbx, and -p pbr=true, writing
|
|
40
|
+
to <project>/Saved/Tripo/<name>. Then imports the model with
|
|
41
|
+
asset(import_model), kind=skeletal when rigged, static otherwise.
|
|
42
|
+
Returns task ids, credits, the import result and its warnings. When
|
|
43
|
+
make outlasts waitSec (or wait=false) it returns status=pending and
|
|
44
|
+
the generate(resume=<jobDir>) call that finishes the import.
|
|
45
|
+
dryRun=true returns the plan and credit estimate without spending.
|
|
46
|
+
schema:
|
|
47
|
+
prompt: { type: string, description: "Text prompt" }
|
|
48
|
+
images: { type: array, description: "Absolute image path(s) or URLs: one image, or 2 to 4 views" }
|
|
49
|
+
task: { type: string, description: "An existing Tripo task id (or @last / @name) to continue from" }
|
|
50
|
+
rig: { type: boolean, description: "Rig and import as a skeletal mesh (default true)" }
|
|
51
|
+
rigType: { type: string, description: "biped (default) | quadruped | hexapod | octopod | avian | serpentine | aquatic | others | auto (rig-check decides)" }
|
|
52
|
+
spec: { type: string, description: "Biped bone naming (default unreal): unreal | tripo | mixamo | actorcore | unity | vrm" }
|
|
53
|
+
animation: { type: string, description: "One preset animation, e.g. walk or preset:quadruped:walk" }
|
|
54
|
+
retexture: { type: boolean, description: "Add a texture step first (for an untextured task ref)" }
|
|
55
|
+
pbr: { type: boolean, description: "PBR textures (default true)" }
|
|
56
|
+
format: { type: string, description: "fbx (default, adds convert:fbx) | glb" }
|
|
57
|
+
model: { type: string, description: "Generation model, passed as --model" }
|
|
58
|
+
params: { type: array, description: "Extra make -p key=value pairs, e.g. [\"face_limit=20000\"]" }
|
|
59
|
+
then: { type: string, description: "Replace the whole --then chain" }
|
|
60
|
+
name: { type: string, description: "Asset and job folder name (default from the prompt)" }
|
|
61
|
+
wait: { type: boolean, description: "Default true; false returns pending at once" }
|
|
62
|
+
waitSec: { type: number, description: "How long this call waits for make (default 300)" }
|
|
63
|
+
dryRun: { type: boolean, description: "Plan and credit estimate only; nothing is spent" }
|
|
64
|
+
resume: { type: string, description: "jobDir from a pending result: wait for it and import" }
|
|
65
|
+
destination: { type: string, description: "Content folder (default /Game/Tripo)" }
|
|
66
|
+
kind: { type: string, description: "auto | static | skeletal (default skeletal when rigged)" }
|
|
67
|
+
importMaterials: { type: boolean }
|
|
68
|
+
importTextures: { type: boolean }
|
|
69
|
+
importAnimations: { type: boolean }
|
|
70
|
+
createPhysicsAsset: { type: boolean }
|
|
71
|
+
nanite: { type: boolean }
|
|
72
|
+
place: { type: boolean, description: "Place the import in the level (default false)" }
|
|
73
|
+
location: { type: object }
|
|
74
|
+
rotation: { type: object }
|
|
75
|
+
onConflict: { type: string }
|
|
76
|
+
save: { type: boolean }
|
|
77
|
+
|
|
78
|
+
cli:
|
|
79
|
+
task: tripo.cli
|
|
80
|
+
effect: mutate
|
|
81
|
+
description: >-
|
|
82
|
+
Run the pinned tripo-cli with args (the command line as an array,
|
|
83
|
+
e.g. ["doctor"], ["balance"], ["task","get","<id>"]). Adds --json
|
|
84
|
+
--yes --no-open unless present and returns the parsed JSON result.
|
|
85
|
+
A non-zero exit returns the CLI's error and a stderr tail. Long jobs:
|
|
86
|
+
pass --no-wait, then ["task","watch","<id>"]. Relative paths resolve
|
|
87
|
+
against <project>/Saved/Tripo.
|
|
88
|
+
schema:
|
|
89
|
+
args: { type: array, required: true, description: "tripo arguments, without the binary name" }
|
|
90
|
+
timeoutSec: { type: number, description: "Stop the CLI after this many seconds (default 300)" }
|
|
91
|
+
|
|
92
|
+
tasks:
|
|
93
|
+
tripo.generate:
|
|
94
|
+
class_path: tasks/Generate
|
|
95
|
+
description: "Prompt, image or task to an asset imported through core"
|
|
96
|
+
tripo.cli:
|
|
97
|
+
class_path: tasks/Cli
|
|
98
|
+
description: "Run any tripo-cli command and return its JSON"
|
|
99
|
+
|
|
100
|
+
knowledge:
|
|
101
|
+
tripo: knowledge/tripo.md
|