@adrive/mcp-server 0.3.0 → 0.4.0
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/api-client.d.ts +39 -0
- package/dist/api-client.js +14 -0
- package/dist/index.js +10 -2
- package/dist/tools/drive-sandbox-clone.d.ts +19 -0
- package/dist/tools/drive-sandbox-clone.js +20 -0
- package/dist/tools/drive-sandbox-commit.d.ts +19 -0
- package/dist/tools/drive-sandbox-commit.js +24 -0
- package/dist/tools/drive-sandbox-exec.d.ts +19 -0
- package/dist/tools/drive-sandbox-exec.js +23 -0
- package/dist/tools/drive-sandbox-read.d.ts +15 -0
- package/dist/tools/drive-sandbox-read.js +15 -0
- package/package.json +2 -2
package/dist/api-client.d.ts
CHANGED
|
@@ -233,5 +233,44 @@ export declare class ApiClient {
|
|
|
233
233
|
run_id: string;
|
|
234
234
|
created_at: number;
|
|
235
235
|
}>;
|
|
236
|
+
sandboxClone(workspaceId: string, body: {
|
|
237
|
+
url: string;
|
|
238
|
+
branch?: string;
|
|
239
|
+
depth?: number;
|
|
240
|
+
}): Promise<{
|
|
241
|
+
workspace_id: string;
|
|
242
|
+
repo_url?: string;
|
|
243
|
+
branch?: string;
|
|
244
|
+
head_sha?: string;
|
|
245
|
+
last_active_at?: number;
|
|
246
|
+
}>;
|
|
247
|
+
sandboxExec(workspaceId: string, body: {
|
|
248
|
+
cmd: string;
|
|
249
|
+
cwd?: string;
|
|
250
|
+
timeout_ms?: number;
|
|
251
|
+
}): Promise<{
|
|
252
|
+
exit_code: number;
|
|
253
|
+
stdout: string;
|
|
254
|
+
stderr: string;
|
|
255
|
+
duration_ms: number;
|
|
256
|
+
truncated: boolean;
|
|
257
|
+
}>;
|
|
258
|
+
sandboxRead(workspaceId: string, path: string): Promise<{
|
|
259
|
+
content: string;
|
|
260
|
+
size: number;
|
|
261
|
+
truncated: boolean;
|
|
262
|
+
}>;
|
|
263
|
+
sandboxCommit(workspaceId: string, body: {
|
|
264
|
+
message: string;
|
|
265
|
+
author?: {
|
|
266
|
+
name: string;
|
|
267
|
+
email: string;
|
|
268
|
+
};
|
|
269
|
+
}): Promise<{
|
|
270
|
+
commit_sha: string;
|
|
271
|
+
branch: string;
|
|
272
|
+
files_changed: number;
|
|
273
|
+
artifact_path: string;
|
|
274
|
+
}>;
|
|
236
275
|
}
|
|
237
276
|
export {};
|
package/dist/api-client.js
CHANGED
|
@@ -195,4 +195,18 @@ export class ApiClient {
|
|
|
195
195
|
async logRun(body) {
|
|
196
196
|
return this.request('POST', '/runs', body);
|
|
197
197
|
}
|
|
198
|
+
// --- Sandbox (Wave 5 Stream D) ---
|
|
199
|
+
async sandboxClone(workspaceId, body) {
|
|
200
|
+
return this.request('POST', `/workspaces/${workspaceId}/sandbox/clone`, body);
|
|
201
|
+
}
|
|
202
|
+
async sandboxExec(workspaceId, body) {
|
|
203
|
+
return this.request('POST', `/workspaces/${workspaceId}/sandbox/exec`, body);
|
|
204
|
+
}
|
|
205
|
+
async sandboxRead(workspaceId, path) {
|
|
206
|
+
const cleaned = path.startsWith('/') ? path : `/${path}`;
|
|
207
|
+
return this.request('GET', `/workspaces/${workspaceId}/sandbox/files${cleaned}`);
|
|
208
|
+
}
|
|
209
|
+
async sandboxCommit(workspaceId, body) {
|
|
210
|
+
return this.request('POST', `/workspaces/${workspaceId}/sandbox/commit`, body);
|
|
211
|
+
}
|
|
198
212
|
}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,10 @@ import { driveSearchSchema, driveSearch } from './tools/drive-search.js';
|
|
|
18
18
|
import { driveRecallSchema, driveRecall } from './tools/drive-recall.js';
|
|
19
19
|
import { driveLogRunSchema, driveLogRun } from './tools/drive-log-run.js';
|
|
20
20
|
import { driveContextSchema, driveContext } from './tools/drive-context.js';
|
|
21
|
+
import { driveSandboxCloneSchema, driveSandboxClone } from './tools/drive-sandbox-clone.js';
|
|
22
|
+
import { driveSandboxExecSchema, driveSandboxExec } from './tools/drive-sandbox-exec.js';
|
|
23
|
+
import { driveSandboxReadSchema, driveSandboxRead } from './tools/drive-sandbox-read.js';
|
|
24
|
+
import { driveSandboxCommitSchema, driveSandboxCommit } from './tools/drive-sandbox-commit.js';
|
|
21
25
|
const BASE_URL = process.env.AGENTDRIVE_API_URL || 'https://app.agentdrive.sh';
|
|
22
26
|
const API_KEY = process.env.AGENTDRIVE_API_KEY;
|
|
23
27
|
const AGENT_PLATFORM = process.env.AGENTDRIVE_AGENT_PLATFORM || 'claude-code';
|
|
@@ -34,8 +38,8 @@ const client = new ApiClient({
|
|
|
34
38
|
});
|
|
35
39
|
const server = new McpServer({
|
|
36
40
|
name: 'agentdrive',
|
|
37
|
-
version: '0.
|
|
38
|
-
description: 'AgentDrive — the persistent workspace your agents share across Claude Code, Codex, Cursor, and LangGraph. Files, semantic search, run logging,
|
|
41
|
+
version: '0.4.0',
|
|
42
|
+
description: 'AgentDrive — the persistent workspace your agents share across Claude Code, Codex, Cursor, and LangGraph. Files, semantic search, run logging, cross-platform memory, and per-workspace Linux sandbox with git worktree.',
|
|
39
43
|
});
|
|
40
44
|
server.tool('drive_write', 'Write a markdown file to a workspace. Creates or updates the file with automatic versioning.', driveWriteSchema, (args) => driveWrite(client, args));
|
|
41
45
|
server.tool('drive_read', 'Read a file\'s content from a workspace.', driveReadSchema, (args) => driveRead(client, args));
|
|
@@ -53,6 +57,10 @@ server.tool('drive_search', "Semantic search across your org's artifacts in Agen
|
|
|
53
57
|
server.tool('drive_recall', 'Recall persistent facts and preferences your agents have written. In v1 this returns semantic search results across artifacts; v1.5 will narrow to auto-extracted facts (preferences, decisions, key entities).', driveRecallSchema, (args) => driveRecall(client, args));
|
|
54
58
|
server.tool('drive_log_run', "Log an agent run to AgentDrive's provenance store. Captures task, status, referenced/produced artifacts, and cross-platform identity (which agent on which tool). Used for retrospective context retrieval and team-wide audit.", driveLogRunSchema, (args) => driveLogRun(client, args));
|
|
55
59
|
server.tool('drive_context', 'Auto-pull the most relevant artifacts from prior agent sessions for the task you are about to do. Combines semantic relevance with recency. Call this at the START of any non-trivial task to ground the agent in prior context — replaces manual copy-paste of artifacts between sessions.', driveContextSchema, (args) => driveContext(client, args));
|
|
60
|
+
server.tool('drive_sandbox_clone', 'Clone a git repo into a per-workspace Linux sandbox. The sandbox persists across MCP sessions for the workspace. Use this to set up a real dev environment your other agents can also drive.', driveSandboxCloneSchema, (args) => driveSandboxClone(client, args));
|
|
61
|
+
server.tool('drive_sandbox_exec', 'Run a shell command inside the per-workspace Linux sandbox. Captures stdout/stderr (64KB cap), exit code, and duration. Use for `npm install`, running tests, file ops — any real dev workflow.', driveSandboxExecSchema, (args) => driveSandboxExec(client, args));
|
|
62
|
+
server.tool('drive_sandbox_read', 'Read a file from the per-workspace sandbox filesystem (e.g., generated build artifacts, test output, log files).', driveSandboxReadSchema, (args) => driveSandboxRead(client, args));
|
|
63
|
+
server.tool('drive_sandbox_commit', 'Stage + commit the current sandbox worktree. The commit surfaces as an AgentDrive artifact at commits/<sha>.json with cross-agent provenance — other agents on other platforms can see who shipped what.', driveSandboxCommitSchema, (args) => driveSandboxCommit(client, args));
|
|
56
64
|
async function main() {
|
|
57
65
|
const transport = new StdioServerTransport();
|
|
58
66
|
await server.connect(transport);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApiClient } from '../api-client.js';
|
|
3
|
+
export declare const driveSandboxCloneSchema: {
|
|
4
|
+
workspace_id: z.ZodString;
|
|
5
|
+
url: z.ZodString;
|
|
6
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
7
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
};
|
|
9
|
+
export declare function driveSandboxClone(client: ApiClient, args: {
|
|
10
|
+
workspace_id: string;
|
|
11
|
+
url: string;
|
|
12
|
+
branch?: string;
|
|
13
|
+
depth?: number;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const driveSandboxCloneSchema = {
|
|
3
|
+
workspace_id: z.string().describe('Workspace to clone into. The sandbox persists across MCP sessions per workspace.'),
|
|
4
|
+
url: z.string().url().describe('Git repository URL to clone'),
|
|
5
|
+
branch: z.string().optional().describe('Branch to check out (default: repo default)'),
|
|
6
|
+
depth: z.number().int().positive().max(50).optional().describe('Shallow clone depth (default: full clone)'),
|
|
7
|
+
};
|
|
8
|
+
export async function driveSandboxClone(client, args) {
|
|
9
|
+
const state = await client.sandboxClone(args.workspace_id, {
|
|
10
|
+
url: args.url,
|
|
11
|
+
branch: args.branch,
|
|
12
|
+
depth: args.depth,
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
content: [{
|
|
16
|
+
type: 'text',
|
|
17
|
+
text: `Cloned ${state.repo_url}${state.branch ? '@' + state.branch : ''} into workspace ${state.workspace_id}.`,
|
|
18
|
+
}],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApiClient } from '../api-client.js';
|
|
3
|
+
export declare const driveSandboxCommitSchema: {
|
|
4
|
+
workspace_id: z.ZodString;
|
|
5
|
+
message: z.ZodString;
|
|
6
|
+
author_name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
author_email: z.ZodOptional<z.ZodString>;
|
|
8
|
+
};
|
|
9
|
+
export declare function driveSandboxCommit(client: ApiClient, args: {
|
|
10
|
+
workspace_id: string;
|
|
11
|
+
message: string;
|
|
12
|
+
author_name?: string;
|
|
13
|
+
author_email?: string;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const driveSandboxCommitSchema = {
|
|
3
|
+
workspace_id: z.string().describe('Workspace whose sandbox to commit'),
|
|
4
|
+
message: z.string().min(1).max(500).describe('Commit message'),
|
|
5
|
+
author_name: z.string().optional().describe('Override git author name (default: agent identity)'),
|
|
6
|
+
author_email: z.string().email().optional().describe('Override git author email (default: agent identity)'),
|
|
7
|
+
};
|
|
8
|
+
export async function driveSandboxCommit(client, args) {
|
|
9
|
+
const author = args.author_name && args.author_email
|
|
10
|
+
? { name: args.author_name, email: args.author_email }
|
|
11
|
+
: undefined;
|
|
12
|
+
const result = await client.sandboxCommit(args.workspace_id, {
|
|
13
|
+
message: args.message,
|
|
14
|
+
author,
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
content: [{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: `Committed ${result.commit_sha.slice(0, 8)} on ${result.branch} ` +
|
|
20
|
+
`(${result.files_changed} file${result.files_changed === 1 ? '' : 's'} changed). ` +
|
|
21
|
+
`Surfaced as AgentDrive artifact at ${result.artifact_path}.`,
|
|
22
|
+
}],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApiClient } from '../api-client.js';
|
|
3
|
+
export declare const driveSandboxExecSchema: {
|
|
4
|
+
workspace_id: z.ZodString;
|
|
5
|
+
cmd: z.ZodString;
|
|
6
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
7
|
+
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
};
|
|
9
|
+
export declare function driveSandboxExec(client: ApiClient, args: {
|
|
10
|
+
workspace_id: string;
|
|
11
|
+
cmd: string;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
timeout_ms?: number;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const driveSandboxExecSchema = {
|
|
3
|
+
workspace_id: z.string().describe('Workspace whose sandbox to run in'),
|
|
4
|
+
cmd: z.string().min(1).max(2048).describe('Shell command to run inside the per-workspace Linux sandbox'),
|
|
5
|
+
cwd: z.string().optional().describe('Working directory (default: workspace root)'),
|
|
6
|
+
timeout_ms: z.number().int().positive().max(60_000).optional().describe('Max runtime in ms (default 30000, hard cap 60000)'),
|
|
7
|
+
};
|
|
8
|
+
export async function driveSandboxExec(client, args) {
|
|
9
|
+
const result = await client.sandboxExec(args.workspace_id, {
|
|
10
|
+
cmd: args.cmd,
|
|
11
|
+
cwd: args.cwd,
|
|
12
|
+
timeout_ms: args.timeout_ms,
|
|
13
|
+
});
|
|
14
|
+
const header = `exit=${result.exit_code} duration=${result.duration_ms}ms${result.truncated ? ' [output truncated to 64KB]' : ''}`;
|
|
15
|
+
const stdoutBlock = result.stdout ? `\n--- stdout ---\n${result.stdout}` : '';
|
|
16
|
+
const stderrBlock = result.stderr ? `\n--- stderr ---\n${result.stderr}` : '';
|
|
17
|
+
return {
|
|
18
|
+
content: [{
|
|
19
|
+
type: 'text',
|
|
20
|
+
text: `${header}${stdoutBlock}${stderrBlock}`,
|
|
21
|
+
}],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApiClient } from '../api-client.js';
|
|
3
|
+
export declare const driveSandboxReadSchema: {
|
|
4
|
+
workspace_id: z.ZodString;
|
|
5
|
+
path: z.ZodString;
|
|
6
|
+
};
|
|
7
|
+
export declare function driveSandboxRead(client: ApiClient, args: {
|
|
8
|
+
workspace_id: string;
|
|
9
|
+
path: string;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
content: {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const driveSandboxReadSchema = {
|
|
3
|
+
workspace_id: z.string().describe('Workspace whose sandbox to read from'),
|
|
4
|
+
path: z.string().describe('Path inside the sandbox (e.g., src/index.ts or /tmp/build.log)'),
|
|
5
|
+
};
|
|
6
|
+
export async function driveSandboxRead(client, args) {
|
|
7
|
+
const file = await client.sandboxRead(args.workspace_id, args.path);
|
|
8
|
+
const note = file.truncated ? `\n\n[content truncated; total ${file.size} bytes]` : '';
|
|
9
|
+
return {
|
|
10
|
+
content: [{
|
|
11
|
+
type: 'text',
|
|
12
|
+
text: `${args.path} (${file.size} bytes)\n\n${file.content}${note}`,
|
|
13
|
+
}],
|
|
14
|
+
};
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adrive/mcp-server",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP server for AgentDrive — the persistent workspace your agents share across Claude Code, Codex, Cursor, and LangGraph. Files, semantic search, run logging,
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "MCP server for AgentDrive — the persistent workspace your agents share across Claude Code, Codex, Cursor, and LangGraph. Files, semantic search, run logging, cross-platform memory, and per-workspace agent sandboxing.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|