@foundation0/api 1.1.7 → 1.1.10

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/mcp/cli.ts CHANGED
@@ -67,9 +67,6 @@ const parseListArg = (value: string | undefined): string[] => {
67
67
  const serverName = getArgValue('--server-name', 'f0-mcp')
68
68
  const serverVersion = getArgValue('--server-version', '1.0.0')
69
69
  const toolsPrefix = getArgValue('--tools-prefix') ?? process.env.MCP_TOOLS_PREFIX
70
- const repoName = getArgValue('--repo-name') ?? process.env.MCP_REPO_NAME ?? process.env.F0_REPO_NAME
71
- const repoRoot =
72
- getArgValue('--repo-root') ?? process.env.MCP_REPO_ROOT ?? process.env.F0_REPO_ROOT
73
70
  const allowedRootEndpoints = parseListArg(
74
71
  getArgValue('--allowed-root-endpoints') ?? process.env.MCP_ALLOWED_ROOT_ENDPOINTS,
75
72
  )
@@ -83,11 +80,6 @@ if (hasFlag('--help') || hasFlag('-h')) {
83
80
  console.log(' --server-name <name>')
84
81
  console.log(' --server-version <version>')
85
82
  console.log(' --tools-prefix <prefix>')
86
- console.log(' --repo-name <name>')
87
- console.log(' Default repoName used by tool calls when omitted. Env: MCP_REPO_NAME or F0_REPO_NAME.')
88
- console.log(' --repo-root <path>')
89
- console.log(' Default repo root on the server filesystem (contains /api and /projects).')
90
- console.log(' Env: MCP_REPO_ROOT or F0_REPO_ROOT.')
91
83
  console.log(' --allowed-root-endpoints <csv>')
92
84
  console.log(' Example: --allowed-root-endpoints projects')
93
85
  console.log(' Example: --allowed-root-endpoints agents,projects')
@@ -104,8 +96,6 @@ void runExampleMcpServer({
104
96
  serverName: serverName ?? undefined,
105
97
  serverVersion: serverVersion ?? undefined,
106
98
  toolsPrefix,
107
- repoRoot: repoRoot ?? undefined,
108
- repoName: repoName ?? undefined,
109
99
  allowedRootEndpoints,
110
100
  disableWrite,
111
101
  enableIssues,
package/mcp/manual.md CHANGED
@@ -1,161 +1,161 @@
1
- # Foundation0 MCP Tool-Calling Manual (for LLMs)
2
-
3
- This is a **tool-calling guide** for the Foundation0 MCP server in `api/mcp/*`.
4
- Assume the server is already configured in your MCP host and you can call its tools.
5
-
6
- ## 0) Golden rules
7
-
8
- 1. If you are unsure about a tool name, call `mcp.listTools` first and use the exact name it returns (prefixes vary).
9
- 2. Use `mcp.describeTool` before your first call to a tool to get the input schema + an example payload.
10
- 3. Prefer named keys when possible (e.g. `projectName`, `repoName`) rather than relying on positional `args`.
11
- 4. `repoName` selects the repo workspace on the **server filesystem**. Usually omit it and let the server use its default. Legacy path aliases: `repoRoot` / `processRoot`.
12
- 5. Tool results are returned as a **JSON text envelope**: parse the text as JSON and check `ok`.
13
-
14
- Note: If youre unsure what the server can see (cwd/default repoRoot/available repoName values), call `mcp.workspace`. Multi-repo `repoName` mappings can be configured server-side via `MCP_REPOS` (JSON object or `name=path;name=path`).
15
-
16
- ## 1) Tool naming (prefixes + aliases)
17
-
18
- Depending on how the server was started, tool names may be:
19
-
20
- - unprefixed: `projects.listProjects`
21
- - prefixed: `api.projects.listProjects`
22
-
23
- The server usually exposes both when a prefix is set, but do not assume: **discover at runtime** via `mcp.listTools`.
24
-
25
- Some tools also have OpenAI-safe underscore aliases (no dots). Example:
26
-
27
- - `net.curl` may also be available as `net_curl`
28
-
29
- ## 2) The 4 discovery calls
30
-
31
- ### A) List all tools
32
-
33
- Tool call:
34
-
35
- ```json
36
- { "name": "mcp.listTools", "arguments": {} }
37
- ```
38
-
39
- ### B) Describe one tool (schema + example)
40
-
41
- Tool call (prefixed or unprefixed names both work here):
42
-
43
- ```json
44
- { "name": "mcp.describeTool", "arguments": { "args": ["projects.listProjects"] } }
45
- ```
46
-
47
- ### C) `mcp.search` for "search docs/spec" requests
48
-
49
- Tool call:
50
-
51
- ```json
52
- {
53
- "name": "mcp.search",
54
- "arguments": {
55
- "projectName": "<project-name>",
56
- "section": "spec",
57
- "pattern": "authentication",
58
- "repoName": "<repo-name>",
59
- "ignoreCase": true,
60
- "maxCount": 50
61
- }
62
- }
63
- ```
64
-
65
- ### D) `mcp.workspace` to debug repoName/repoRoot/cwd issues
66
-
67
- Tool call:
68
-
69
- ```json
70
- { "name": "mcp.workspace", "arguments": {} }
71
- ```
72
-
73
- ## 3) Payload shapes (important)
74
-
75
- Most tools accept either:
76
-
77
- ```json
78
- { "args": ["<project-name>"], "options": { "repoName": "<repo-name>" } }
79
- ```
80
-
81
- or named keys (recommended). The server merges top-level keys into `options`:
82
-
83
- ```json
84
- { "projectName": "<project-name>", "repoName": "<repo-name>" }
85
- ```
86
-
87
- Guideline: if a tool has a natural named parameter (`projectName`, `agentName`, `target`, `taskRef`), pass it explicitly.
88
-
89
- ## 4) Common calls (examples)
90
-
91
- ### A) List projects
92
-
93
- ```json
94
- {
95
- "name": "projects.listProjects",
96
- "arguments": { "repoName": "<repo-name>" }
97
- }
98
- ```
99
-
100
- ### B) List agents
101
-
102
- ```json
103
- {
104
- "name": "agents.listAgents",
105
- "arguments": { "repoName": "<repo-name>" }
106
- }
107
- ```
108
-
109
- ### C) Set an active file (projects)
110
-
111
- ```json
112
- {
113
- "name": "projects.setActive",
114
- "arguments": {
115
- "args": ["<project-name>", "/implementation-plan.v0.0.1"],
116
- "options": { "repoName": "<repo-name>", "latest": true }
117
- }
118
- }
119
- ```
120
-
121
- ### D) Batch multiple calls
122
-
123
- Call `batch` (or `<prefix>.batch`) to run multiple tool calls:
124
-
125
- ```json
126
- {
127
- "name": "batch",
128
- "arguments": {
129
- "calls": [
130
- { "tool": "projects.usage" },
131
- { "tool": "projects.listProjects", "options": { "repoName": "<repo-name>" } }
132
- ],
133
- "continueOnError": true,
134
- "maxConcurrency": 4
135
- }
136
- }
137
- ```
138
-
139
- ## 5) Reading responses (envelopes + errors)
140
-
141
- Tool results are returned as text containing JSON like:
142
-
143
- - success: `{ "ok": true, "result": ... }`
144
- - error: `{ "ok": false, "error": { "message": "...", "details": { ... } } }`
145
-
146
- If you get:
147
-
148
- - **Unknown tool**: use the `suggestions` from the error (when present), or call `mcp.listTools` again and retry.
149
- - **Missing project name**: pass `projectName` (or set `args[0]`).
150
- - **Project folder not found: ...projects/.../projects/...**: call `mcp.workspace` and verify the server repo workspace (default `repoRoot`, and optional `repoName` mapping).
151
- - **`projects.listProjects()` returns `[]` unexpectedly**: call `mcp.workspace` to confirm the servers `cwd`/default `repoRoot` and whether `/projects` exists.
152
-
153
- ## 6) Tool availability (read/write/admin)
154
-
155
- The server can be started in modes that hide tools:
156
-
157
- - read-only mode removes write-capable tools
158
- - admin-only tools are hidden unless the server is started in admin mode
159
- - root namespaces can be whitelisted (so entire namespaces may be missing)
160
-
161
- If a tool is not listed by `mcp.listTools`, you cannot call it in the current server configuration.
1
+ # Foundation0 MCP Tool-Calling Manual (for LLMs)
2
+
3
+ This is a **tool-calling guide** for the Foundation0 MCP server in `api/mcp/*`.
4
+ Assume the server is already configured in your MCP host and you can call its tools.
5
+
6
+ ## 0) Golden rules
7
+
8
+ 1. If you are unsure about a tool name, call `mcp.listTools` first and use the exact name it returns (prefixes vary).
9
+ 2. Use `mcp.describeTool` before your first call to a tool to get the input schema + an example payload.
10
+ 3. Prefer named keys when possible (e.g. `projectName`, `repoName`) rather than relying on positional `args`.
11
+ 4. `repoName` selects the active Git workspace identity. Use `adl` or `F0/adl`, or omit it to use the server default.
12
+ 5. Tool results are returned as a **JSON text envelope**: parse the text as JSON and check `ok`.
13
+
14
+ Note: If you're unsure what the server can see (cwd/workspaceRoot/available repoName values), call `mcp.workspace`.
15
+
16
+ ## 1) Tool naming (prefixes + aliases)
17
+
18
+ Depending on how the server was started, tool names may be:
19
+
20
+ - unprefixed: `projects.listProjects`
21
+ - prefixed: `api.projects.listProjects`
22
+
23
+ The server usually exposes both when a prefix is set, but do not assume: **discover at runtime** via `mcp.listTools`.
24
+
25
+ Some tools also have OpenAI-safe underscore aliases (no dots). Example:
26
+
27
+ - `net.curl` may also be available as `net_curl`
28
+
29
+ ## 2) The 4 discovery calls
30
+
31
+ ### A) List all tools
32
+
33
+ Tool call:
34
+
35
+ ```json
36
+ { "name": "mcp.listTools", "arguments": {} }
37
+ ```
38
+
39
+ ### B) Describe one tool (schema + example)
40
+
41
+ Tool call (prefixed or unprefixed names both work here):
42
+
43
+ ```json
44
+ { "name": "mcp.describeTool", "arguments": { "args": ["projects.listProjects"] } }
45
+ ```
46
+
47
+ ### C) `mcp.search` for "search docs/spec" requests
48
+
49
+ Tool call:
50
+
51
+ ```json
52
+ {
53
+ "name": "mcp.search",
54
+ "arguments": {
55
+ "projectName": "<project-name>",
56
+ "section": "spec",
57
+ "pattern": "authentication",
58
+ "repoName": "<repo-name>",
59
+ "ignoreCase": true,
60
+ "maxCount": 50
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### D) `mcp.workspace` to debug repoName/workspaceRoot/cwd issues
66
+
67
+ Tool call:
68
+
69
+ ```json
70
+ { "name": "mcp.workspace", "arguments": {} }
71
+ ```
72
+
73
+ ## 3) Payload shapes (important)
74
+
75
+ Most tools accept either:
76
+
77
+ ```json
78
+ { "args": ["<project-name>"], "options": { "repoName": "<repo-name>" } }
79
+ ```
80
+
81
+ or named keys (recommended). The server merges top-level keys into `options`:
82
+
83
+ ```json
84
+ { "projectName": "<project-name>", "repoName": "<repo-name>" }
85
+ ```
86
+
87
+ Guideline: if a tool has a natural named parameter (`projectName`, `agentName`, `target`, `taskRef`), pass it explicitly.
88
+
89
+ ## 4) Common calls (examples)
90
+
91
+ ### A) List projects
92
+
93
+ ```json
94
+ {
95
+ "name": "projects.listProjects",
96
+ "arguments": { "repoName": "<repo-name>" }
97
+ }
98
+ ```
99
+
100
+ ### B) List agents
101
+
102
+ ```json
103
+ {
104
+ "name": "agents.listAgents",
105
+ "arguments": { "repoName": "<repo-name>" }
106
+ }
107
+ ```
108
+
109
+ ### C) Set an active file (projects)
110
+
111
+ ```json
112
+ {
113
+ "name": "projects.setActive",
114
+ "arguments": {
115
+ "args": ["<project-name>", "/implementation-plan.v0.0.1"],
116
+ "options": { "repoName": "<repo-name>", "latest": true }
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### D) Batch multiple calls
122
+
123
+ Call `batch` (or `<prefix>.batch`) to run multiple tool calls:
124
+
125
+ ```json
126
+ {
127
+ "name": "batch",
128
+ "arguments": {
129
+ "calls": [
130
+ { "tool": "projects.usage" },
131
+ { "tool": "projects.listProjects", "options": { "repoName": "<repo-name>" } }
132
+ ],
133
+ "continueOnError": true,
134
+ "maxConcurrency": 4
135
+ }
136
+ }
137
+ ```
138
+
139
+ ## 5) Reading responses (envelopes + errors)
140
+
141
+ Tool results are returned as text containing JSON like:
142
+
143
+ - success: `{ "ok": true, "result": ... }`
144
+ - error: `{ "ok": false, "error": { "message": "...", "details": { ... } } }`
145
+
146
+ If you get:
147
+
148
+ - **Unknown tool**: use the `suggestions` from the error (when present), or call `mcp.listTools` again and retry.
149
+ - **Missing project name**: pass `projectName` (or set `args[0]`).
150
+ - **Project folder not found**: call `mcp.workspace` and verify `workspaceRoot` plus `availableRepoNames` (use `adl` or `F0/adl`).
151
+ - **`projects.listProjects()` returns `[]` unexpectedly**: call `mcp.workspace` to confirm the server's `cwd`, `workspaceRoot`, and whether `/projects` exists.
152
+
153
+ ## 6) Tool availability (read/write/admin)
154
+
155
+ The server can be started in modes that hide tools:
156
+
157
+ - read-only mode removes write-capable tools
158
+ - admin-only tools are hidden unless the server is started in admin mode
159
+ - root namespaces can be whitelisted (so entire namespaces may be missing)
160
+
161
+ If a tool is not listed by `mcp.listTools`, you cannot call it in the current server configuration.