@init-computer/mcp 0.1.2 → 0.1.4

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 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 local files, read repository secrets, or manage a local project directory. Use the CLI for terminal workflows and the SDK for application code.
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,6 +1,9 @@
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
- import { InitApiError, createClient } from "../../sdk/dist/index.js";
5
+ import { InitApiError, createClient } from "@init-computer/sdk";
6
+ const MCP_VERSION = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
4
7
 
5
8
  const client = createClient({
6
9
  apiKey: process.env.INIT_API_KEY,
@@ -34,6 +37,24 @@ const tools = [
34
37
  inputSchema: objectSchema({ project_id: stringSchema("Project id."), prompt: stringSchema("Project change request.") }, ["project_id", "prompt"]),
35
38
  handler: ({ project_id, prompt }) => client.project.edit(project_id, { prompt }),
36
39
  },
40
+ {
41
+ name: "init_apply_project_manifest",
42
+ 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.",
43
+ inputSchema: objectSchema({ manifest: freeObjectSchema("The parsed init.json document."), prompt: optionalStringSchema("Change request when the manifest belongs to an existing project.") }, ["manifest"]),
44
+ handler: ({ manifest, prompt }) => client.project.applyInitJson(manifest, { prompt }),
45
+ },
46
+ {
47
+ name: "init_apply_project_file",
48
+ 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.",
49
+ inputSchema: objectSchema({ path: stringSchema("Absolute or working-directory-relative init.json path."), prompt: stringSchema("Project change request.") }, ["path", "prompt"]),
50
+ handler: async ({ path: filePath, prompt }) => {
51
+ const absolute = path.resolve(filePath);
52
+ const manifest = JSON.parse(fs.readFileSync(absolute, "utf8"));
53
+ const output = await client.project.applyInitJson(manifest, { prompt });
54
+ fs.writeFileSync(absolute, `${JSON.stringify(output.initJson, null, 2)}\n`, "utf8");
55
+ return { ...output.result, initJsonPath: absolute, initJsonUpdated: true };
56
+ },
57
+ },
37
58
  {
38
59
  name: "init_run",
39
60
  description: "Call a generated Init API route.",
@@ -103,8 +124,10 @@ async function handle(request) {
103
124
  return {
104
125
  protocolVersion: "2024-11-05",
105
126
  capabilities: { tools: {} },
106
- serverInfo: { name: "init-mcp", version: "0.1.0" },
127
+ serverInfo: { name: "init-mcp", version: MCP_VERSION },
107
128
  };
129
+ case "notifications/initialized":
130
+ return {};
108
131
  case "tools/list":
109
132
  return { tools: tools.map(({ handler, ...tool }) => tool) };
110
133
  case "tools/call": {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@init-computer/mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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": "./bin/init-mcp.js"
7
+ "init-mcp": "bin/init-mcp.js"
8
8
  },
9
9
  "dependencies": {
10
- "@init-computer/sdk": "0.1.5"
10
+ "@init-computer/sdk": "0.1.7"
11
11
  },
12
12
  "engines": {
13
13
  "node": ">=18"