@adrive/mcp-server 0.3.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.
Files changed (39) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +99 -0
  3. package/dist/api-client.d.ts +237 -0
  4. package/dist/api-client.js +198 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +63 -0
  7. package/dist/tools/drive-activity.d.ts +13 -0
  8. package/dist/tools/drive-activity.js +22 -0
  9. package/dist/tools/drive-comment.d.ts +21 -0
  10. package/dist/tools/drive-comment.js +17 -0
  11. package/dist/tools/drive-context.d.ts +19 -0
  12. package/dist/tools/drive-context.js +56 -0
  13. package/dist/tools/drive-delete.d.ts +15 -0
  14. package/dist/tools/drive-delete.js +9 -0
  15. package/dist/tools/drive-feedback.d.ts +15 -0
  16. package/dist/tools/drive-feedback.js +26 -0
  17. package/dist/tools/drive-invite.d.ts +15 -0
  18. package/dist/tools/drive-invite.js +14 -0
  19. package/dist/tools/drive-list.d.ts +15 -0
  20. package/dist/tools/drive-list.js +20 -0
  21. package/dist/tools/drive-log-run.d.ts +25 -0
  22. package/dist/tools/drive-log-run.js +27 -0
  23. package/dist/tools/drive-org.d.ts +8 -0
  24. package/dist/tools/drive-org.js +30 -0
  25. package/dist/tools/drive-read.d.ts +15 -0
  26. package/dist/tools/drive-read.js +14 -0
  27. package/dist/tools/drive-recall.d.ts +15 -0
  28. package/dist/tools/drive-recall.js +29 -0
  29. package/dist/tools/drive-roles.d.ts +19 -0
  30. package/dist/tools/drive-roles.js +32 -0
  31. package/dist/tools/drive-search.d.ts +37 -0
  32. package/dist/tools/drive-search.js +47 -0
  33. package/dist/tools/drive-share.d.ts +23 -0
  34. package/dist/tools/drive-share.js +21 -0
  35. package/dist/tools/drive-versions.d.ts +15 -0
  36. package/dist/tools/drive-versions.js +13 -0
  37. package/dist/tools/drive-write.d.ts +19 -0
  38. package/dist/tools/drive-write.js +16 -0
  39. package/package.json +53 -0
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import type { ApiClient } from '../api-client.js';
3
+ export declare const driveReadSchema: {
4
+ workspace_id: z.ZodString;
5
+ file_id: z.ZodString;
6
+ };
7
+ export declare function driveRead(client: ApiClient, args: {
8
+ workspace_id: string;
9
+ file_id: string;
10
+ }): Promise<{
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ }[];
15
+ }>;
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export const driveReadSchema = {
3
+ workspace_id: z.string().describe('Workspace ID'),
4
+ file_id: z.string().describe('File ID to read'),
5
+ };
6
+ export async function driveRead(client, args) {
7
+ const file = await client.readFile(args.workspace_id, args.file_id);
8
+ return {
9
+ content: [{
10
+ type: 'text',
11
+ text: `# ${file.path} (v${file.version})\n\n${file.content}`,
12
+ }],
13
+ };
14
+ }
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import type { ApiClient } from '../api-client.js';
3
+ export declare const driveRecallSchema: {
4
+ query: z.ZodString;
5
+ top_k: z.ZodOptional<z.ZodNumber>;
6
+ };
7
+ export declare function driveRecall(client: ApiClient, args: {
8
+ query: string;
9
+ top_k?: number;
10
+ }): Promise<{
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ }[];
15
+ }>;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ export const driveRecallSchema = {
3
+ query: z.string().min(1).max(2000).describe('Recall query — what fact, preference, or decision are you trying to remember?'),
4
+ top_k: z.number().int().positive().max(20).optional().describe('Max results (default 5, max 20)'),
5
+ };
6
+ export async function driveRecall(client, args) {
7
+ // v1 narrows nothing; v1.5 will scope to filter.kind === 'fact' once the fact-extractor lands.
8
+ const { hits } = await client.search({
9
+ query: args.query,
10
+ top_k: args.top_k ?? 5,
11
+ });
12
+ if (hits.length === 0) {
13
+ return { content: [{ type: 'text', text: 'Nothing recalled.' }] };
14
+ }
15
+ return {
16
+ content: [{ type: 'text', text: hits.map(formatHit).join('\n---\n') }],
17
+ };
18
+ }
19
+ function formatHit(h) {
20
+ const score = h.score.toFixed(2);
21
+ const snippet = truncate(h.snippet ?? '', 200);
22
+ const created = new Date(h.created_at).toISOString();
23
+ return `${h.path}\nws=${h.ws_id} · score=${score} · by=${h.agent_id}@${h.agent_platform} · ${created}\n${snippet}`;
24
+ }
25
+ function truncate(s, n) {
26
+ if (s.length <= n)
27
+ return s;
28
+ return s.slice(0, n - 1) + '...';
29
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import type { ApiClient } from '../api-client.js';
3
+ export declare const driveRolesSchema: {
4
+ workspace_id: z.ZodString;
5
+ action: z.ZodEnum<["assign", "list", "remove"]>;
6
+ email: z.ZodOptional<z.ZodString>;
7
+ permission: z.ZodOptional<z.ZodEnum<["view", "comment", "edit"]>>;
8
+ };
9
+ export declare function driveRoles(client: ApiClient, args: {
10
+ workspace_id: string;
11
+ action: 'assign' | 'list' | 'remove';
12
+ email?: string;
13
+ permission?: 'view' | 'comment' | 'edit';
14
+ }): Promise<{
15
+ content: {
16
+ type: "text";
17
+ text: string;
18
+ }[];
19
+ }>;
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ export const driveRolesSchema = {
3
+ workspace_id: z.string().describe('Workspace ID'),
4
+ action: z.enum(['assign', 'list', 'remove']).describe('Action: assign a role, list all roles, or remove a role'),
5
+ email: z.string().optional().describe('Email address (required for assign/remove)'),
6
+ permission: z.enum(['view', 'comment', 'edit']).optional().describe('Permission level (required for assign)'),
7
+ };
8
+ export async function driveRoles(client, args) {
9
+ if (args.action === 'list') {
10
+ const roles = await client.getAllRoles(args.workspace_id);
11
+ if (roles.length === 0) {
12
+ return { content: [{ type: 'text', text: 'No roles assigned in this workspace.' }] };
13
+ }
14
+ const listing = roles.map(r => `- ${r.email}: ${r.permission} (assigned by ${r.assigned_by} on ${r.assigned_at})`).join('\n');
15
+ return { content: [{ type: 'text', text: `Workspace roles:\n${listing}` }] };
16
+ }
17
+ if (args.action === 'assign') {
18
+ if (!args.email || !args.permission) {
19
+ return { content: [{ type: 'text', text: 'Error: email and permission are required for assign action.' }] };
20
+ }
21
+ const role = await client.assignRole(args.workspace_id, args.email, args.permission);
22
+ return { content: [{ type: 'text', text: `Assigned ${args.permission} access to ${args.email} in workspace.` }] };
23
+ }
24
+ if (args.action === 'remove') {
25
+ if (!args.email) {
26
+ return { content: [{ type: 'text', text: 'Error: email is required for remove action.' }] };
27
+ }
28
+ await client.removeRole(args.workspace_id, args.email);
29
+ return { content: [{ type: 'text', text: `Removed ${args.email}'s role from workspace.` }] };
30
+ }
31
+ return { content: [{ type: 'text', text: 'Unknown action.' }] };
32
+ }
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ import type { ApiClient } from '../api-client.js';
3
+ declare const AGENT_PLATFORMS: readonly ["claude-code", "codex", "cursor", "langgraph", "crewai", "autogen", "hermes", "openclaw", "unknown"];
4
+ export declare const driveSearchSchema: {
5
+ query: z.ZodString;
6
+ workspace_id: z.ZodOptional<z.ZodString>;
7
+ top_k: z.ZodOptional<z.ZodNumber>;
8
+ filter: z.ZodOptional<z.ZodObject<{
9
+ agent_platform: z.ZodOptional<z.ZodEnum<["claude-code", "codex", "cursor", "langgraph", "crewai", "autogen", "hermes", "openclaw", "unknown"]>>;
10
+ agent_id: z.ZodOptional<z.ZodString>;
11
+ path_prefix: z.ZodOptional<z.ZodString>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ agent_platform?: "claude-code" | "cursor" | "codex" | "langgraph" | "crewai" | "autogen" | "hermes" | "openclaw" | "unknown" | undefined;
14
+ agent_id?: string | undefined;
15
+ path_prefix?: string | undefined;
16
+ }, {
17
+ agent_platform?: "claude-code" | "cursor" | "codex" | "langgraph" | "crewai" | "autogen" | "hermes" | "openclaw" | "unknown" | undefined;
18
+ agent_id?: string | undefined;
19
+ path_prefix?: string | undefined;
20
+ }>>;
21
+ };
22
+ export declare function driveSearch(client: ApiClient, args: {
23
+ query: string;
24
+ workspace_id?: string;
25
+ top_k?: number;
26
+ filter?: {
27
+ agent_platform?: typeof AGENT_PLATFORMS[number];
28
+ agent_id?: string;
29
+ path_prefix?: string;
30
+ };
31
+ }): Promise<{
32
+ content: {
33
+ type: "text";
34
+ text: string;
35
+ }[];
36
+ }>;
37
+ export {};
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ const AGENT_PLATFORMS = [
3
+ 'claude-code',
4
+ 'codex',
5
+ 'cursor',
6
+ 'langgraph',
7
+ 'crewai',
8
+ 'autogen',
9
+ 'hermes',
10
+ 'openclaw',
11
+ 'unknown',
12
+ ];
13
+ export const driveSearchSchema = {
14
+ query: z.string().min(1).max(2000).describe('Search query'),
15
+ workspace_id: z.string().optional().describe('Scope to a single workspace; omit for org-wide search'),
16
+ top_k: z.number().int().positive().max(50).optional().describe('Max hits to return (default 10, max 50)'),
17
+ filter: z.object({
18
+ agent_platform: z.enum(AGENT_PLATFORMS).optional(),
19
+ agent_id: z.string().optional(),
20
+ path_prefix: z.string().optional(),
21
+ }).optional(),
22
+ };
23
+ export async function driveSearch(client, args) {
24
+ const { hits } = await client.search({
25
+ query: args.query,
26
+ workspace_id: args.workspace_id,
27
+ top_k: args.top_k ?? 10,
28
+ filter: args.filter,
29
+ });
30
+ if (hits.length === 0) {
31
+ return { content: [{ type: 'text', text: 'No matches.' }] };
32
+ }
33
+ return {
34
+ content: [{ type: 'text', text: hits.map(formatHit).join('\n---\n') }],
35
+ };
36
+ }
37
+ function formatHit(h) {
38
+ const score = h.score.toFixed(2);
39
+ const snippet = truncate(h.snippet ?? '', 200);
40
+ const created = new Date(h.created_at).toISOString();
41
+ return `${h.path}\nws=${h.ws_id} · score=${score} · by=${h.agent_id}@${h.agent_platform} · ${created}\n${snippet}`;
42
+ }
43
+ function truncate(s, n) {
44
+ if (s.length <= n)
45
+ return s;
46
+ return s.slice(0, n - 1) + '...';
47
+ }
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import type { ApiClient } from '../api-client.js';
3
+ export declare const driveShareSchema: {
4
+ workspace_id: z.ZodString;
5
+ permission: z.ZodEnum<["view", "comment", "edit"]>;
6
+ file_id: z.ZodOptional<z.ZodString>;
7
+ expires_in: z.ZodOptional<z.ZodNumber>;
8
+ max_uses: z.ZodOptional<z.ZodNumber>;
9
+ email: z.ZodOptional<z.ZodString>;
10
+ };
11
+ export declare function driveShare(client: ApiClient, args: {
12
+ workspace_id: string;
13
+ permission: 'view' | 'comment' | 'edit';
14
+ file_id?: string;
15
+ expires_in?: number;
16
+ max_uses?: number;
17
+ email?: string;
18
+ }): Promise<{
19
+ content: {
20
+ type: "text";
21
+ text: string;
22
+ }[];
23
+ }>;
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ export const driveShareSchema = {
3
+ workspace_id: z.string().describe('Workspace ID'),
4
+ permission: z.enum(['view', 'comment', 'edit']).describe('Permission level for the share link'),
5
+ file_id: z.string().optional().describe('Scope to a specific file (optional)'),
6
+ expires_in: z.number().optional().describe('Expiry in seconds (optional)'),
7
+ max_uses: z.number().optional().describe('Maximum number of uses (optional)'),
8
+ email: z.string().optional().describe('Email-gate: only this email can access the link (requires email verification). Leave empty for public access.'),
9
+ };
10
+ export async function driveShare(client, args) {
11
+ const share = await client.createShareLink(args.workspace_id, args.permission, args.file_id, args.expires_in, args.max_uses, args.email);
12
+ const emailNote = share.email_gated
13
+ ? `\nEmail-gated: only ${args.email} can access (they'll verify via magic code)`
14
+ : '\nPublic: anyone with the link can access';
15
+ return {
16
+ content: [{
17
+ type: 'text',
18
+ text: `Share link created (${share.permission} access):\n${share.url}${emailNote}${share.expires_at ? `\nExpires: ${share.expires_at}` : ''}`,
19
+ }],
20
+ };
21
+ }
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import type { ApiClient } from '../api-client.js';
3
+ export declare const driveVersionsSchema: {
4
+ workspace_id: z.ZodString;
5
+ file_id: z.ZodString;
6
+ };
7
+ export declare function driveVersions(client: ApiClient, args: {
8
+ workspace_id: string;
9
+ file_id: string;
10
+ }): Promise<{
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ }[];
15
+ }>;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export const driveVersionsSchema = {
3
+ workspace_id: z.string().describe('Workspace ID'),
4
+ file_id: z.string().describe('File ID'),
5
+ };
6
+ export async function driveVersions(client, args) {
7
+ const versions = await client.getAllVersions(args.workspace_id, args.file_id);
8
+ if (versions.length === 0) {
9
+ return { content: [{ type: 'text', text: 'No version history found.' }] };
10
+ }
11
+ const lines = versions.map(v => `v${v.version} | ${v.actor_type}:${v.actor_id} | ${v.created_at}${v.message ? ` | "${v.message}"` : ''}`);
12
+ return { content: [{ type: 'text', text: `Version history (${versions.length} versions):\n${lines.join('\n')}` }] };
13
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import type { ApiClient } from '../api-client.js';
3
+ export declare const driveWriteSchema: {
4
+ workspace_id: z.ZodString;
5
+ path: z.ZodString;
6
+ content: z.ZodString;
7
+ message: z.ZodOptional<z.ZodString>;
8
+ };
9
+ export declare function driveWrite(client: ApiClient, args: {
10
+ workspace_id: string;
11
+ path: string;
12
+ content: string;
13
+ message?: string;
14
+ }): Promise<{
15
+ content: {
16
+ type: "text";
17
+ text: string;
18
+ }[];
19
+ }>;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export const driveWriteSchema = {
3
+ workspace_id: z.string().describe('Workspace ID to write to'),
4
+ path: z.string().describe('File path (e.g. "notes/meeting.md")'),
5
+ content: z.string().describe('File content (markdown)'),
6
+ message: z.string().optional().describe('Optional version message'),
7
+ };
8
+ export async function driveWrite(client, args) {
9
+ const file = await client.writeFile(args.workspace_id, args.path, args.content, args.message);
10
+ return {
11
+ content: [{
12
+ type: 'text',
13
+ text: `File written: ${file.path} (v${file.version}, id: ${file.id})`,
14
+ }],
15
+ };
16
+ }
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@adrive/mcp-server",
3
+ "version": "0.3.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, and cross-platform memory.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "adrive-mcp": "dist/index.js"
9
+ },
10
+ "main": "dist/index.js",
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "homepage": "https://agentdrive.sh",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Rakesh1002/agentdrive.git",
19
+ "directory": "packages/mcp-server"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/Rakesh1002/agentdrive/issues"
23
+ },
24
+ "keywords": [
25
+ "agentdrive",
26
+ "mcp",
27
+ "model-context-protocol",
28
+ "agent",
29
+ "ai-agent",
30
+ "claude-code",
31
+ "codex",
32
+ "cursor",
33
+ "langgraph"
34
+ ],
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "scripts": {
39
+ "build": "tsc",
40
+ "dev": "tsc --watch",
41
+ "typecheck": "tsc --noEmit",
42
+ "test": "vitest run"
43
+ },
44
+ "dependencies": {
45
+ "@modelcontextprotocol/sdk": "^1.12.0",
46
+ "zod": "^3.24.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^22.0.0",
50
+ "typescript": "^5.7.0",
51
+ "vitest": "^2.1.0"
52
+ }
53
+ }