@ferrfleet/mcp 10.1.0 → 10.13.2
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/dist/__tests__/api-base.test.d.ts +2 -0
- package/dist/__tests__/api-base.test.d.ts.map +1 -0
- package/dist/__tests__/api-base.test.js +61 -0
- package/dist/api-base.d.ts +3 -0
- package/dist/api-base.d.ts.map +1 -1
- package/dist/api-base.js +24 -3
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +12 -0
- package/dist/tools/__tests__/writes.test.js +369 -1
- package/dist/tools/agents.d.ts +1 -0
- package/dist/tools/agents.d.ts.map +1 -1
- package/dist/tools/agents.js +112 -6
- package/dist/tools/connectors.d.ts +3 -0
- package/dist/tools/connectors.d.ts.map +1 -0
- package/dist/tools/connectors.js +64 -0
- package/dist/tools/github.d.ts +3 -0
- package/dist/tools/github.d.ts.map +1 -0
- package/dist/tools/github.js +31 -0
- package/dist/tools/marketplace.d.ts +3 -0
- package/dist/tools/marketplace.d.ts.map +1 -0
- package/dist/tools/marketplace.js +38 -0
- package/dist/tools/orgs.d.ts +3 -0
- package/dist/tools/orgs.d.ts.map +1 -0
- package/dist/tools/orgs.js +16 -0
- package/dist/tools/repos.d.ts +3 -0
- package/dist/tools/repos.d.ts.map +1 -0
- package/dist/tools/repos.js +30 -0
- package/dist/tools/runner-pools.d.ts +3 -0
- package/dist/tools/runner-pools.d.ts.map +1 -0
- package/dist/tools/runner-pools.js +11 -0
- package/dist/tools/runs.d.ts.map +1 -1
- package/dist/tools/runs.js +13 -7
- package/package.json +4 -4
- package/LICENSE +0 -373
package/dist/tools/agents.js
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { getToken, toToolText } from '@ferrlabs/mcp-core';
|
|
3
|
-
import { fleetRequest } from '../api-base.js';
|
|
3
|
+
import { fleetRequest, orgIdSchema } from '../api-base.js';
|
|
4
|
+
const RUNNER_MODES = ['managed', 'external'];
|
|
5
|
+
export const AGENT_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/;
|
|
4
6
|
export function registerAgentTools(server) {
|
|
5
|
-
server.tool('list_agents', 'List FerrFleet agents available to the authenticated user (marketplace + custom).', {}, async () => {
|
|
7
|
+
server.tool('list_agents', 'List FerrFleet agents available to the authenticated user (marketplace + custom).', { org_id: orgIdSchema }, async ({ org_id }) => {
|
|
6
8
|
const token = await getToken();
|
|
7
|
-
const agents = await fleetRequest('/agents', { token });
|
|
9
|
+
const agents = await fleetRequest('/agents', { token, orgId: org_id });
|
|
8
10
|
return {
|
|
9
11
|
content: [{ type: 'text', text: toToolText(agents) }],
|
|
10
12
|
};
|
|
11
13
|
});
|
|
12
14
|
server.tool('get_agent', 'Get full details of a FerrFleet agent (manifest, scopes, last run).', {
|
|
13
15
|
agent_id: z.string().min(1).describe('Agent id'),
|
|
14
|
-
|
|
16
|
+
org_id: orgIdSchema,
|
|
17
|
+
}, async ({ agent_id, org_id }) => {
|
|
15
18
|
const token = await getToken();
|
|
16
|
-
const agent = await fleetRequest(`/agents/${encodeURIComponent(agent_id)}`, {
|
|
19
|
+
const agent = await fleetRequest(`/agents/${encodeURIComponent(agent_id)}`, {
|
|
20
|
+
token,
|
|
21
|
+
orgId: org_id,
|
|
22
|
+
});
|
|
17
23
|
return {
|
|
18
24
|
content: [{ type: 'text', text: toToolText(agent) }],
|
|
19
25
|
};
|
|
20
26
|
});
|
|
21
27
|
server.tool('trigger_agent_run', 'Trigger a new run of a FerrFleet agent. Returns the freshly-created run id — poll get_run for status or pull get_run_transcript when finished.', {
|
|
22
28
|
agent_id: z.string().min(1).describe('Agent id'),
|
|
29
|
+
org_id: orgIdSchema,
|
|
23
30
|
input: z
|
|
24
31
|
.record(z.string(), z.unknown())
|
|
25
32
|
.optional()
|
|
@@ -29,10 +36,11 @@ export function registerAgentTools(server) {
|
|
|
29
36
|
.max(500)
|
|
30
37
|
.optional()
|
|
31
38
|
.describe('Free-text reason recorded with the run (audit trail).'),
|
|
32
|
-
}, async ({ agent_id, input, reason }) => {
|
|
39
|
+
}, async ({ agent_id, input, reason, org_id }) => {
|
|
33
40
|
const token = await getToken();
|
|
34
41
|
const run = await fleetRequest(`/agents/${encodeURIComponent(agent_id)}/runs`, {
|
|
35
42
|
token,
|
|
43
|
+
orgId: org_id,
|
|
36
44
|
method: 'POST',
|
|
37
45
|
body: { input: input ?? {}, reason: reason ?? null },
|
|
38
46
|
});
|
|
@@ -40,4 +48,102 @@ export function registerAgentTools(server) {
|
|
|
40
48
|
content: [{ type: 'text', text: toToolText(run) }],
|
|
41
49
|
};
|
|
42
50
|
});
|
|
51
|
+
server.tool('create_agent', 'Create a FerrFleet agent in the organization. The agent starts with default options and runner_mode=managed; use update_agent to change those or to set enabled.', {
|
|
52
|
+
id: z
|
|
53
|
+
.string()
|
|
54
|
+
.regex(AGENT_ID_PATTERN)
|
|
55
|
+
.describe('Unique slug: lowercase letters, digits and hyphens, 2 to 64 characters'),
|
|
56
|
+
org_id: orgIdSchema,
|
|
57
|
+
name: z.string().min(1).max(100).describe('Display name'),
|
|
58
|
+
prompt: z.string().min(1).max(20000).describe('System prompt'),
|
|
59
|
+
additional_prompt: z
|
|
60
|
+
.string()
|
|
61
|
+
.max(20000)
|
|
62
|
+
.optional()
|
|
63
|
+
.describe('Extra prompt appended to the base prompt'),
|
|
64
|
+
model: z.string().min(1).max(100).optional().describe('Model id; omit for the CLI default'),
|
|
65
|
+
working_dir: z
|
|
66
|
+
.string()
|
|
67
|
+
.min(1)
|
|
68
|
+
.max(256)
|
|
69
|
+
.optional()
|
|
70
|
+
.describe('Working directory of the run; defaults to /workdir'),
|
|
71
|
+
description: z.string().max(500).optional().describe('Short description'),
|
|
72
|
+
notify_url: z
|
|
73
|
+
.string()
|
|
74
|
+
.url()
|
|
75
|
+
.max(2048)
|
|
76
|
+
.optional()
|
|
77
|
+
.describe('Webhook notified when a run finishes'),
|
|
78
|
+
}, async ({ org_id, ...fields }) => {
|
|
79
|
+
const body = Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));
|
|
80
|
+
const token = await getToken();
|
|
81
|
+
const agent = await fleetRequest('/agents', {
|
|
82
|
+
token,
|
|
83
|
+
orgId: org_id,
|
|
84
|
+
method: 'POST',
|
|
85
|
+
body,
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
content: [{ type: 'text', text: toToolText(agent) }],
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
server.tool('update_agent', "Update a FerrFleet agent. Only the fields you pass change; at least one is required. WARNING: setting runner_mode=external stops FerrFleet starting that agent itself for every caller (schedules, webhooks and tickets stop producing runs); its own pipeline must then create and execute the runs. Use runner_mode=managed to hand it back. Setting runner_pool_id changes where the agent's runs execute: on that runner pool instead of the FerrFleet cluster. runner_pool_id=null hands the agent back to the FerrFleet cluster.", {
|
|
92
|
+
agent_id: z.string().min(1).describe('Agent id'),
|
|
93
|
+
org_id: orgIdSchema,
|
|
94
|
+
name: z.string().min(1).max(100).optional().describe('Display name'),
|
|
95
|
+
prompt: z.string().min(1).max(20000).optional().describe('System prompt'),
|
|
96
|
+
additional_prompt: z
|
|
97
|
+
.string()
|
|
98
|
+
.max(20000)
|
|
99
|
+
.optional()
|
|
100
|
+
.describe('Extra prompt appended to the base prompt'),
|
|
101
|
+
model: z
|
|
102
|
+
.string()
|
|
103
|
+
.max(100)
|
|
104
|
+
.optional()
|
|
105
|
+
.describe('Model id; an empty string restores the CLI default'),
|
|
106
|
+
working_dir: z.string().min(1).max(256).optional().describe('Working directory of the run'),
|
|
107
|
+
description: z.string().max(500).optional().describe('Short description'),
|
|
108
|
+
enabled: z.boolean().optional().describe('Whether the agent can be triggered'),
|
|
109
|
+
notify_url: z
|
|
110
|
+
.string()
|
|
111
|
+
.url()
|
|
112
|
+
.max(2048)
|
|
113
|
+
.optional()
|
|
114
|
+
.describe('Webhook notified when a run finishes'),
|
|
115
|
+
options: z
|
|
116
|
+
.record(z.string(), z.unknown())
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Replaces the whole options object; it is not merged with the existing one'),
|
|
119
|
+
runner_mode: z
|
|
120
|
+
.enum(RUNNER_MODES)
|
|
121
|
+
.optional()
|
|
122
|
+
.describe('managed: FerrFleet starts the runner. external: the caller starts it'),
|
|
123
|
+
runner_pool_id: z
|
|
124
|
+
.guid()
|
|
125
|
+
.nullable()
|
|
126
|
+
.optional()
|
|
127
|
+
.describe('Runner pool id from list_runner_pools to run this agent on; null detaches it and returns the agent to the FerrFleet cluster; omit to leave it unchanged'),
|
|
128
|
+
}, async ({ agent_id, org_id, ...fields }) => {
|
|
129
|
+
const body = Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));
|
|
130
|
+
if (Object.keys(body).length === 0) {
|
|
131
|
+
return {
|
|
132
|
+
isError: true,
|
|
133
|
+
content: [
|
|
134
|
+
{ type: 'text', text: 'update_agent needs at least one field to change.' },
|
|
135
|
+
],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const token = await getToken();
|
|
139
|
+
const agent = await fleetRequest(`/agents/${encodeURIComponent(agent_id)}`, {
|
|
140
|
+
token,
|
|
141
|
+
orgId: org_id,
|
|
142
|
+
method: 'PATCH',
|
|
143
|
+
body,
|
|
144
|
+
});
|
|
145
|
+
return {
|
|
146
|
+
content: [{ type: 'text', text: toToolText(agent) }],
|
|
147
|
+
};
|
|
148
|
+
});
|
|
43
149
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../../src/tools/connectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAK1E,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,QAiFvD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getToken, toToolText } from '@ferrlabs/mcp-core';
|
|
3
|
+
import { fleetRequest, orgIdSchema } from '../api-base.js';
|
|
4
|
+
const CONNECTOR_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 _-]{0,62}$/;
|
|
5
|
+
export function registerConnectorTools(server) {
|
|
6
|
+
server.tool('list_connectors', 'List the connectors of the organization (id, type, name, config, whether a secret is set). Secrets are never returned. Pass connector ids to set_agent_connectors.', { org_id: orgIdSchema }, async ({ org_id }) => {
|
|
7
|
+
const token = await getToken();
|
|
8
|
+
const connectors = await fleetRequest('/connectors', { token, orgId: org_id });
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: 'text', text: toToolText(connectors) }],
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
server.tool('set_agent_connectors', "Set the connectors attached to an agent. This REPLACES the agent's whole connector list: connectors not in connector_ids are detached, and an empty list detaches all of them. Every id must be a connector of the organization (see list_connectors).", {
|
|
14
|
+
agent_id: z.string().min(1).describe('Agent id'),
|
|
15
|
+
org_id: orgIdSchema,
|
|
16
|
+
connector_ids: z
|
|
17
|
+
.array(z.string().min(1))
|
|
18
|
+
.describe('The full list of connector ids the agent should have afterwards'),
|
|
19
|
+
}, async ({ agent_id, org_id, connector_ids }) => {
|
|
20
|
+
const token = await getToken();
|
|
21
|
+
await fleetRequest(`/agents/${encodeURIComponent(agent_id)}/connectors`, {
|
|
22
|
+
token,
|
|
23
|
+
orgId: org_id,
|
|
24
|
+
method: 'PUT',
|
|
25
|
+
body: { connector_ids },
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: 'text',
|
|
31
|
+
text: `Agent ${agent_id} now has ${connector_ids.length} connector(s).`,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
server.tool('update_connector', "Update a FerrFleet connector's name or config. Only the fields you pass change; at least one is required. config REPLACES the whole config object, it is not merged with the existing one. Secrets cannot be set through this server.", {
|
|
37
|
+
connector_id: z.string().min(1).describe('Connector id'),
|
|
38
|
+
org_id: orgIdSchema,
|
|
39
|
+
name: z
|
|
40
|
+
.string()
|
|
41
|
+
.regex(CONNECTOR_NAME_PATTERN)
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Display name: letters, digits, spaces, underscores and hyphens, up to 63 chars'),
|
|
44
|
+
config: z
|
|
45
|
+
.record(z.string(), z.unknown())
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('Replaces the whole config object; it is not merged with the existing one'),
|
|
48
|
+
}, async ({ connector_id, org_id, name, config }) => {
|
|
49
|
+
const body = Object.fromEntries(Object.entries({ name, config }).filter(([, value]) => value !== undefined));
|
|
50
|
+
if (Object.keys(body).length === 0) {
|
|
51
|
+
return {
|
|
52
|
+
isError: true,
|
|
53
|
+
content: [
|
|
54
|
+
{ type: 'text', text: 'update_connector needs at least one field to change.' },
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const token = await getToken();
|
|
59
|
+
const connector = await fleetRequest(`/connectors/${encodeURIComponent(connector_id)}`, { token, orgId: org_id, method: 'PATCH', body });
|
|
60
|
+
return {
|
|
61
|
+
content: [{ type: 'text', text: toToolText(connector) }],
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/tools/github.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAK1E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QAqCpD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getToken, toToolText } from '@ferrlabs/mcp-core';
|
|
3
|
+
import { fleetRequest, orgIdSchema } from '../api-base.js';
|
|
4
|
+
const CONNECTOR_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 _-]{0,62}$/;
|
|
5
|
+
export function registerGithubTools(server) {
|
|
6
|
+
server.tool('list_github_installations', 'List the GitHub App installations claimed by the organization.', { org_id: orgIdSchema }, async ({ org_id }) => {
|
|
7
|
+
const token = await getToken();
|
|
8
|
+
const installations = await fleetRequest('/github/installations', {
|
|
9
|
+
token,
|
|
10
|
+
orgId: org_id,
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
content: [{ type: 'text', text: toToolText(installations) }],
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
server.tool('create_github_connector', 'Create the GitHub connector of the organization, which repository bindings require. Orphaned installations of the organization are attached to it.', {
|
|
17
|
+
name: z.string().regex(CONNECTOR_NAME_PATTERN).describe('Connector name'),
|
|
18
|
+
org_id: orgIdSchema,
|
|
19
|
+
}, async ({ name, org_id }) => {
|
|
20
|
+
const token = await getToken();
|
|
21
|
+
const connector = await fleetRequest('/connectors', {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
body: { type: 'github', name },
|
|
24
|
+
token,
|
|
25
|
+
orgId: org_id,
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: 'text', text: toToolText(connector) }],
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/tools/marketplace.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAI1E,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,QAmDzD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getToken, toToolText } from '@ferrlabs/mcp-core';
|
|
3
|
+
import { fleetRequest, orgIdSchema } from '../api-base.js';
|
|
4
|
+
import { AGENT_ID_PATTERN } from './agents.js';
|
|
5
|
+
export function registerMarketplaceTools(server) {
|
|
6
|
+
server.tool('list_marketplace_agents', 'List the marketplace agent templates an organization can import, each flagged with whether the organization already has an agent under that id. Pass a template id to import_marketplace_agent.', { org_id: orgIdSchema }, async ({ org_id }) => {
|
|
7
|
+
const token = await getToken();
|
|
8
|
+
const templates = await fleetRequest('/marketplace/agents', {
|
|
9
|
+
token,
|
|
10
|
+
orgId: org_id,
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
content: [{ type: 'text', text: toToolText(templates) }],
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
server.tool('import_marketplace_agent', 'Import a marketplace agent template into the organization as a regular agent. The import is a copy: later edits to the template never reach it. Fails with a conflict when the organization already has an agent under the resulting id; pass id to import it under another one.', {
|
|
17
|
+
template_id: z.string().min(1).describe('Template id from list_marketplace_agents'),
|
|
18
|
+
org_id: orgIdSchema,
|
|
19
|
+
id: z
|
|
20
|
+
.string()
|
|
21
|
+
.regex(AGENT_ID_PATTERN)
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Id for the new agent: lowercase letters, digits and hyphens, 2 to 64 characters; defaults to the template id'),
|
|
24
|
+
name: z
|
|
25
|
+
.string()
|
|
26
|
+
.min(1)
|
|
27
|
+
.max(100)
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Display name; defaults to the template name'),
|
|
30
|
+
}, async ({ template_id, org_id, id, name }) => {
|
|
31
|
+
const body = Object.fromEntries(Object.entries({ id, name }).filter(([, value]) => value !== undefined));
|
|
32
|
+
const token = await getToken();
|
|
33
|
+
const agent = await fleetRequest(`/marketplace/agents/${encodeURIComponent(template_id)}/import`, { token, orgId: org_id, method: 'POST', body });
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: 'text', text: toToolText(agent) }],
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orgs.d.ts","sourceRoot":"","sources":["../../src/tools/orgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAStF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAmBjD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { apiRequest, getToken, toToolText } from '@ferrlabs/mcp-core';
|
|
2
|
+
export function registerOrgTools(server) {
|
|
3
|
+
server.tool('list_ferrfleet_orgs', 'List the organizations the authenticated user belongs to (id, name, slug, role). Pass the returned id as org_id on the other FerrFleet tools to choose which organization a call targets. The id is stable, so it can be reused for the rest of the conversation.', {}, async () => {
|
|
4
|
+
const token = await getToken();
|
|
5
|
+
const orgs = await apiRequest('/orgs', { token });
|
|
6
|
+
const summary = orgs.map(({ id, name, slug, role }) => ({
|
|
7
|
+
id,
|
|
8
|
+
name,
|
|
9
|
+
slug,
|
|
10
|
+
...(role !== undefined && { role }),
|
|
11
|
+
}));
|
|
12
|
+
return {
|
|
13
|
+
content: [{ type: 'text', text: toToolText(summary) }],
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../src/tools/repos.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAK1E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QAoClD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getToken, toToolText } from '@ferrlabs/mcp-core';
|
|
3
|
+
import { fleetRequest, orgIdSchema } from '../api-base.js';
|
|
4
|
+
const REPO_FULL_NAME_PATTERN = /^(?!\.+\/)[A-Za-z0-9_.-]+\/(?!\.+$)[A-Za-z0-9_.-]+$/;
|
|
5
|
+
export function registerRepoTools(server) {
|
|
6
|
+
server.tool('list_repo_bindings', 'List the repositories bound to FerrFleet agents. A runner pool token can only dispatch an agent on a repository bound to that agent.', { org_id: orgIdSchema }, async ({ org_id }) => {
|
|
7
|
+
const token = await getToken();
|
|
8
|
+
const bindings = await fleetRequest('/repos/bindings', { token, orgId: org_id });
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: 'text', text: toToolText(bindings) }],
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
server.tool('bind_repo', 'Bind a GitHub repository to an agent, or disable an existing binding. Requires the organization to have a GitHub connector with the repository reachable.', {
|
|
14
|
+
repo_full_name: z.string().regex(REPO_FULL_NAME_PATTERN).describe('Repository as owner/name'),
|
|
15
|
+
agent_id: z.string().min(1).describe('Agent id'),
|
|
16
|
+
enabled: z.boolean().optional().describe('Defaults to true; false disables the binding'),
|
|
17
|
+
org_id: orgIdSchema,
|
|
18
|
+
}, async ({ repo_full_name, agent_id, enabled, org_id }) => {
|
|
19
|
+
const token = await getToken();
|
|
20
|
+
const binding = await fleetRequest('/repos/bindings', {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
body: { repo_full_name, agent_id, ...(enabled === undefined ? {} : { enabled }) },
|
|
23
|
+
token,
|
|
24
|
+
orgId: org_id,
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
content: [{ type: 'text', text: toToolText(binding) }],
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-pools.d.ts","sourceRoot":"","sources":["../../src/tools/runner-pools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAG1E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAaxD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getToken, toToolText } from '@ferrlabs/mcp-core';
|
|
2
|
+
import { fleetRequest, orgIdSchema } from '../api-base.js';
|
|
3
|
+
export function registerRunnerPoolTools(server) {
|
|
4
|
+
server.tool('list_runner_pools', 'List the runner pools of the organization. Pass a pool id as runner_pool_id to update_agent to run an agent on that pool. Pools and their tokens are created and rotated in the FerrFleet UI only.', { org_id: orgIdSchema }, async ({ org_id }) => {
|
|
5
|
+
const token = await getToken();
|
|
6
|
+
const pools = await fleetRequest('/runner-pools', { token, orgId: org_id });
|
|
7
|
+
return {
|
|
8
|
+
content: [{ type: 'text', text: toToolText(pools) }],
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
}
|
package/dist/tools/runs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/tools/runs.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAa1E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/tools/runs.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAa1E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAqEjD"}
|
package/dist/tools/runs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { getToken, toToolText } from '@ferrlabs/mcp-core';
|
|
3
|
-
import { fleetRequest } from '../api-base.js';
|
|
3
|
+
import { fleetRequest, orgIdSchema } from '../api-base.js';
|
|
4
4
|
export function registerRunTools(server) {
|
|
5
5
|
server.tool('list_runs', 'List recent FerrFleet runs for the authenticated org (most recent first).', {
|
|
6
6
|
limit: z
|
|
@@ -10,28 +10,34 @@ export function registerRunTools(server) {
|
|
|
10
10
|
.max(100)
|
|
11
11
|
.optional()
|
|
12
12
|
.describe('Max runs to return (default 25)'),
|
|
13
|
-
|
|
13
|
+
org_id: orgIdSchema,
|
|
14
|
+
}, async ({ limit, org_id }) => {
|
|
14
15
|
const token = await getToken();
|
|
15
16
|
const qs = limit !== undefined ? `?limit=${limit}` : '';
|
|
16
|
-
const runs = await fleetRequest(`/runs${qs}`, { token });
|
|
17
|
+
const runs = await fleetRequest(`/runs${qs}`, { token, orgId: org_id });
|
|
17
18
|
return {
|
|
18
19
|
content: [{ type: 'text', text: toToolText(runs) }],
|
|
19
20
|
};
|
|
20
21
|
});
|
|
21
22
|
server.tool('get_run', 'Get the metadata of a single FerrFleet run (status, timing, agent, trigger). Use get_run_transcript for the captured output.', {
|
|
22
23
|
run_id: z.string().min(1).describe('Run id'),
|
|
23
|
-
|
|
24
|
+
org_id: orgIdSchema,
|
|
25
|
+
}, async ({ run_id, org_id }) => {
|
|
24
26
|
const token = await getToken();
|
|
25
|
-
const run = await fleetRequest(`/runs/${encodeURIComponent(run_id)}`, {
|
|
27
|
+
const run = await fleetRequest(`/runs/${encodeURIComponent(run_id)}`, {
|
|
28
|
+
token,
|
|
29
|
+
orgId: org_id,
|
|
30
|
+
});
|
|
26
31
|
return {
|
|
27
32
|
content: [{ type: 'text', text: toToolText(run) }],
|
|
28
33
|
};
|
|
29
34
|
});
|
|
30
35
|
server.tool('get_run_transcript', 'Get the full captured transcript of a FerrFleet run — every event the runner emitted, in order. Heavy for long runs; consider get_run first to confirm the run is interesting before pulling the transcript.', {
|
|
31
36
|
run_id: z.string().min(1).describe('Run id'),
|
|
32
|
-
|
|
37
|
+
org_id: orgIdSchema,
|
|
38
|
+
}, async ({ run_id, org_id }) => {
|
|
33
39
|
const token = await getToken();
|
|
34
|
-
const transcript = await fleetRequest(`/runs/${encodeURIComponent(run_id)}/transcript`, { token });
|
|
40
|
+
const transcript = await fleetRequest(`/runs/${encodeURIComponent(run_id)}/transcript`, { token, orgId: org_id });
|
|
35
41
|
return {
|
|
36
42
|
content: [
|
|
37
43
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ferrfleet/mcp",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.13.2",
|
|
4
4
|
"description": "Model Context Protocol server for FerrFleet: agents, runs, skills",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"model-context-protocol"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ferrlabs/mcp-core": "^10.
|
|
25
|
+
"@ferrlabs/mcp-core": "^10.14.0",
|
|
26
26
|
"zod": "^4.3.6"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/FerrLabs/
|
|
34
|
-
"directory": "packages/ferrfleet-mcp"
|
|
33
|
+
"url": "https://github.com/FerrLabs/FerrFleet.git",
|
|
34
|
+
"directory": "mcp/packages/ferrfleet-mcp"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc",
|