From 7e948d3d67f8663aef4f69c36e31118b6c5fa60d Mon Sep 17 00:00:00 2001 From: Patrik Simek Date: Wed, 30 Jul 2025 15:47:48 +0200 Subject: [PATCH] chore: mcp tools polishing --- README.md | 50 ++++----- package-lock.json | 4 +- package.json | 2 +- scripts/run-mcp-server.mjs | 4 +- src/endpoints/blueprints.mcp.ts | 40 ------- src/endpoints/connections.mcp.ts | 83 ++++----------- src/endpoints/data-store-records.mcp.ts | 13 +-- src/endpoints/data-stores.mcp.ts | 13 +-- src/endpoints/data-structures.mcp.ts | 36 ++----- src/endpoints/folders.mcp.ts | 3 +- src/endpoints/functions.mcp.ts | 25 +---- src/endpoints/hooks.mcp.ts | 116 +++------------------ src/endpoints/incomplete-executions.mcp.ts | 4 +- src/endpoints/keys.mcp.ts | 6 +- src/endpoints/organizations.mcp.ts | 3 +- src/endpoints/scenarios.mcp.ts | 39 +++---- src/endpoints/scenarios.ts | 20 ++-- src/endpoints/sdk/apps.mcp.ts | 12 ++- src/endpoints/sdk/connections.mcp.ts | 9 +- src/endpoints/sdk/functions.mcp.ts | 9 +- src/endpoints/sdk/modules.mcp.ts | 12 +-- src/endpoints/sdk/rpcs.mcp.ts | 6 +- src/endpoints/sdk/rpcs.ts | 5 +- src/endpoints/sdk/webhooks.mcp.ts | 6 +- src/endpoints/teams.mcp.ts | 3 +- src/endpoints/users.mcp.ts | 14 --- src/mcp.ts | 2 - test/mcp.spec.ts | 2 +- test/scenarios.spec.ts | 2 +- 29 files changed, 160 insertions(+), 383 deletions(-) delete mode 100644 src/endpoints/blueprints.mcp.ts diff --git a/README.md b/README.md index 014d3ae..6383eb5 100644 --- a/README.md +++ b/README.md @@ -74,46 +74,37 @@ const dataStore = await make.dataStores.get(/* DataStore ID */); This SDK includes full support for the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/), allowing AI agents to interact with the Make API through standardized tools. All SDK endpoints are automatically exposed as MCP tools. -### Integrating with MCP Server +### Integrating with MCP Server (experimental) ```ts -import { Server } from '@modelcontextprotocol/sdk/server/index.js'; -import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; -import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js'; +import { Make } from '@makehq/sdk'; import { MakeMCPTools } from '@makehq/sdk/mcp'; -server.setRequestHandler(ListToolsRequestSchema, async () => { - return { - tools: MakeMCPTools.map(tool => { - return { - name: tool.name, - title: tool.title, - description: tool.description, - inputSchema: tool.inputSchema, - }; - }), - }; -}); +// Initialize the Make client +const make = new Make('your-api-key', 'eu2.make.com'); -server.setRequestHandler(CallToolRequestSchema, async request => { - const tool = MakeMCPTools.find(tool => tool.name === request.params.name); - if (!tool) { - throw new Error(`Unknown tool: ${request.params.name}`); - } +// List tools +const tools = MakeMCPTools.map(tool => { return { - content: [ - { - type: 'text', - text: JSON.stringify(await tool.execute(make, request.params.arguments)), - }, - ], + name: tool.name, + title: tool.title, + description: tool.description, + inputSchema: tool.inputSchema, }; }); -const transport = new StdioServerTransport(); -await server.connect(transport); +// Execute tool +const tool = MakeMCPTools.find(tool => tool.name === 'scenarios_list'); + +try { + await tool.execute(make, { teamId: 1 }); +} catch (error) { + // Handle error +} ``` +See full example in the `scripts/run-mcp-server.mjs` file. + ### Tool Structure Each tool is described as demonstrated in the following example: @@ -142,7 +133,6 @@ Each tool is described as demonstrated in the following example: All tools are organized into the following categories: -- `blueprints` - `connections` - `data-stores` - `data-store-records` diff --git a/package-lock.json b/package-lock.json index 249ae1d..808e7e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@makehq/sdk", - "version": "0.6.0", + "version": "0.7.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@makehq/sdk", - "version": "0.6.0", + "version": "0.7.0", "license": "MIT", "devDependencies": { "@eslint/js": "^9.22.0", diff --git a/package.json b/package.json index ab04f77..f66a872 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@makehq/sdk", - "version": "0.6.0", + "version": "0.7.0", "description": "Make TypeScript SDK", "license": "MIT", "author": "Make", diff --git a/scripts/run-mcp-server.mjs b/scripts/run-mcp-server.mjs index 4656075..6e2e0ea 100755 --- a/scripts/run-mcp-server.mjs +++ b/scripts/run-mcp-server.mjs @@ -50,11 +50,13 @@ server.setRequestHandler(CallToolRequestSchema, async request => { if (!tool) { throw new Error(`Unknown tool: ${request.params.name}`); } + + const result = await tool.execute(make, request.params.arguments); return { content: [ { type: 'text', - text: JSON.stringify(await tool.execute(make, request.params.arguments)), + text: typeof result === 'string' ? result : JSON.stringify(result, null, 2), }, ], }; diff --git a/src/endpoints/blueprints.mcp.ts b/src/endpoints/blueprints.mcp.ts deleted file mode 100644 index f99a601..0000000 --- a/src/endpoints/blueprints.mcp.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Make } from '../make.js'; - -export const tools = [ - { - name: 'blueprints_get', - title: 'Get scenario blueprint', - description: 'Get the blueprint of a scenario', - category: 'blueprints', - scope: 'scenarios:read', - identifier: 'scenarioId', - inputSchema: { - type: 'object', - properties: { - scenarioId: { type: 'number', description: 'The scenario ID to get the blueprint for' }, - }, - required: ['scenarioId'], - }, - execute: async (make: Make, args: { scenarioId: number }) => { - return await make.blueprints.get(args.scenarioId); - }, - }, - { - name: 'blueprints_versions', - title: 'Get blueprint versions', - description: "Get all versions of a scenario's blueprint", - category: 'blueprints', - scope: 'scenarios:read', - identifier: 'scenarioId', - inputSchema: { - type: 'object', - properties: { - scenarioId: { type: 'number', description: 'The scenario ID to get blueprint versions for' }, - }, - required: ['scenarioId'], - }, - execute: async (make: Make, args: { scenarioId: number }) => { - return await make.blueprints.versions(args.scenarioId); - }, - }, -]; diff --git a/src/endpoints/connections.mcp.ts b/src/endpoints/connections.mcp.ts index 98a5080..9832c80 100644 --- a/src/endpoints/connections.mcp.ts +++ b/src/endpoints/connections.mcp.ts @@ -87,31 +87,22 @@ export const tools = [ type: 'object', properties: { connectionId: { type: 'number', description: 'The connection ID to update' }, - data: { type: 'object', description: 'Connection configuration data to update' }, - }, - required: ['connectionId', 'data'], - }, - execute: async (make: Make, args: { connectionId: number; data: Record }) => { - return await make.connections.update(args.connectionId, args.data); - }, - }, - { - name: 'connections_rename', - title: 'Rename connection', - description: 'Rename a connection', - category: 'connections', - scope: 'connections:write', - identifier: 'connectionId', - inputSchema: { - type: 'object', - properties: { - connectionId: { type: 'number', description: 'The connection ID to rename' }, name: { type: 'string', description: 'The new name for the connection' }, + data: { type: 'object', description: 'Connection configuration data to update' }, }, - required: ['connectionId', 'name'], + required: ['connectionId'], }, - execute: async (make: Make, args: { connectionId: number; name: string }) => { - return await make.connections.rename(args.connectionId, args.name); + execute: async ( + make: Make, + args: { connectionId: number; name?: string; data?: Record }, + ) => { + if (args.name != null && args.name !== '') { + await make.connections.rename(args.connectionId, args.name); + } + if (args.data != null) { + await make.connections.update(args.connectionId, args.data); + } + return 'Connection has been updated.'; }, }, { @@ -129,48 +120,9 @@ export const tools = [ required: ['connectionId'], }, execute: async (make: Make, args: { connectionId: number }) => { - return await make.connections.verify(args.connectionId); - }, - }, - { - name: 'connections_scoped', - title: 'Verify connection scopes', - description: 'Verify if given OAuth scopes are set for a given connection', - category: 'connections', - scope: 'connections:write', - identifier: 'connectionId', - inputSchema: { - type: 'object', - properties: { - connectionId: { type: 'number', description: 'The connection ID to update scopes for' }, - scope: { - type: 'array', - items: { type: 'string' }, - description: 'Array of scope identifiers to set', - }, - }, - required: ['connectionId', 'scope'], - }, - execute: async (make: Make, args: { connectionId: number; scope: string[] }) => { - return await make.connections.scoped(args.connectionId, args.scope); - }, - }, - { - name: 'connections_list_editable_parameters', - title: 'List editable connection parameters', - description: 'List editable parameters for a connection', - category: 'connections', - scope: 'connections:read', - identifier: 'connectionId', - inputSchema: { - type: 'object', - properties: { - connectionId: { type: 'number', description: 'The connection ID to get editable parameters for' }, - }, - required: ['connectionId'], - }, - execute: async (make: Make, args: { connectionId: number }) => { - return await make.connections.listEditableParameters(args.connectionId); + return (await make.connections.verify(args.connectionId)) + ? 'Connection is valid.' + : 'Connection is not valid.'; }, }, { @@ -188,7 +140,8 @@ export const tools = [ required: ['connectionId'], }, execute: async (make: Make, args: { connectionId: number }) => { - return await make.connections.delete(args.connectionId); + await make.connections.delete(args.connectionId); + return 'Connection has been deleted.'; }, }, ]; diff --git a/src/endpoints/data-store-records.mcp.ts b/src/endpoints/data-store-records.mcp.ts index 7ab8f16..b03564b 100644 --- a/src/endpoints/data-store-records.mcp.ts +++ b/src/endpoints/data-store-records.mcp.ts @@ -3,7 +3,7 @@ import type { JSONValue } from '../types.js'; export const tools = [ { - name: 'data_store_records_list', + name: 'data-store-records_list', title: 'List data store records', description: 'List all records in a data store', category: 'data-store-records', @@ -22,7 +22,7 @@ export const tools = [ }, }, { - name: 'data_store_records_create', + name: 'data-store-records_create', title: 'Create data store record', description: 'Create a new record in a data store', category: 'data-store-records', @@ -46,7 +46,7 @@ export const tools = [ }, }, { - name: 'data_store_records_update', + name: 'data-store-records_update', title: 'Update data store record', description: 'Update an existing record in a data store', category: 'data-store-records', @@ -66,7 +66,7 @@ export const tools = [ }, }, { - name: 'data_store_records_replace', + name: 'data-store-records_replace', title: 'Replace data store record', description: "Replace an existing record in a data store or create if it doesn't exist", category: 'data-store-records', @@ -86,7 +86,7 @@ export const tools = [ }, }, { - name: 'data_store_records_delete', + name: 'data-store-records_delete', title: 'Delete data store records', description: 'Delete specific records from a data store by keys', category: 'data-store-records', @@ -101,7 +101,8 @@ export const tools = [ required: ['dataStoreId', 'keys'], }, execute: async (make: Make, args: { dataStoreId: number; keys: string[] }) => { - return await make.dataStores.records.delete(args.dataStoreId, args.keys); + await make.dataStores.records.delete(args.dataStoreId, args.keys); + return `Records have been deleted.`; }, }, ]; diff --git a/src/endpoints/data-stores.mcp.ts b/src/endpoints/data-stores.mcp.ts index af76ed9..b820443 100644 --- a/src/endpoints/data-stores.mcp.ts +++ b/src/endpoints/data-stores.mcp.ts @@ -2,7 +2,7 @@ import type { Make } from '../make.js'; export const tools = [ { - name: 'data_stores_list', + name: 'data-stores_list', title: 'List data stores', description: 'List all data stores for a team', category: 'data-stores', @@ -20,7 +20,7 @@ export const tools = [ }, }, { - name: 'data_stores_get', + name: 'data-stores_get', title: 'Get data store', description: 'Get data store details by ID', category: 'data-stores', @@ -38,7 +38,7 @@ export const tools = [ }, }, { - name: 'data_stores_create', + name: 'data-stores_create', title: 'Create data store', description: 'Create a new data store', category: 'data-stores', @@ -65,7 +65,7 @@ export const tools = [ }, }, { - name: 'data_stores_update', + name: 'data-stores_update', title: 'Update data store', description: 'Update a data store', category: 'data-stores', @@ -90,7 +90,7 @@ export const tools = [ }, }, { - name: 'data_stores_delete', + name: 'data-stores_delete', title: 'Delete data store', description: 'Delete a data store', category: 'data-stores', @@ -104,7 +104,8 @@ export const tools = [ required: ['dataStoreId'], }, execute: async (make: Make, args: { dataStoreId: number }) => { - return await make.dataStores.delete(args.dataStoreId); + await make.dataStores.delete(args.dataStoreId); + return `Data store has been deleted.`; }, }, ]; diff --git a/src/endpoints/data-structures.mcp.ts b/src/endpoints/data-structures.mcp.ts index a3028bd..58503bb 100644 --- a/src/endpoints/data-structures.mcp.ts +++ b/src/endpoints/data-structures.mcp.ts @@ -3,7 +3,7 @@ import type { DataStructureField } from './data-structures.js'; export const tools = [ { - name: 'data_structures_list', + name: 'data-structures_list', title: 'List data structures', description: 'List data structures for a team', category: 'data-structures', @@ -21,7 +21,7 @@ export const tools = [ }, }, { - name: 'data_structures_get', + name: 'data-structures_get', title: 'Get data structure', description: 'Get details of a specific data structure', category: 'data-structures', @@ -39,7 +39,7 @@ export const tools = [ }, }, { - name: 'data_structures_create', + name: 'data-structures_create', title: 'Create data structure', description: 'Create a new data structure', category: 'data-structures', @@ -76,7 +76,7 @@ export const tools = [ }, }, { - name: 'data_structures_update', + name: 'data-structures_update', title: 'Update data structure', description: 'Update an existing data structure', category: 'data-structures', @@ -116,30 +116,7 @@ export const tools = [ }, }, { - name: 'data_structures_clone', - title: 'Clone data structure', - description: 'Clone an existing data structure', - category: 'data-structures', - scope: 'udts:write', - identifier: 'dataStructureId', - inputSchema: { - type: 'object', - properties: { - dataStructureId: { type: 'number', description: 'The data structure ID to clone' }, - name: { type: 'string', description: 'Name for the cloned data structure' }, - targetTeamId: { type: 'number', description: 'Target team ID for the cloned data structure' }, - }, - required: ['dataStructureId', 'name', 'targetTeamId'], - }, - execute: async (make: Make, args: { dataStructureId: number; name: string; targetTeamId: number }) => { - return await make.dataStructures.clone(args.dataStructureId, { - name: args.name, - targetTeamId: args.targetTeamId, - }); - }, - }, - { - name: 'data_structures_delete', + name: 'data-structures_delete', title: 'Delete data structure', description: 'Delete a data structure', category: 'data-structures', @@ -153,7 +130,8 @@ export const tools = [ required: ['dataStructureId'], }, execute: async (make: Make, args: { dataStructureId: number }) => { - return await make.dataStructures.delete(args.dataStructureId); + await make.dataStructures.delete(args.dataStructureId); + return `Data structure has been deleted.`; }, }, ]; diff --git a/src/endpoints/folders.mcp.ts b/src/endpoints/folders.mcp.ts index 53d4126..4110cd6 100644 --- a/src/endpoints/folders.mcp.ts +++ b/src/endpoints/folders.mcp.ts @@ -73,7 +73,8 @@ export const tools = [ required: ['folderId'], }, execute: async (make: Make, args: { folderId: number }) => { - return await make.folders.delete(args.folderId); + await make.folders.delete(args.folderId); + return `Folder has been deleted.`; }, }, ]; diff --git a/src/endpoints/functions.mcp.ts b/src/endpoints/functions.mcp.ts index 2cc5bfe..0d93e72 100644 --- a/src/endpoints/functions.mcp.ts +++ b/src/endpoints/functions.mcp.ts @@ -102,7 +102,8 @@ export const tools = [ required: ['functionId'], }, execute: async (make: Make, args: { functionId: number }) => { - return await make.functions.delete(args.functionId); + await make.functions.delete(args.functionId); + return `Function has been deleted.`; }, }, { @@ -121,26 +122,8 @@ export const tools = [ required: ['teamId', 'code'], }, execute: async (make: Make, args: { teamId: number; code: string }) => { - return await make.functions.check(args.teamId, args.code); - }, - }, - { - name: 'functions_history', - title: 'Get function history', - description: 'Get the version history of a function', - category: 'functions', - scope: 'functions:read', - identifier: 'functionId', - inputSchema: { - type: 'object', - properties: { - functionId: { type: 'number', description: 'The function ID to get history for' }, - teamId: { type: 'number', description: 'The team ID the function belongs to' }, - }, - required: ['functionId', 'teamId'], - }, - execute: async (make: Make, args: { functionId: number; teamId: number }) => { - return await make.functions.history(args.teamId, args.functionId); + const result = await make.functions.check(args.teamId, args.code); + return result.success ? 'Function code is valid.' : `Function code is not valid: ${result.error}`; }, }, ]; diff --git a/src/endpoints/hooks.mcp.ts b/src/endpoints/hooks.mcp.ts index ed7f3f6..68b7d04 100644 --- a/src/endpoints/hooks.mcp.ts +++ b/src/endpoints/hooks.mcp.ts @@ -4,8 +4,8 @@ import type { JSONValue } from '../types.js'; export const tools = [ { name: 'hooks_list', - title: 'List hooks', - description: 'List webhooks for a specific team', + title: 'List webhooks/mailhooks', + description: 'List webhooks/mailhooks for a specific team', category: 'hooks', scope: 'hooks:read', identifier: 'teamId', @@ -22,8 +22,8 @@ export const tools = [ }, { name: 'hooks_get', - title: 'Get hook', - description: 'Get details of a specific hook', + title: 'Get webhook/mailhook', + description: 'Get details of a specific webhook/mailhook', category: 'hooks', scope: 'hooks:read', identifier: 'hookId', @@ -40,8 +40,8 @@ export const tools = [ }, { name: 'hooks_create', - title: 'Create hook', - description: 'Create a new webhook', + title: 'Create webhook/mailhook', + description: 'Create a new webhook/mailhook', category: 'hooks', scope: 'hooks:write', identifier: 'teamId', @@ -72,8 +72,8 @@ export const tools = [ }, { name: 'hooks_update', - title: 'Update hook', - description: 'Update an existing webhook', + title: 'Update webhook/mailhook', + description: 'Update an existing webhook/mailhook', category: 'hooks', scope: 'hooks:write', identifier: 'hookId', @@ -86,13 +86,14 @@ export const tools = [ required: ['hookId', 'data'], }, execute: async (make: Make, args: { hookId: number; data: Record }) => { - return await make.hooks.update(args.hookId, { data: args.data }); + await make.hooks.update(args.hookId, { data: args.data }); + return `Hook has been updated.`; }, }, { name: 'hooks_delete', - title: 'Delete hook', - description: 'Delete a webhook', + title: 'Delete webhook/mailhook', + description: 'Delete a webhook/mailhook', category: 'hooks', scope: 'hooks:write', identifier: 'hookId', @@ -104,97 +105,8 @@ export const tools = [ required: ['hookId'], }, execute: async (make: Make, args: { hookId: number }) => { - return await make.hooks.delete(args.hookId); - }, - }, - { - name: 'hooks_enable', - title: 'Enable hook', - description: 'Enable a webhook', - category: 'hooks', - scope: 'hooks:write', - identifier: 'hookId', - inputSchema: { - type: 'object', - properties: { - hookId: { type: 'number', description: 'The hook ID to enable' }, - }, - required: ['hookId'], - }, - execute: async (make: Make, args: { hookId: number }) => { - return await make.hooks.enable(args.hookId); - }, - }, - { - name: 'hooks_disable', - title: 'Disable hook', - description: 'Disable a webhook', - category: 'hooks', - scope: 'hooks:write', - identifier: 'hookId', - inputSchema: { - type: 'object', - properties: { - hookId: { type: 'number', description: 'The hook ID to disable' }, - }, - required: ['hookId'], - }, - execute: async (make: Make, args: { hookId: number }) => { - return await make.hooks.disable(args.hookId); - }, - }, - { - name: 'hooks_ping', - title: 'Ping hook', - description: 'Send a test ping to a webhook', - category: 'hooks', - scope: 'hooks:read', - identifier: 'hookId', - inputSchema: { - type: 'object', - properties: { - hookId: { type: 'number', description: 'The hook ID to ping' }, - }, - required: ['hookId'], - }, - execute: async (make: Make, args: { hookId: number }) => { - return await make.hooks.ping(args.hookId); - }, - }, - { - name: 'hooks_learn_start', - title: 'Start hook learning', - description: 'Start learning mode for a webhook', - category: 'hooks', - scope: 'hooks:write', - identifier: 'hookId', - inputSchema: { - type: 'object', - properties: { - hookId: { type: 'number', description: 'The hook ID to start learning for' }, - }, - required: ['hookId'], - }, - execute: async (make: Make, args: { hookId: number }) => { - return await make.hooks.learnStart(args.hookId); - }, - }, - { - name: 'hooks_learn_stop', - title: 'Stop hook learning', - description: 'Stop learning mode for a webhook', - category: 'hooks', - scope: 'hooks:write', - identifier: 'hookId', - inputSchema: { - type: 'object', - properties: { - hookId: { type: 'number', description: 'The hook ID to stop learning for' }, - }, - required: ['hookId'], - }, - execute: async (make: Make, args: { hookId: number }) => { - return await make.hooks.learnStop(args.hookId); + await make.hooks.delete(args.hookId); + return `Hook has been deleted.`; }, }, ]; diff --git a/src/endpoints/incomplete-executions.mcp.ts b/src/endpoints/incomplete-executions.mcp.ts index d117fb1..b0f0f78 100644 --- a/src/endpoints/incomplete-executions.mcp.ts +++ b/src/endpoints/incomplete-executions.mcp.ts @@ -2,7 +2,7 @@ import type { Make } from '../make.js'; export const tools = [ { - name: 'incomplete_executions_list', + name: 'incomplete-executions_list', title: 'List incomplete executions', description: 'List all incomplete executions', category: 'incomplete-executions', @@ -20,7 +20,7 @@ export const tools = [ }, }, { - name: 'incomplete_executions_get', + name: 'incomplete-executions_get', title: 'Get incomplete execution', description: 'Get details of a specific incomplete execution', category: 'incomplete-executions', diff --git a/src/endpoints/keys.mcp.ts b/src/endpoints/keys.mcp.ts index dfcc727..8433408 100644 --- a/src/endpoints/keys.mcp.ts +++ b/src/endpoints/keys.mcp.ts @@ -80,7 +80,8 @@ export const tools = [ }, execute: async (make: Make, args: { keyId: number; name?: string; parameters?: Record }) => { const { keyId, ...body } = args; - return await make.keys.update(keyId, body); + await make.keys.update(keyId, body); + return `Key has been updated.`; }, }, { @@ -98,7 +99,8 @@ export const tools = [ required: ['keyId'], }, execute: async (make: Make, args: { keyId: number }) => { - return await make.keys.delete(args.keyId); + await make.keys.delete(args.keyId); + return `Key has been deleted.`; }, }, ]; diff --git a/src/endpoints/organizations.mcp.ts b/src/endpoints/organizations.mcp.ts index c531562..9b255f9 100644 --- a/src/endpoints/organizations.mcp.ts +++ b/src/endpoints/organizations.mcp.ts @@ -102,7 +102,8 @@ export const tools = [ required: ['organizationId'], }, execute: async (make: Make, args: { organizationId: number }) => { - return await make.organizations.delete(args.organizationId); + await make.organizations.delete(args.organizationId); + return `Organization has been deleted.`; }, }, ]; diff --git a/src/endpoints/scenarios.mcp.ts b/src/endpoints/scenarios.mcp.ts index 40909d8..6b9160c 100644 --- a/src/endpoints/scenarios.mcp.ts +++ b/src/endpoints/scenarios.mcp.ts @@ -22,28 +22,10 @@ export const tools = [ return await make.scenarios.list(args.teamId); }, }, - { - name: 'scenarios_list_in_organization', - title: 'List scenarios in organization', - description: 'List all scenarios for an organization', - category: 'scenarios', - scope: 'scenarios:read', - identifier: 'organizationId', - inputSchema: { - type: 'object', - properties: { - organizationId: { type: 'number', description: 'The organization ID to filter scenarios by' }, - }, - required: ['organizationId'], - }, - execute: async (make: Make, args: { organizationId: number }) => { - return await make.scenarios.listInOrganization(args.organizationId); - }, - }, { name: 'scenarios_get', title: 'Get scenario', - description: 'Get a scenario by ID', + description: 'Get a scenario and its blueprint by ID', category: 'scenarios', scope: 'scenarios:read', identifier: 'scenarioId', @@ -55,7 +37,13 @@ export const tools = [ required: ['scenarioId'], }, execute: async (make: Make, args: { scenarioId: number }) => { - return await make.scenarios.get(args.scenarioId); + const scenario = await make.scenarios.get(args.scenarioId); + const blueprint = await make.blueprints.get(scenario.id); + + return { + ...scenario, + blueprint, + }; }, }, { @@ -151,7 +139,8 @@ export const tools = [ required: ['scenarioId'], }, execute: async (make: Make, args: { scenarioId: number }) => { - return await make.scenarios.delete(args.scenarioId); + await make.scenarios.delete(args.scenarioId); + return `Scenario has been deleted.`; }, }, { @@ -169,7 +158,9 @@ export const tools = [ required: ['scenarioId'], }, execute: async (make: Make, args: { scenarioId: number }) => { - return await make.scenarios.activate(args.scenarioId); + return (await make.scenarios.activate(args.scenarioId)) + ? 'Scenario has been activated.' + : 'Scenario has not been activated.'; }, }, { @@ -187,7 +178,9 @@ export const tools = [ required: ['scenarioId'], }, execute: async (make: Make, args: { scenarioId: number }) => { - return await make.scenarios.deactivate(args.scenarioId); + return (await make.scenarios.deactivate(args.scenarioId)) + ? 'Scenario has been deactivated.' + : 'Scenario has not been deactivated.'; }, }, { diff --git a/src/endpoints/scenarios.ts b/src/endpoints/scenarios.ts index bb59b1c..68677bd 100644 --- a/src/endpoints/scenarios.ts +++ b/src/endpoints/scenarios.ts @@ -413,10 +413,12 @@ export class Scenarios { */ async activate(scenarioId: number): Promise { return ( - await this.#fetch(`/scenarios/${scenarioId}/start`, { - method: 'POST', - }) - ).scenario.isActive; + ( + await this.#fetch(`/scenarios/${scenarioId}/start`, { + method: 'POST', + }) + ).scenario.isActive === true + ); } /** @@ -426,10 +428,12 @@ export class Scenarios { */ async deactivate(scenarioId: number): Promise { return ( - await this.#fetch(`/scenarios/${scenarioId}/stop`, { - method: 'POST', - }) - ).scenario.isActive; + ( + await this.#fetch(`/scenarios/${scenarioId}/stop`, { + method: 'POST', + }) + ).scenario.isActive === false + ); } /** diff --git a/src/endpoints/sdk/apps.mcp.ts b/src/endpoints/sdk/apps.mcp.ts index 11fc684..0512b56 100644 --- a/src/endpoints/sdk/apps.mcp.ts +++ b/src/endpoints/sdk/apps.mcp.ts @@ -134,7 +134,8 @@ export const tools = [ required: ['name', 'version'], }, execute: async (make: Make, args: { name: string; version: number }) => { - return await make.sdk.apps.delete(args.name, args.version); + await make.sdk.apps.delete(args.name, args.version); + return `App has been deleted.`; }, }, { @@ -194,7 +195,8 @@ export const tools = [ body: Record; }, ) => { - return await make.sdk.apps.setSection(args.name, args.version, args.section, args.body); + await make.sdk.apps.setSection(args.name, args.version, args.section, args.body); + return `Section '${args.section}' has been set.`; }, }, { @@ -233,7 +235,8 @@ export const tools = [ required: ['name', 'version', 'docs'], }, execute: async (make: Make, args: { name: string; version: number; docs: string }) => { - return await make.sdk.apps.setDocs(args.name, args.version, args.docs); + await make.sdk.apps.setDocs(args.name, args.version, args.docs); + return `Documentation has been set.`; }, }, { @@ -272,7 +275,8 @@ export const tools = [ required: ['name', 'version', 'common'], }, execute: async (make: Make, args: { name: string; version: number; common: Record }) => { - return await make.sdk.apps.setCommon(args.name, args.version, args.common); + await make.sdk.apps.setCommon(args.name, args.version, args.common); + return `Common data has been set.`; }, }, ]; diff --git a/src/endpoints/sdk/connections.mcp.ts b/src/endpoints/sdk/connections.mcp.ts index ac50cc8..3c87ba5 100644 --- a/src/endpoints/sdk/connections.mcp.ts +++ b/src/endpoints/sdk/connections.mcp.ts @@ -94,7 +94,8 @@ export const tools = [ required: ['connectionName'], }, execute: async (make: Make, args: { connectionName: string }) => { - return await make.sdk.connections.delete(args.connectionName); + await make.sdk.connections.delete(args.connectionName); + return `Connection has been deleted.`; }, }, { @@ -154,7 +155,8 @@ export const tools = [ body: Record | Array>; }, ) => { - return await make.sdk.connections.setSection(args.connectionName, args.section, args.body); + await make.sdk.connections.setSection(args.connectionName, args.section, args.body); + return `Section '${args.section}' has been set.`; }, }, { @@ -191,7 +193,8 @@ export const tools = [ required: ['connectionName', 'common'], }, execute: async (make: Make, args: { connectionName: string; common: Record }) => { - return await make.sdk.connections.setCommon(args.connectionName, args.common); + await make.sdk.connections.setCommon(args.connectionName, args.common); + return `Common data has been set.`; }, }, ]; diff --git a/src/endpoints/sdk/functions.mcp.ts b/src/endpoints/sdk/functions.mcp.ts index a2073bc..1652e84 100644 --- a/src/endpoints/sdk/functions.mcp.ts +++ b/src/endpoints/sdk/functions.mcp.ts @@ -78,7 +78,8 @@ export const tools = [ required: ['appName', 'appVersion', 'functionName'], }, execute: async (make: Make, args: { appName: string; appVersion: number; functionName: string }) => { - return await make.sdk.functions.delete(args.appName, args.appVersion, args.functionName); + await make.sdk.functions.delete(args.appName, args.appVersion, args.functionName); + return `Function has been deleted.`; }, }, { @@ -122,7 +123,8 @@ export const tools = [ make: Make, args: { appName: string; appVersion: number; functionName: string; code: string }, ) => { - return await make.sdk.functions.setCode(args.appName, args.appVersion, args.functionName, args.code); + await make.sdk.functions.setCode(args.appName, args.appVersion, args.functionName, args.code); + return `Code has been set.`; }, }, { @@ -166,7 +168,8 @@ export const tools = [ make: Make, args: { appName: string; appVersion: number; functionName: string; test: string }, ) => { - return await make.sdk.functions.setTest(args.appName, args.appVersion, args.functionName, args.test); + await make.sdk.functions.setTest(args.appName, args.appVersion, args.functionName, args.test); + return `Test has been set.`; }, }, ]; diff --git a/src/endpoints/sdk/modules.mcp.ts b/src/endpoints/sdk/modules.mcp.ts index 750844d..7b768fd 100644 --- a/src/endpoints/sdk/modules.mcp.ts +++ b/src/endpoints/sdk/modules.mcp.ts @@ -132,7 +132,8 @@ export const tools = [ required: ['appName', 'appVersion', 'moduleName'], }, execute: async (make: Make, args: { appName: string; appVersion: number; moduleName: string }) => { - return await make.sdk.modules.delete(args.appName, args.appVersion, args.moduleName); + await make.sdk.modules.delete(args.appName, args.appVersion, args.moduleName); + return `Module has been deleted.`; }, }, { @@ -200,13 +201,8 @@ export const tools = [ body: Record | Array>; }, ) => { - return await make.sdk.modules.setSection( - args.appName, - args.appVersion, - args.moduleName, - args.section, - args.body, - ); + await make.sdk.modules.setSection(args.appName, args.appVersion, args.moduleName, args.section, args.body); + return `Section '${args.section}' has been set.`; }, }, ]; diff --git a/src/endpoints/sdk/rpcs.mcp.ts b/src/endpoints/sdk/rpcs.mcp.ts index 6846a11..11e76cd 100644 --- a/src/endpoints/sdk/rpcs.mcp.ts +++ b/src/endpoints/sdk/rpcs.mcp.ts @@ -114,7 +114,8 @@ export const tools = [ required: ['appName', 'appVersion', 'rpcName'], }, execute: async (make: Make, args: { appName: string; appVersion: number; rpcName: string }) => { - return await make.sdk.rpcs.delete(args.appName, args.appVersion, args.rpcName); + await make.sdk.rpcs.delete(args.appName, args.appVersion, args.rpcName); + return `RPC has been deleted.`; }, }, { @@ -230,7 +231,8 @@ export const tools = [ body: Record | Array>; }, ) => { - return await make.sdk.rpcs.setSection(args.appName, args.appVersion, args.rpcName, args.section, args.body); + await make.sdk.rpcs.setSection(args.appName, args.appVersion, args.rpcName, args.section, args.body); + return `Section '${args.section}' has been set.`; }, }, ]; diff --git a/src/endpoints/sdk/rpcs.ts b/src/endpoints/sdk/rpcs.ts index 8f0038b..c21790d 100644 --- a/src/endpoints/sdk/rpcs.ts +++ b/src/endpoints/sdk/rpcs.ts @@ -147,9 +147,10 @@ export class SDKRPCs { /** * Test an RPC with provided data and schema + * @returns The test result */ - async test(appName: string, appVersion: number, rpcName: string, body: TestSDKRPCBody): Promise { - await this.#fetch(`/sdk/apps/${appName}/${appVersion}/rpcs/${rpcName}`, { + async test(appName: string, appVersion: number, rpcName: string, body: TestSDKRPCBody): Promise { + return await this.#fetch(`/sdk/apps/${appName}/${appVersion}/rpcs/${rpcName}`, { method: 'POST', body, }); diff --git a/src/endpoints/sdk/webhooks.mcp.ts b/src/endpoints/sdk/webhooks.mcp.ts index 569b8cd..0f5e4ac 100644 --- a/src/endpoints/sdk/webhooks.mcp.ts +++ b/src/endpoints/sdk/webhooks.mcp.ts @@ -94,7 +94,8 @@ export const tools = [ required: ['webhookName'], }, execute: async (make: Make, args: { webhookName: string }) => { - return await make.sdk.webhooks.delete(args.webhookName); + await make.sdk.webhooks.delete(args.webhookName); + return `Webhook has been deleted.`; }, }, { @@ -154,7 +155,8 @@ export const tools = [ body: Record | Array>; }, ) => { - return await make.sdk.webhooks.setSection(args.webhookName, args.section, args.body); + await make.sdk.webhooks.setSection(args.webhookName, args.section, args.body); + return `Section '${args.section}' has been set.`; }, }, ]; diff --git a/src/endpoints/teams.mcp.ts b/src/endpoints/teams.mcp.ts index 670b4b0..23cf062 100644 --- a/src/endpoints/teams.mcp.ts +++ b/src/endpoints/teams.mcp.ts @@ -79,7 +79,8 @@ export const tools = [ required: ['teamId'], }, execute: async (make: Make, args: { teamId: number }) => { - return await make.teams.delete(args.teamId); + await make.teams.delete(args.teamId); + return `Team has been deleted.`; }, }, ]; diff --git a/src/endpoints/users.mcp.ts b/src/endpoints/users.mcp.ts index a58b2c1..6f437d8 100644 --- a/src/endpoints/users.mcp.ts +++ b/src/endpoints/users.mcp.ts @@ -15,18 +15,4 @@ export const tools = [ return await make.users.me(); }, }, - { - name: 'users_current_authorization', - title: 'Get current authorization', - description: 'Get authorization details for the current user', - category: 'users', - scope: undefined, - identifier: undefined, - inputSchema: { - type: 'object', - }, - execute: async (make: Make) => { - return await make.users.currentAuthorization(); - }, - }, ]; diff --git a/src/mcp.ts b/src/mcp.ts index dc17d06..4e339d1 100644 --- a/src/mcp.ts +++ b/src/mcp.ts @@ -9,7 +9,6 @@ import { tools as ScenariosTools } from './endpoints/scenarios.mcp.js'; import { tools as ConnectionsTools } from './endpoints/connections.mcp.js'; import { tools as DataStoresTools } from './endpoints/data-stores.mcp.js'; import { tools as DataStoreRecordsTools } from './endpoints/data-store-records.mcp.js'; -import { tools as BlueprintsTools } from './endpoints/blueprints.mcp.js'; import { tools as TeamsTools } from './endpoints/teams.mcp.js'; import { tools as OrganizationsTools } from './endpoints/organizations.mcp.js'; import { tools as UsersTools } from './endpoints/users.mcp.js'; @@ -36,7 +35,6 @@ export const MakeMCPTools = [ ...ConnectionsTools, ...DataStoresTools, ...DataStoreRecordsTools, - ...BlueprintsTools, ...TeamsTools, ...OrganizationsTools, ...UsersTools, diff --git a/test/mcp.spec.ts b/test/mcp.spec.ts index d742de0..00a11eb 100644 --- a/test/mcp.spec.ts +++ b/test/mcp.spec.ts @@ -97,7 +97,7 @@ describe('MCP Tools', () => { it('Should have proper naming conventions', () => { MakeMCPTools.forEach(tool => { // Tool names should follow the pattern: {endpoint}_{action} or sdk_{endpoint}_{action} - const namePattern = /^(sdk_)?[a-z_]+_[a-z_]+$/; + const namePattern = /^(sdk_)?[a-z_-]+_[a-z_-]+$/; expect(tool.name).toMatch(namePattern); // Categories should use dot notation for hierarchy diff --git a/test/scenarios.spec.ts b/test/scenarios.spec.ts index 231f089..b8cb042 100644 --- a/test/scenarios.spec.ts +++ b/test/scenarios.spec.ts @@ -150,7 +150,7 @@ describe('Endpoints: Scenarios', () => { }); const result = await make.scenarios.deactivate(5); - expect(result).toBe(false); + expect(result).toBe(true); }); }); });