Spice integrates with tools and services using the Model Context Protocol (MCP). MCP tools can be configured to run internally or connect to external servers over HTTP using the Server-Sent Events (SSE) protocol.
MCP helps extend the capabilities of the Spice runtime by enabling integration with external tools and services. This includes:
To configure MCP tools, define them in the tools section of your spicepod.yaml file. The from field specifies the transport mechanism, such as mcp:npx for stdio-based tools or an HTTP URL for SSE-based tools.
The following example demonstrates how to configure an MCP tool using npx to run a Google Maps MCP server:
This example shows how to connect to an external MCP server over SSE:
Once configured, MCP tools can be assigned to models via the tools parameter. For example:
Spice can also act as an MCP server, exposing its tools over SSE. This enables other Spice instances or external systems to connect and use the tools.
fromThe from field specifies the transport mechanism for the MCP tool:
/sse (e.g., http://localhost:8090/v1/mcp/sse).mcp:npx or mcp:docker. Additional arguments can be passed via params.mcp_args.paramsThe params field provides additional configuration for MCP tools. For stdio-based tools, use mcp_args to specify command-line arguments.
envFor stdio-based MCP tools, environment variables can be set using the env field.
descriptionThe description field provides a textual description of the tool. This description is passed to any language model that uses the tool.
For more details, see the [MCP Tools Reference(../../reference/spicepod/tools).