
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@zapier/mcp-integration
Advanced tools
SDK for using remote Model Context Protocol (MCP) servers in/as Zapier integrations
SDK for using remote Model Context Protocol (MCP) servers in/as Zapier integrations.
To use @zapier/mcp-integration, a Zapier integration needs to:
zapier-platform-core@17.7.0 or later.z.cache().The remote MCP server needs to:
To create an integration that primarily uses MCP, including to handle authentication, follow these steps.
Initialize the integration:
zapier init my-integration --language=typescript --module esm --template oauth2
cd my-integration
NOTE: We will provide a
mcptemplate to replace some of the following steps.
Remove files we we won't need:
rm -rf src/test src/authentication.ts src/middleware.ts
Make sure your tsconfig.json includes .json files in dist/.
{
"include": ["src/**/*", "src/*.json"]
}
Make sure your .zapierapprc includes the .json files in build/.
{
"includeInBuild": ["dist/.*.json"]
}
Request to have your integration be opted in to to use z.cache().
NOTE: This feature isn't enabled by default yet. Staff can enable it using the
zacheswitch.
Install this package and all other dependencies:
npm install @zapier/mcp-integration
Create src/mcp.ts:
import { MCPIntegration } from '@zapier/mcp-integration';
import packageJson from '../package.json' with { type: 'json' };
export default new MCPIntegration({
name: packageJson.name,
version: packageJson.version,
serverUrl: 'https://example.com/mcp',
transport: 'streamable', // or 'sse'
auth: {
type: 'oauth2',
},
});
Replace https://example.com/mcp with your remote MCP server URL, and change transport when needed.
Update src/index.ts:
import zapier from 'zapier-platform-core';
import packageJson from '../package.json' with { type: 'json' };
import mcp from './mcp.js';
// import actions from "./actions.generated.js";
export default mcp.defineApp({
version: packageJson.version,
platformVersion: zapier.version,
// ...actions,
});
Compile:
npm run build
NOTE: To not have to repeat this, add
"dev": "npm run build -- --watch",to yourscriptsinpackage.json, and keep a terminal window open runningnpm run dev.
Create .env:
CLIENT_ID='dynamic'
CLIENT_SECRET='dynamic'
Create a local connection:
zapier invoke auth start
NOTE: If you run into issues, make sure you at on 17.7.0 or later.
Generate the actions:
npx @zapier/mcp-integration generate
NOTE: If you get a "Missing or invalid access token" error, check
.envto make sure there is a linebreak beforeauthData_type. This is azapier-platform-clibug (#1129).
In /src/index.ts uncomment the 2 lines.
Register the integration:
zapier register
Push the integration:
zapier push
You can run npx @zapier/mcp-integration generate at any time to generate actions for new tools and update actions when tools have changed.
NOTE: We don't yet delete generated actions for tools that no longer exist, but they will be dropped from
actions.generated.ts.
After running the command again, run any linter and formatter tools before using git diff to inspect the changes.
Once you have created or updated an MCP integration, run zapier validate and perform manual tests (e.g. in a Zap) to identify where actions need to be customized using a transformer.
Create src/transformer.ts:
import { defineTransform, extendAction } from '@zapier/mcp-integration';
export default defineTransform({
transformCreate: (action, tool) => {
console.log(`Create: ${action.key} / Tool: ${tool.name}`);
if (action.key === 'create_example') {
return extendAction(action).build();
} else {
return action;
}
},
transformSearch: (action, tool) => {
console.log(`Search: ${action.key} / Tool: ${tool.name}`);
return action;
},
transformTrigger: (action, tool) => {
console.log(`Trigger: ${action.key} / Tool: ${tool.name}`);
return action;
},
});
Hook the transformer up via src/mcp.ts:
import transformer from './transformer.js';
export default new MCPIntegration({
transformer,
// ... other configuration options
});
The above setup won't have any effect. Read on how to chain calls on extendAction to customize them.
Add fields:
extendAction(action)
.prependFields({ key: 'token', type: 'string', required: true })
.appendFields({ key: 'debug', type: 'boolean', default: false })
.build();
Modify fields:
extendAction(action)
.modifyField('page_id', (field) => ({
...field,
dynamic: 'list_pages.id.name',
}))
.build();
Replace all fields:
extendAction(action)
.replaceInputFields(
{ key: 'url', type: 'string', required: true },
{ key: 'method', type: 'string', choices: ['GET', 'POST', 'PUT'] },
)
.build();
Organize fields in the UI with groups:
export const inputFieldGroups = [
{ key: 'content', label: 'Content', emphasize: true },
{ key: 'formatting', label: 'Formatting', emphasize: false },
];
export const inputFields = [
{ key: 'title', type: 'string', required: true, group: 'content' },
{ key: 'text', type: 'text', required: true, group: 'content' },
{
key: 'formatting',
type: 'string',
list: true,
choices: { bold: 'Bold', italic: 'Italic' },
group: 'formatting',
},
];
extendAction(action)
.replaceInputFields(withNamedImport('../utils/myAction.js', 'inputFields'))
.replaceInputFieldGroups(
withNamedImport('../utils/myAction.js', 'inputFieldGroups'),
)
.build();
Link fields with given keys to use (custom) triggers to populate dynamic dropdowns:
const addDropdowns = addCommonDynamicDropdowns({
page_id: 'list_pages.id.name',
user_id: 'list_users.id.name',
});
extendAction(action).transformAllFields(addDropdowns).build();
Return undefined instead of the (build customized) action to not have it generated.
transformTool: (tool) => {
// Make read-only tools generate search/trigger instead of create
if (tool.name === 'get-user') {
return {
...tool,
annotations: { ...tool.annotations, readOnlyHint: true },
};
}
return undefined; // unchanged
},
FAQs
SDK for using remote Model Context Protocol (MCP) servers in/as Zapier integrations
The npm package @zapier/mcp-integration receives a total of 95 weekly downloads. As such, @zapier/mcp-integration popularity was classified as not popular.
We found that @zapier/mcp-integration demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 306 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.