@init-computer/mcp 0.1.2 → 0.1.3
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/README.md +5 -1
- package/bin/init-mcp.js +20 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -120,4 +120,8 @@ Inspect available runtime packages and enabled connections. Filter by `category`
|
|
|
120
120
|
|
|
121
121
|
## Protocol behavior
|
|
122
122
|
|
|
123
|
-
The server uses MCP stdio transport and returns JSON text content for every tool call. It does not upload
|
|
123
|
+
The server uses MCP stdio transport and returns JSON text content for every tool call. It does not upload repository secrets; its file tool reads and writes only the explicit `init.json` path supplied to it.
|
|
124
|
+
|
|
125
|
+
## Repository init.json integration
|
|
126
|
+
|
|
127
|
+
Use `init_apply_project_file` with an explicit local `init.json` path and an edit request. The MCP server reads that one file, finds `project.id`, applies the edit to the matching Init project, and writes the canonical contract back to the same path. For agents that already have a parsed document, use `init_apply_project_manifest`; it returns the updated `initJson` without touching the filesystem.
|
package/bin/init-mcp.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
2
4
|
import readline from "node:readline";
|
|
3
5
|
import { InitApiError, createClient } from "../../sdk/dist/index.js";
|
|
4
6
|
|
|
@@ -34,6 +36,24 @@ const tools = [
|
|
|
34
36
|
inputSchema: objectSchema({ project_id: stringSchema("Project id."), prompt: stringSchema("Project change request.") }, ["project_id", "prompt"]),
|
|
35
37
|
handler: ({ project_id, prompt }) => client.project.edit(project_id, { prompt }),
|
|
36
38
|
},
|
|
39
|
+
{
|
|
40
|
+
name: "init_apply_project_manifest",
|
|
41
|
+
description: "Create a project from init.json, or apply an edit to the project identified by its init.json and return its updated canonical contract.",
|
|
42
|
+
inputSchema: objectSchema({ manifest: freeObjectSchema("The parsed init.json document."), prompt: optionalStringSchema("Change request when the manifest belongs to an existing project.") }, ["manifest"]),
|
|
43
|
+
handler: ({ manifest, prompt }) => client.project.applyInitJson(manifest, { prompt }),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "init_apply_project_file",
|
|
47
|
+
description: "Read an explicit local init.json path, apply an Init project edit, and write the returned canonical init.json back to that same path.",
|
|
48
|
+
inputSchema: objectSchema({ path: stringSchema("Absolute or working-directory-relative init.json path."), prompt: stringSchema("Project change request.") }, ["path", "prompt"]),
|
|
49
|
+
handler: async ({ path: filePath, prompt }) => {
|
|
50
|
+
const absolute = path.resolve(filePath);
|
|
51
|
+
const manifest = JSON.parse(fs.readFileSync(absolute, "utf8"));
|
|
52
|
+
const output = await client.project.applyInitJson(manifest, { prompt });
|
|
53
|
+
fs.writeFileSync(absolute, `${JSON.stringify(output.initJson, null, 2)}\n`, "utf8");
|
|
54
|
+
return { ...output.result, initJsonPath: absolute, initJsonUpdated: true };
|
|
55
|
+
},
|
|
56
|
+
},
|
|
37
57
|
{
|
|
38
58
|
name: "init_run",
|
|
39
59
|
description: "Call a generated Init API route.",
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@init-computer/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Init is a programmable backend platform available through MCP for generating and running backend APIs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"init-mcp": "
|
|
7
|
+
"init-mcp": "bin/init-mcp.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@init-computer/sdk": "0.1.
|
|
10
|
+
"@init-computer/sdk": "0.1.6"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=18"
|