@autonomys/auto-mcp-servers 0.1.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/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # Autonomys MCP Servers
2
+
3
+ This package provides Model Context Protocol (MCP) servers for Autonomys services. These servers expose Autonomys SDK functionality as MCP tools that can be used with Claude Desktop and other MCP clients, or integrated into agent frameworks.
4
+
5
+ ## Available Servers
6
+
7
+ ### Auto Drive Server
8
+
9
+ The Auto Drive server exposes functionality from the `@autonomys/auto-drive` package as MCP tools.
10
+
11
+ #### Tools
12
+
13
+ The Auto Drive server provides the following tools:
14
+
15
+ - `uploadObject`: Upload an object to the Autonomys network.
16
+
17
+ More servers and tools will be coming soon!
18
+
19
+ ## Usage
20
+
21
+ ### With Claude Desktop
22
+
23
+ 1. Install Claude Desktop
24
+ 2. Install the Auto Drive server globally:
25
+
26
+ ```bash
27
+ npm install -g @autonomys/auto-mcp-servers
28
+ # or
29
+ yarn global add @autonomys/auto-mcp-servers
30
+ ```
31
+
32
+ 3. Edit your `claude_desktop_config.json` file:
33
+
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "auto-drive": {
38
+ "command": "npx",
39
+ "args": ["auto-drive-server"],
40
+ "env": { "AUTO_DRIVE_API_KEY": "your-api-key" }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ 4. Restart Claude Desktop
47
+
48
+ ### In Agent Frameworks
49
+
50
+ You can use these MCP servers as tools with agent frameworks such as LangChain.
51
+
52
+ 1. Install the Auto Drive server into your project:
53
+
54
+ ```bash
55
+ npm install @autonomys/auto-mcp-servers
56
+ # or
57
+ yarn add @autonomys/auto-mcp-servers
58
+ ```
59
+
60
+ 2. Use the Auto Drive server as a tool in your agent project:
61
+
62
+ ```typescript
63
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js'
64
+ import {
65
+ StdioClientTransport,
66
+ StdioServerParameters,
67
+ } from '@modelcontextprotocol/sdk/client/stdio.js'
68
+ import { loadMcpTools } from '@langchain/mcp-adapters'
69
+ import { StructuredToolInterface } from '@langchain/core/tools'
70
+ import { ChatOpenAI } from '@langchain/openai'
71
+
72
+ // Create Auto Drive tools with a single function
73
+ const createAutoDriveTools = async (apiKey: string): Promise<StructuredToolInterface[]> => {
74
+ // Set up transport for Auto Drive server
75
+ const transport = new StdioClientTransport({
76
+ command: process.execPath,
77
+ args: ['node_modules/.bin/auto-drive-server'],
78
+ env: { AUTO_DRIVE_API_KEY: apiKey },
79
+ })
80
+
81
+ // Initialize client and connect
82
+ const client = new Client({ name: 'auto-drive', version: '0.0.1' })
83
+ client.connect(transport)
84
+
85
+ // Load MCP tools
86
+ return await loadMcpTools('auto-drive', client)
87
+ }
88
+
89
+ // Create tools with your API key
90
+ const tools = await createAutoDriveTools('your-api-key')
91
+
92
+ // Initialize the ChatOpenAI model
93
+ const model = new ChatOpenAI({ modelName: 'gpt-4o' })
94
+
95
+ const result = await model
96
+ .bindTools(tools)
97
+ .invoke('Upload a profound thought to the Autonomys network')
98
+ console.log(result)
99
+ ```
100
+
101
+ ## License
102
+
103
+ MIT
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare const autoDriveServer: McpServer;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auto-drive/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAiBnE,eAAO,MAAM,eAAe,WAA0D,CAAA"}
@@ -0,0 +1,38 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { createAutoDriveApi } from '@autonomys/auto-drive';
11
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
12
+ import { z } from 'zod';
13
+ const AUTO_DRIVE_API_KEY = process.env.AUTO_DRIVE_API_KEY;
14
+ const NETWORK = process.env.NETWORK === 'taurus' ? 'taurus' : 'mainnet';
15
+ const ENCRYPTION_PASSWORD = process.env.ENCRYPTION_PASSWORD;
16
+ const uploadOptions = ENCRYPTION_PASSWORD
17
+ ? { password: ENCRYPTION_PASSWORD }
18
+ : undefined;
19
+ const autoDriveApi = createAutoDriveApi({ network: NETWORK, apiKey: AUTO_DRIVE_API_KEY });
20
+ const uploadObject = (filename, data) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const cid = yield autoDriveApi.uploadObjectAsJSON({ data }, filename, uploadOptions);
22
+ return cid;
23
+ });
24
+ export const autoDriveServer = new McpServer({ name: 'Auto Drive', version: '0.1.0' });
25
+ autoDriveServer.tool('upload-object', 'Upload an object permanently to Auto Drive, any objects uploaded here will be permanently available onchain. This is useful for storing data that you want to keep forever.', {
26
+ filename: z.string().describe('The filename to save the object as.'),
27
+ data: z.record(z.string(), z.any()).describe(`
28
+ Data you want to permanently store onchain saved as a JSON object with any key-value pairs.
29
+ The keys are strings that describe the type of data being stored.
30
+ The values are the actual data being stored.
31
+ `),
32
+ }, (_a, extra_1) => __awaiter(void 0, [_a, extra_1], void 0, function* ({ filename, data }, extra) {
33
+ if (!AUTO_DRIVE_API_KEY) {
34
+ throw new Error('AUTO_DRIVE_API_KEY environment variable is not set');
35
+ }
36
+ const cid = yield uploadObject(filename, data);
37
+ return { content: [{ type: 'text', text: `Object uploaded successfully with ${cid}` }] };
38
+ }));
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=auto-drive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-drive.d.ts","sourceRoot":"","sources":["../../src/bin/auto-drive.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
12
+ import { autoDriveServer } from '../index.js';
13
+ const main = () => __awaiter(void 0, void 0, void 0, function* () {
14
+ const transport = new StdioServerTransport();
15
+ yield autoDriveServer.connect(transport);
16
+ });
17
+ main().catch((error) => {
18
+ console.error('Failed to start Auto Drive server:', error);
19
+ process.exit(1);
20
+ });
@@ -0,0 +1,2 @@
1
+ export { autoDriveServer } from './auto-drive/index.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // Export servers
2
+ export { autoDriveServer } from './auto-drive/index.js';
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@autonomys/auto-mcp-servers",
3
+ "packageManager": "yarn@4.7.0",
4
+ "version": "0.1.0",
5
+ "description": "Autonomys Network MCP servers",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/autonomys/auto-sdk"
9
+ },
10
+ "author": {
11
+ "name": "Autonomys",
12
+ "url": "https://www.autonomys.xyz"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/autonomys/auto-sdk/issues"
16
+ },
17
+ "license": "MIT",
18
+ "type": "module",
19
+ "main": "dist/index.js",
20
+ "bin": {
21
+ "auto-drive-server": "./dist/bin/auto-drive.js"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc"
25
+ },
26
+ "keywords": [
27
+ "mcp",
28
+ "server"
29
+ ],
30
+ "dependencies": {
31
+ "@autonomys/auto-drive": "^1.4.18",
32
+ "@modelcontextprotocol/sdk": "^1.9.0",
33
+ "zod": "^3.24.2"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "22.14.0",
37
+ "ts-node": "^10.9.1",
38
+ "typescript": "^5.0.2"
39
+ }
40
+ }
@@ -0,0 +1,41 @@
1
+ import { createAutoDriveApi, UploadFileOptions } from '@autonomys/auto-drive'
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
3
+ import { z } from 'zod'
4
+
5
+ const AUTO_DRIVE_API_KEY = process.env.AUTO_DRIVE_API_KEY
6
+ const NETWORK = process.env.NETWORK === 'taurus' ? 'taurus' : 'mainnet'
7
+ const ENCRYPTION_PASSWORD = process.env.ENCRYPTION_PASSWORD
8
+ const uploadOptions: UploadFileOptions | undefined = ENCRYPTION_PASSWORD
9
+ ? { password: ENCRYPTION_PASSWORD }
10
+ : undefined
11
+
12
+ const autoDriveApi = createAutoDriveApi({ network: NETWORK, apiKey: AUTO_DRIVE_API_KEY })
13
+
14
+ const uploadObject = async (filename: string, data: unknown) => {
15
+ const cid = await autoDriveApi.uploadObjectAsJSON({ data }, filename, uploadOptions)
16
+ return cid
17
+ }
18
+
19
+ export const autoDriveServer = new McpServer({ name: 'Auto Drive', version: '0.1.0' })
20
+
21
+ autoDriveServer.tool(
22
+ 'upload-object',
23
+ 'Upload an object permanently to Auto Drive, any objects uploaded here will be permanently available onchain. This is useful for storing data that you want to keep forever.',
24
+ {
25
+ filename: z.string().describe('The filename to save the object as.'),
26
+ data: z.record(z.string(), z.any()).describe(
27
+ `
28
+ Data you want to permanently store onchain saved as a JSON object with any key-value pairs.
29
+ The keys are strings that describe the type of data being stored.
30
+ The values are the actual data being stored.
31
+ `,
32
+ ),
33
+ } as any,
34
+ async ({ filename, data }, extra) => {
35
+ if (!AUTO_DRIVE_API_KEY) {
36
+ throw new Error('AUTO_DRIVE_API_KEY environment variable is not set')
37
+ }
38
+ const cid = await uploadObject(filename, data)
39
+ return { content: [{ type: 'text', text: `Object uploaded successfully with ${cid}` }] }
40
+ },
41
+ )
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
4
+ import { autoDriveServer } from '../index.js'
5
+
6
+ const main = async () => {
7
+ const transport = new StdioServerTransport()
8
+ await autoDriveServer.connect(transport)
9
+ }
10
+
11
+ main().catch((error) => {
12
+ console.error('Failed to start Auto Drive server:', error)
13
+ process.exit(1)
14
+ })
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ // Export servers
2
+ export { autoDriveServer } from './auto-drive/index.js'
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src"
8
+ },
9
+ "include": ["src/**/*"]
10
+ }