opentool 0.0.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.
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLambdaHandler = createLambdaHandler;
4
+ exports.createDevServer = createDevServer;
5
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
6
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
7
+ /**
8
+ * Create Lambda handler for OpenPond tools
9
+ */
10
+ function createLambdaHandler(tools) {
11
+ return async (_event) => {
12
+ try {
13
+ // Load tools if not provided
14
+ const toolDefinitions = tools || await loadToolsFromDirectory();
15
+ // Handle MCP protocol over HTTP
16
+ const server = new index_js_1.Server({
17
+ name: 'opentool-runtime',
18
+ version: '1.0.0',
19
+ }, {
20
+ capabilities: {
21
+ tools: {},
22
+ },
23
+ });
24
+ // Register tools
25
+ toolDefinitions.forEach(tool => {
26
+ const toolName = tool.metadata?.name || tool.filename;
27
+ const toolDescription = tool.metadata?.description || `${tool.filename} tool`;
28
+ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
29
+ tools: [{
30
+ name: toolName,
31
+ description: toolDescription,
32
+ inputSchema: tool.schema,
33
+ }],
34
+ }));
35
+ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
36
+ if (request.params.name === toolName) {
37
+ try {
38
+ const validatedParams = tool.schema.parse(request.params.arguments);
39
+ const result = await tool.handler(validatedParams);
40
+ return {
41
+ content: result.content,
42
+ isError: result.isError || false,
43
+ };
44
+ }
45
+ catch (error) {
46
+ return {
47
+ content: [{ type: 'text', text: `Error: ${error}` }],
48
+ isError: true,
49
+ };
50
+ }
51
+ }
52
+ throw new Error(`Tool ${request.params.name} not found`);
53
+ });
54
+ });
55
+ // Handle HTTP request
56
+ const response = await handleHttpRequest(_event);
57
+ return {
58
+ statusCode: response.statusCode,
59
+ headers: {
60
+ 'Content-Type': 'application/json',
61
+ 'Access-Control-Allow-Origin': '*',
62
+ 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
63
+ 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
64
+ },
65
+ body: response.body,
66
+ };
67
+ }
68
+ catch (error) {
69
+ return {
70
+ statusCode: 500,
71
+ headers: { 'Content-Type': 'application/json' },
72
+ body: JSON.stringify({ error: `Internal server error: ${error}` }),
73
+ };
74
+ }
75
+ };
76
+ }
77
+ /**
78
+ * Create local development server
79
+ */
80
+ function createDevServer(tools) {
81
+ const server = new index_js_1.Server({
82
+ name: 'opentool-dev',
83
+ version: '1.0.0',
84
+ }, {
85
+ capabilities: {
86
+ tools: {},
87
+ },
88
+ });
89
+ // Register list tools handler
90
+ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
91
+ tools: tools.map(tool => ({
92
+ name: tool.metadata?.name || tool.filename,
93
+ description: tool.metadata?.description || `${tool.filename} tool`,
94
+ inputSchema: tool.schema,
95
+ })),
96
+ }));
97
+ // Register call tool handler
98
+ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
99
+ const tool = tools.find(t => {
100
+ const toolName = t.metadata?.name || t.filename;
101
+ return toolName === request.params.name;
102
+ });
103
+ if (!tool) {
104
+ throw new Error(`Tool ${request.params.name} not found`);
105
+ }
106
+ try {
107
+ const validatedParams = tool.schema.parse(request.params.arguments);
108
+ const result = await tool.handler(validatedParams);
109
+ return {
110
+ content: result.content,
111
+ isError: result.isError || false,
112
+ };
113
+ }
114
+ catch (error) {
115
+ return {
116
+ content: [{ type: 'text', text: `Error: ${error}` }],
117
+ isError: true,
118
+ };
119
+ }
120
+ });
121
+ return server;
122
+ }
123
+ /**
124
+ * Load tools from tools directory
125
+ */
126
+ async function loadToolsFromDirectory() {
127
+ const tools = [];
128
+ const fs = require('fs');
129
+ const path = require('path');
130
+ const toolsDir = path.join(process.cwd(), 'tools');
131
+ if (!fs.existsSync(toolsDir)) {
132
+ return tools;
133
+ }
134
+ const files = fs.readdirSync(toolsDir);
135
+ for (const file of files) {
136
+ if (file.endsWith('.js') || file.endsWith('.ts')) {
137
+ const toolPath = path.join(toolsDir, file);
138
+ try {
139
+ const toolModule = require(toolPath);
140
+ // Check for required exports (schema and TOOL function, metadata is optional)
141
+ if (toolModule.TOOL && toolModule.schema) {
142
+ const baseName = file.replace(/\.(ts|js)$/, '');
143
+ const tool = {
144
+ schema: toolModule.schema,
145
+ metadata: toolModule.metadata || null,
146
+ filename: baseName,
147
+ handler: async (params) => {
148
+ const result = await toolModule.TOOL(params);
149
+ // Handle both string and object returns
150
+ if (typeof result === 'string') {
151
+ return {
152
+ content: [{ type: 'text', text: result }],
153
+ isError: false,
154
+ };
155
+ }
156
+ return result;
157
+ }
158
+ };
159
+ tools.push(tool);
160
+ }
161
+ }
162
+ catch (error) {
163
+ console.warn(`Failed to load tool from ${file}: ${error}`);
164
+ }
165
+ }
166
+ }
167
+ return tools;
168
+ }
169
+ /**
170
+ * Handle HTTP request for Lambda
171
+ */
172
+ async function handleHttpRequest(event) {
173
+ if (event.httpMethod === 'OPTIONS') {
174
+ return { statusCode: 200, body: '' };
175
+ }
176
+ if (event.httpMethod === 'POST' && event.path === '/mcp') {
177
+ try {
178
+ const body = event.isBase64Encoded ? Buffer.from(event.body, 'base64').toString() : event.body;
179
+ const request = JSON.parse(body);
180
+ // Process MCP request through server
181
+ // This is a simplified implementation - in a real scenario you'd need proper MCP protocol handling
182
+ return {
183
+ statusCode: 200,
184
+ body: JSON.stringify({ success: true, request }),
185
+ };
186
+ }
187
+ catch (error) {
188
+ return {
189
+ statusCode: 400,
190
+ body: JSON.stringify({ error: 'Invalid request' }),
191
+ };
192
+ }
193
+ }
194
+ // Health check endpoint
195
+ if (event.httpMethod === 'GET' && event.path === '/health') {
196
+ return {
197
+ statusCode: 200,
198
+ body: JSON.stringify({ status: 'healthy', timestamp: new Date().toISOString() }),
199
+ };
200
+ }
201
+ return {
202
+ statusCode: 404,
203
+ body: JSON.stringify({ error: 'Not found' }),
204
+ };
205
+ }
206
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";;AAOA,kDAsEC;AAKD,0CA6CC;AA/HD,wEAAmE;AACnE,iEAAmG;AAGnG;;GAEG;AACH,SAAgB,mBAAmB,CAAC,KAAwB;IAC1D,OAAO,KAAK,EAAE,MAAmB,EAA2B,EAAE;QAC5D,IAAI,CAAC;YACH,6BAA6B;YAC7B,MAAM,eAAe,GAAG,KAAK,IAAI,MAAM,sBAAsB,EAAE,CAAC;YAEhE,gCAAgC;YAChC,MAAM,MAAM,GAAG,IAAI,iBAAM,CAAC;gBACxB,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,OAAO;aACjB,EAAE;gBACD,YAAY,EAAE;oBACZ,KAAK,EAAE,EAAE;iBACV;aACF,CAAC,CAAC;YAEH,iBAAiB;YACjB,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC;gBACtD,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,IAAI,GAAG,IAAI,CAAC,QAAQ,OAAO,CAAC;gBAE9E,MAAM,CAAC,iBAAiB,CAAC,iCAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;oBAC5D,KAAK,EAAE,CAAC;4BACN,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,eAAe;4BAC5B,WAAW,EAAE,IAAI,CAAC,MAAM;yBACzB,CAAC;iBACH,CAAC,CAAC,CAAC;gBAEJ,MAAM,CAAC,iBAAiB,CAAC,gCAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;oBAChE,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;wBACrC,IAAI,CAAC;4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C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;YAC/F,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAEjC,qCAAqC;YACrC,mGAAmG;YACnG,OAAO;gBACL,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;aACjD,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;aACnD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,wBAAwB;IACxB,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC3D,OAAO;YACL,UAAU,EAAE,GAAG;YACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;SACjF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,UAAU,EAAE,GAAG;QACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;KAC7C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod';
2
+ export interface McpAnnotations {
3
+ /** Human-readable title for the tool */
4
+ title?: string;
5
+ /** Whether the tool only reads data (doesn't modify state) */
6
+ readOnlyHint?: boolean;
7
+ /** Whether the tool has destructive effects */
8
+ destructiveHint?: boolean;
9
+ /** Whether the tool is idempotent (same result for same input) */
10
+ idempotentHint?: boolean;
11
+ /** Whether the tool interacts with external systems */
12
+ openWorldHint?: boolean;
13
+ }
14
+ export interface ToolMetadata {
15
+ /** Tool name (must be unique) */
16
+ name: string;
17
+ /** Human-readable description of what the tool does */
18
+ description: string;
19
+ /** MCP protocol annotations for tool behavior */
20
+ annotations?: McpAnnotations;
21
+ }
22
+ export type PartialToolMetadata = {
23
+ /** Tool name (optional - will be inferred from filename if not provided) */
24
+ name?: string;
25
+ /** Human-readable description (optional - will be generated if not provided) */
26
+ description?: string;
27
+ /** MCP protocol annotations for tool behavior */
28
+ annotations?: McpAnnotations;
29
+ };
30
+ export interface ToolContent {
31
+ type: 'text' | 'image' | 'resource';
32
+ text?: string;
33
+ data?: string;
34
+ mimeType?: string;
35
+ }
36
+ export interface ToolResponse {
37
+ content: ToolContent[];
38
+ isError?: boolean;
39
+ }
40
+ export interface ToolDefinition<TSchema extends z.ZodSchema = z.ZodSchema> {
41
+ schema: TSchema;
42
+ metadata: ToolMetadata | null;
43
+ handler: (params: z.infer<TSchema>) => Promise<ToolResponse>;
44
+ filename: string;
45
+ }
46
+ export interface UserToolDefinition<TSchema extends z.ZodSchema = z.ZodSchema> {
47
+ schema: TSchema;
48
+ metadata?: PartialToolMetadata;
49
+ handler: (params: z.infer<TSchema>) => Promise<string | ToolResponse>;
50
+ }
51
+ export interface ServerConfig {
52
+ name: string;
53
+ version: string;
54
+ tools: ToolDefinition[];
55
+ }
56
+ export interface LambdaEvent {
57
+ httpMethod: string;
58
+ path: string;
59
+ headers: Record<string, string>;
60
+ body: string;
61
+ isBase64Encoded: boolean;
62
+ }
63
+ export interface LambdaContext {
64
+ requestId: string;
65
+ functionName: string;
66
+ functionVersion: string;
67
+ remainingTimeInMillis: number;
68
+ }
69
+ export interface LambdaResponse {
70
+ statusCode: number;
71
+ headers: Record<string, string>;
72
+ body: string;
73
+ }
74
+ export interface BuildConfig {
75
+ toolsDir: string;
76
+ outputDir: string;
77
+ serverName?: string;
78
+ serverVersion?: string;
79
+ }
80
+ export declare function createToolMetadata(partial: PartialToolMetadata, toolFilename: string): ToolMetadata;
81
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kEAAkE;IAClE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uDAAuD;IACvD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAGD,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAGD,MAAM,MAAM,mBAAmB,GAAG;IAChC,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B,CAAC;AAGF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAGD,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC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M,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,mBAAmB,EAC5B,YAAY,EAAE,MAAM,GACnB,YAAY,CAed"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createToolMetadata = createToolMetadata;
4
+ // Helper function to create complete metadata from partial metadata
5
+ function createToolMetadata(partial, toolFilename) {
6
+ const toolName = partial.name || toolFilename.replace(/\.(ts|js)$/, '');
7
+ return {
8
+ name: toolName,
9
+ description: partial.description || `${toolName} tool`,
10
+ annotations: {
11
+ title: partial.annotations?.title || toolName.charAt(0).toUpperCase() + toolName.slice(1),
12
+ readOnlyHint: partial.annotations?.readOnlyHint ?? true,
13
+ destructiveHint: partial.annotations?.destructiveHint ?? false,
14
+ idempotentHint: partial.annotations?.idempotentHint ?? true,
15
+ openWorldHint: partial.annotations?.openWorldHint ?? false,
16
+ ...partial.annotations,
17
+ },
18
+ };
19
+ }
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;AAsGA,gDAkBC;AAnBD,oEAAoE;AACpE,SAAgB,kBAAkB,CAChC,OAA4B,EAC5B,YAAoB;IAEpB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,IAAI,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAExE,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,GAAG,QAAQ,OAAO;QACtD,WAAW,EAAE;YACX,KAAK,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACzF,YAAY,EAAE,OAAO,CAAC,WAAW,EAAE,YAAY,IAAI,IAAI;YACvD,eAAe,EAAE,OAAO,CAAC,WAAW,EAAE,eAAe,IAAI,KAAK;YAC9D,cAAc,EAAE,OAAO,CAAC,WAAW,EAAE,cAAc,IAAI,IAAI;YAC3D,aAAa,EAAE,OAAO,CAAC,WAAW,EAAE,aAAa,IAAI,KAAK;YAC1D,GAAG,OAAO,CAAC,WAAW;SACvB;KACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "opentool",
3
+ "version": "0.0.2",
4
+ "description": "OpenTool framework for building serverless MCP tools",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "opentool": "./dist/cli/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsx src/cli/dev.ts",
13
+ "lint": "eslint .",
14
+ "lint:fix": "eslint . --fix",
15
+ "typecheck": "tsc --noEmit",
16
+ "test": "echo \"No tests configured\" && exit 0",
17
+ "prepublishOnly": "npm run build",
18
+ "changeset": "changeset",
19
+ "changeset:version": "changeset version",
20
+ "changeset:publish": "changeset publish",
21
+ "release": "npm run build && npm run changeset:publish"
22
+ },
23
+ "files": [
24
+ "dist/**/*",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "keywords": [
29
+ "opentool",
30
+ "mcp",
31
+ "tools",
32
+ "serverless",
33
+ "lambda"
34
+ ],
35
+ "author": "OpenTool",
36
+ "homepage": "https://opentool.dev",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/openpond/opentool.git"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/openpond/opentool/issues"
43
+ },
44
+ "license": "MIT",
45
+ "dependencies": {
46
+ "@aws/run-mcp-servers-with-aws-lambda": "^0.2.2",
47
+ "@modelcontextprotocol/sdk": "^1.12.3",
48
+ "commander": "^11.0.0",
49
+ "zod": "^3.24.1",
50
+ "zod-to-json-schema": "^3.24.6"
51
+ },
52
+ "devDependencies": {
53
+ "@changesets/cli": "^2.29.5",
54
+ "@types/node": "^20.0.0",
55
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
56
+ "@typescript-eslint/parser": "^6.0.0",
57
+ "eslint": "^8.0.0",
58
+ "ts-node": "^10.9.2",
59
+ "tsx": "^4.0.0",
60
+ "typescript": "^5.0.0"
61
+ },
62
+ "peerDependencies": {
63
+ "typescript": "^5.0.0"
64
+ },
65
+ "engines": {
66
+ "node": ">=20.0.0"
67
+ }
68
+ }