Using MCP Actions in SpinAI
SpinAI’s integration with Model Context Protocol (MCP) allows you to seamlessly incorporate powerful platform actions into your AI agents. MCP actions work just like regular SpinAI actions, and can be composed with other actions in your agent’s toolkit. This is extremely powerful because it has the potential to give your AI agents a whole toolbox of actions without writing any code yourself. Currently, we support all MCPs available on Smithery’s MCP registry.Installing a MCP (from Smithery)
To install an MCP locally, it’s as easy as running ournpx spinai-mcp
helper function.
For example:
Providers
Right now we currently support MCPs from:Using your MCP with a SpinAI Agent
Example code:createActionsFromMcpConfig
function to convert them to regular SpinAI Actions.
Parameter | Type | Description |
---|---|---|
config | McpConfig | The MCP config file (mcp-config.ts). |
envMapping | Record<string, string | undefined> | Environment variable mappings to apply to all MCPs. Format: { "MCP_VAR_NAME": process.env.myVariable } . If this AND one in mcp-config.ts are passed in, it will prioritize this one. |
excludedActions | string[] | IDs of actions to exclude. |
includedActions | string[] | IDs of actions to include (if empty, all actions except excluded ones are included). |