Skip to content

Commit a0ad5bf

Browse files
authored
chore: mcp tools polishing (#11)
1 parent 6796329 commit a0ad5bf

29 files changed

+160
-383
lines changed

README.md

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,46 +74,37 @@ const dataStore = await make.dataStores.get(/* DataStore ID */);
7474

7575
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.
7676

77-
### Integrating with MCP Server
77+
### Integrating with MCP Server (experimental)
7878

7979
```ts
80-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
81-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
82-
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
80+
import { Make } from '@makehq/sdk';
8381
import { MakeMCPTools } from '@makehq/sdk/mcp';
8482

85-
server.setRequestHandler(ListToolsRequestSchema, async () => {
86-
return {
87-
tools: MakeMCPTools.map(tool => {
88-
return {
89-
name: tool.name,
90-
title: tool.title,
91-
description: tool.description,
92-
inputSchema: tool.inputSchema,
93-
};
94-
}),
95-
};
96-
});
83+
// Initialize the Make client
84+
const make = new Make('your-api-key', 'eu2.make.com');
9785

98-
server.setRequestHandler(CallToolRequestSchema, async request => {
99-
const tool = MakeMCPTools.find(tool => tool.name === request.params.name);
100-
if (!tool) {
101-
throw new Error(`Unknown tool: ${request.params.name}`);
102-
}
86+
// List tools
87+
const tools = MakeMCPTools.map(tool => {
10388
return {
104-
content: [
105-
{
106-
type: 'text',
107-
text: JSON.stringify(await tool.execute(make, request.params.arguments)),
108-
},
109-
],
89+
name: tool.name,
90+
title: tool.title,
91+
description: tool.description,
92+
inputSchema: tool.inputSchema,
11093
};
11194
});
11295

113-
const transport = new StdioServerTransport();
114-
await server.connect(transport);
96+
// Execute tool
97+
const tool = MakeMCPTools.find(tool => tool.name === 'scenarios_list');
98+
99+
try {
100+
await tool.execute(make, { teamId: 1 });
101+
} catch (error) {
102+
// Handle error
103+
}
115104
```
116105

106+
See full example in the `scripts/run-mcp-server.mjs` file.
107+
117108
### Tool Structure
118109

119110
Each tool is described as demonstrated in the following example:
@@ -142,7 +133,6 @@ Each tool is described as demonstrated in the following example:
142133

143134
All tools are organized into the following categories:
144135

145-
- `blueprints`
146136
- `connections`
147137
- `data-stores`
148138
- `data-store-records`

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@makehq/sdk",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"description": "Make TypeScript SDK",
55
"license": "MIT",
66
"author": "Make",

scripts/run-mcp-server.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ server.setRequestHandler(CallToolRequestSchema, async request => {
5050
if (!tool) {
5151
throw new Error(`Unknown tool: ${request.params.name}`);
5252
}
53+
54+
const result = await tool.execute(make, request.params.arguments);
5355
return {
5456
content: [
5557
{
5658
type: 'text',
57-
text: JSON.stringify(await tool.execute(make, request.params.arguments)),
59+
text: typeof result === 'string' ? result : JSON.stringify(result, null, 2),
5860
},
5961
],
6062
};

src/endpoints/blueprints.mcp.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/endpoints/connections.mcp.ts

Lines changed: 18 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -87,31 +87,22 @@ export const tools = [
8787
type: 'object',
8888
properties: {
8989
connectionId: { type: 'number', description: 'The connection ID to update' },
90-
data: { type: 'object', description: 'Connection configuration data to update' },
91-
},
92-
required: ['connectionId', 'data'],
93-
},
94-
execute: async (make: Make, args: { connectionId: number; data: Record<string, JSONValue> }) => {
95-
return await make.connections.update(args.connectionId, args.data);
96-
},
97-
},
98-
{
99-
name: 'connections_rename',
100-
title: 'Rename connection',
101-
description: 'Rename a connection',
102-
category: 'connections',
103-
scope: 'connections:write',
104-
identifier: 'connectionId',
105-
inputSchema: {
106-
type: 'object',
107-
properties: {
108-
connectionId: { type: 'number', description: 'The connection ID to rename' },
10990
name: { type: 'string', description: 'The new name for the connection' },
91+
data: { type: 'object', description: 'Connection configuration data to update' },
11092
},
111-
required: ['connectionId', 'name'],
93+
required: ['connectionId'],
11294
},
113-
execute: async (make: Make, args: { connectionId: number; name: string }) => {
114-
return await make.connections.rename(args.connectionId, args.name);
95+
execute: async (
96+
make: Make,
97+
args: { connectionId: number; name?: string; data?: Record<string, JSONValue> },
98+
) => {
99+
if (args.name != null && args.name !== '') {
100+
await make.connections.rename(args.connectionId, args.name);
101+
}
102+
if (args.data != null) {
103+
await make.connections.update(args.connectionId, args.data);
104+
}
105+
return 'Connection has been updated.';
115106
},
116107
},
117108
{
@@ -129,48 +120,9 @@ export const tools = [
129120
required: ['connectionId'],
130121
},
131122
execute: async (make: Make, args: { connectionId: number }) => {
132-
return await make.connections.verify(args.connectionId);
133-
},
134-
},
135-
{
136-
name: 'connections_scoped',
137-
title: 'Verify connection scopes',
138-
description: 'Verify if given OAuth scopes are set for a given connection',
139-
category: 'connections',
140-
scope: 'connections:write',
141-
identifier: 'connectionId',
142-
inputSchema: {
143-
type: 'object',
144-
properties: {
145-
connectionId: { type: 'number', description: 'The connection ID to update scopes for' },
146-
scope: {
147-
type: 'array',
148-
items: { type: 'string' },
149-
description: 'Array of scope identifiers to set',
150-
},
151-
},
152-
required: ['connectionId', 'scope'],
153-
},
154-
execute: async (make: Make, args: { connectionId: number; scope: string[] }) => {
155-
return await make.connections.scoped(args.connectionId, args.scope);
156-
},
157-
},
158-
{
159-
name: 'connections_list_editable_parameters',
160-
title: 'List editable connection parameters',
161-
description: 'List editable parameters for a connection',
162-
category: 'connections',
163-
scope: 'connections:read',
164-
identifier: 'connectionId',
165-
inputSchema: {
166-
type: 'object',
167-
properties: {
168-
connectionId: { type: 'number', description: 'The connection ID to get editable parameters for' },
169-
},
170-
required: ['connectionId'],
171-
},
172-
execute: async (make: Make, args: { connectionId: number }) => {
173-
return await make.connections.listEditableParameters(args.connectionId);
123+
return (await make.connections.verify(args.connectionId))
124+
? 'Connection is valid.'
125+
: 'Connection is not valid.';
174126
},
175127
},
176128
{
@@ -188,7 +140,8 @@ export const tools = [
188140
required: ['connectionId'],
189141
},
190142
execute: async (make: Make, args: { connectionId: number }) => {
191-
return await make.connections.delete(args.connectionId);
143+
await make.connections.delete(args.connectionId);
144+
return 'Connection has been deleted.';
192145
},
193146
},
194147
];

src/endpoints/data-store-records.mcp.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { JSONValue } from '../types.js';
33

44
export const tools = [
55
{
6-
name: 'data_store_records_list',
6+
name: 'data-store-records_list',
77
title: 'List data store records',
88
description: 'List all records in a data store',
99
category: 'data-store-records',
@@ -22,7 +22,7 @@ export const tools = [
2222
},
2323
},
2424
{
25-
name: 'data_store_records_create',
25+
name: 'data-store-records_create',
2626
title: 'Create data store record',
2727
description: 'Create a new record in a data store',
2828
category: 'data-store-records',
@@ -46,7 +46,7 @@ export const tools = [
4646
},
4747
},
4848
{
49-
name: 'data_store_records_update',
49+
name: 'data-store-records_update',
5050
title: 'Update data store record',
5151
description: 'Update an existing record in a data store',
5252
category: 'data-store-records',
@@ -66,7 +66,7 @@ export const tools = [
6666
},
6767
},
6868
{
69-
name: 'data_store_records_replace',
69+
name: 'data-store-records_replace',
7070
title: 'Replace data store record',
7171
description: "Replace an existing record in a data store or create if it doesn't exist",
7272
category: 'data-store-records',
@@ -86,7 +86,7 @@ export const tools = [
8686
},
8787
},
8888
{
89-
name: 'data_store_records_delete',
89+
name: 'data-store-records_delete',
9090
title: 'Delete data store records',
9191
description: 'Delete specific records from a data store by keys',
9292
category: 'data-store-records',
@@ -101,7 +101,8 @@ export const tools = [
101101
required: ['dataStoreId', 'keys'],
102102
},
103103
execute: async (make: Make, args: { dataStoreId: number; keys: string[] }) => {
104-
return await make.dataStores.records.delete(args.dataStoreId, args.keys);
104+
await make.dataStores.records.delete(args.dataStoreId, args.keys);
105+
return `Records have been deleted.`;
105106
},
106107
},
107108
];

src/endpoints/data-stores.mcp.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Make } from '../make.js';
22

33
export const tools = [
44
{
5-
name: 'data_stores_list',
5+
name: 'data-stores_list',
66
title: 'List data stores',
77
description: 'List all data stores for a team',
88
category: 'data-stores',
@@ -20,7 +20,7 @@ export const tools = [
2020
},
2121
},
2222
{
23-
name: 'data_stores_get',
23+
name: 'data-stores_get',
2424
title: 'Get data store',
2525
description: 'Get data store details by ID',
2626
category: 'data-stores',
@@ -38,7 +38,7 @@ export const tools = [
3838
},
3939
},
4040
{
41-
name: 'data_stores_create',
41+
name: 'data-stores_create',
4242
title: 'Create data store',
4343
description: 'Create a new data store',
4444
category: 'data-stores',
@@ -65,7 +65,7 @@ export const tools = [
6565
},
6666
},
6767
{
68-
name: 'data_stores_update',
68+
name: 'data-stores_update',
6969
title: 'Update data store',
7070
description: 'Update a data store',
7171
category: 'data-stores',
@@ -90,7 +90,7 @@ export const tools = [
9090
},
9191
},
9292
{
93-
name: 'data_stores_delete',
93+
name: 'data-stores_delete',
9494
title: 'Delete data store',
9595
description: 'Delete a data store',
9696
category: 'data-stores',
@@ -104,7 +104,8 @@ export const tools = [
104104
required: ['dataStoreId'],
105105
},
106106
execute: async (make: Make, args: { dataStoreId: number }) => {
107-
return await make.dataStores.delete(args.dataStoreId);
107+
await make.dataStores.delete(args.dataStoreId);
108+
return `Data store has been deleted.`;
108109
},
109110
},
110111
];

0 commit comments

Comments
 (0)