MCP Overview
Learn how to use Model Context Protocol (MCP) actions in your SpinAI applications
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 our npx spinai-mcp
helper function.
For example:
To include environment variables:
Providers
Right now we currently support MCPs from:
Using your MCP with a SpinAI Agent
Example code:
To use your MCP actions within your SpinAI Agent, you can simply use the 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). |