@init-computer/mcp 0.1.1 → 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.
Files changed (3) hide show
  1. package/README.md +114 -14
  2. package/bin/init-mcp.js +20 -0
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,10 +1,8 @@
1
1
  # Init MCP
2
2
 
3
- Use Init from any MCP-compatible assistant or development tool. Init turns a natural-language request into a deployed backend endpoint or project, then lets you run and inspect the result.
3
+ Use Init from any MCP-compatible assistant or development tool. Init turns a natural-language request into a deployed backend endpoint or project and returns structured JSON with routes, schemas, versions, and results.
4
4
 
5
- Init is a programmable backend platform: describe the capability you need, and Init creates and operates the API, data, storage, and runtime behind it.
6
-
7
- Documentation: [Init.computer](https://www.init.computer)
5
+ Documentation: [Init.computer](https://init.computer)
8
6
 
9
7
  ## Install
10
8
 
@@ -12,16 +10,118 @@ Documentation: [Init.computer](https://www.init.computer)
12
10
  npm install -g @init-computer/mcp
13
11
  ```
14
12
 
15
- Set `INIT_API_KEY` in the MCP process environment, then register the `init-mcp` command with your MCP client.
13
+ Requires Node.js 18 or later.
14
+
15
+ ## Configure authentication
16
+
17
+ The MCP server is stateless and reads the API key from its process environment. It never stores the key itself:
18
+
19
+ ```bash
20
+ export INIT_API_KEY=init_sk_...
21
+ export INIT_API_BASE_URL=https://api.init.computer
22
+ ```
23
+
24
+ Keep the key in the MCP client's secret/environment configuration, not in a prompt or checked-in file.
25
+
26
+ ## Register with an MCP client
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "init": {
32
+ "command": "init-mcp",
33
+ "env": {
34
+ "INIT_API_KEY": "init_sk_...",
35
+ "INIT_API_BASE_URL": "https://api.init.computer"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ Run the server directly for a stdio client:
43
+
44
+ ```bash
45
+ init-mcp
46
+ ```
47
+
48
+ ## Tools
49
+
50
+ ### `init_generate`
51
+
52
+ Create an endpoint, or create a new version of an existing endpoint with `resource_id`.
53
+
54
+ ```json
55
+ {
56
+ "prompt": "Create an API that reviews source code for security issues.",
57
+ "resource_id": "optional-resource-id",
58
+ "projects": ["Security"]
59
+ }
60
+ ```
61
+
62
+ ### `init_generate_project`
63
+
64
+ Create a project and a cohesive endpoint suite.
65
+
66
+ ```json
67
+ {
68
+ "name": "Customer Support",
69
+ "prompt": "Build ticket intake and status lookup."
70
+ }
71
+ ```
72
+
73
+ ### `init_edit_project`
74
+
75
+ Add endpoints or create new endpoint versions in an existing project.
76
+
77
+ ```json
78
+ {
79
+ "project_id": "project_uuid",
80
+ "prompt": "Add ticket assignment."
81
+ }
82
+ ```
83
+
84
+ ### `init_run`
85
+
86
+ Call a generated endpoint by route, `/vN/...` path, or full URL.
87
+
88
+ ```json
89
+ {
90
+ "route": "abc123",
91
+ "version": 1,
92
+ "input": { "topic": "sports players" },
93
+ "requestFormat": "json"
94
+ }
95
+ ```
96
+
97
+ ### `init_list_resources`
98
+
99
+ List the authenticated user's generated resources. Optional filters such as `q` and `status` are passed through.
100
+
101
+ ```json
102
+ { "q": "sales", "status": "enabled" }
103
+ ```
104
+
105
+ ### `init_get_resource`
106
+
107
+ Fetch one resource by id:
108
+
109
+ ```json
110
+ { "id": "resource_uuid" }
111
+ ```
112
+
113
+ ### `init_list_packages`
114
+
115
+ Inspect available runtime packages and enabled connections. Filter by `category`, for example `Database` or `Storage`.
116
+
117
+ ```json
118
+ { "category": "Database" }
119
+ ```
120
+
121
+ ## Protocol behavior
16
122
 
17
- ## Available tools
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.
18
124
 
19
- - `init_generate` — create an endpoint from a prompt, optionally attaching it to existing projects.
20
- - `init_generate_project` — create a project and a cohesive endpoint suite.
21
- - `init_edit_project` — add endpoints or create new endpoint versions in a project.
22
- - `init_run` — call a generated endpoint.
23
- - `init_list_resources` — list generated endpoints.
24
- - `init_get_resource` — inspect one generated endpoint.
25
- - `init_list_packages` — inspect the available capability packages.
125
+ ## Repository init.json integration
26
126
 
27
- Init returns structured JSON for every tool call, including endpoint routes, schemas, versions, and results.
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.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": "./bin/init-mcp.js"
7
+ "init-mcp": "bin/init-mcp.js"
8
8
  },
9
9
  "dependencies": {
10
- "@init-computer/sdk": "0.1.4"
10
+ "@init-computer/sdk": "0.1.6"
11
11
  },
12
12
  "engines": {
13
13
  "node": ">=18"