Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 20 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@makehq/sdk",
"version": "0.6.0",
"version": "0.7.0",
"description": "Make TypeScript SDK",
"license": "MIT",
"author": "Make",
Expand Down
4 changes: 3 additions & 1 deletion scripts/run-mcp-server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
],
};
Expand Down
40 changes: 0 additions & 40 deletions src/endpoints/blueprints.mcp.ts

This file was deleted.

83 changes: 18 additions & 65 deletions src/endpoints/connections.mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, JSONValue> }) => {
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<string, JSONValue> },
) => {
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.';
},
},
{
Expand All @@ -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.';
},
},
{
Expand All @@ -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.';
},
},
];
13 changes: 7 additions & 6 deletions src/endpoints/data-store-records.mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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.`;
},
},
];
13 changes: 7 additions & 6 deletions src/endpoints/data-stores.mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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.`;
},
},
];
Loading