MCP integration

The platform exposes an MCP (Model Context Protocol) endpoint so AI agents can deploy, manage, and diagnose functions using structured tools.

Endpoint and auth

  • URL: https://api.fold.run/mcp
  • Methods: POST (tool calls) and GET (SSE stream)
  • Auth: Authorization: Bearer <token> — requires an API token with admin role.

Configure your MCP client with this URL and your Bearer token.

Tools

The platform exposes 12 MCP tools organized into four categories.

Deployment

Tool Parameters Purpose
deploy_function name, code, bindings? Deploy code to the platform. Returns live URL and activation endpoint.
deploy_from_description name, description Generate code from a natural language description, then deploy it.
create_tool name, description Generate and deploy an MCP tool with auto-generated input schema.

Function management

Tool Parameters Purpose
list_functions List all deployed functions with URLs, versions, and status.
get_activation_logs function_id, status?, limit? Read recent execution records. Filter by status (success, error, timeout). Default limit: 10, max: 100.
rollback_function function_id, version Revert a function to a previous version.
delete_function function_id Delete a function and all its activation records.
diagnose_error function_id AI-powered error diagnosis — analyzes error patterns and source code.

Memory (vector storage)

Tool Parameters Purpose
store_memory id, text, namespace?, metadata? Store text in vector memory for agent context across conversations.
search_memory query, top_k?, namespace? Semantic search over stored memories. Default top_k: 10, max: 100.

Tool registry

Tool Parameters Purpose
search_tools q?, category?, limit? Search the tool registry by name, category, or description. Default limit: 25, max: 100.
get_tool_info tool_id Get tool details including input schema and MCP endpoint URL.

Client configuration

Claude Desktop

Add to your Claude Desktop MCP config (claude_desktop_config.json):

{
  "mcpServers": {
    "fold": {
      "url": "https://api.fold.run/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Claude Code

claude mcp add fold https://api.fold.run/mcp \
  --header "Authorization: Bearer YOUR_API_TOKEN"

Generic MCP client

Any MCP client that supports the Streamable HTTP transport can connect. Point it at https://api.fold.run/mcp with your Bearer token as an Authorization header.

Typical flow

  1. deploy_function — Deploy with name and code (plus optional bindings). Note the returned function_id and url.
  2. list_functions — List functions to see versions and status.
  3. get_activation_logs — After traffic hits the URL, check success/errors and duration with the function_id.
  4. diagnose_error — If errors appear, run AI diagnosis to get root-cause analysis and fix suggestions.

For rollbacks or cleanup, use rollback_function or delete_function with the function_id.

AI-assisted deployment

Two tools let you skip writing code entirely:

  • deploy_from_description — Describe what you want in natural language. The platform generates the code and deploys it in one step.
  • create_tool — Describe a tool and the platform generates both the implementation and a JSON input schema, then deploys it as an MCP-compatible endpoint.

Vector memory

Agents can persist context across conversations using vector memory:

store_memory(id="user-pref-1", text="User prefers JSON responses", namespace="prefs")
search_memory(query="what format does the user prefer?", namespace="prefs")

Organization context is derived automatically from the authenticated session.

Memories are stored as vector embeddings and retrieved via semantic similarity search. Use namespace to organize memories by topic or conversation.

Pipelines as MCP tools

Active pipelines are automatically registered as MCP tools with pipeline: prefix on the MCP endpoint (/.well-known/mcp). Agents see them alongside individual tools. See the Pipelines guide for details.

Guardrails

If guardrail policies are configured, MCP tool calls are checked before dispatch (input) and after response (output). A block policy returns an MCP error instead of executing the tool.

Example prompts

  • "Deploy this code as my-api and tell me the URL."
  • "Generate a function that returns the current time as JSON and deploy it."
  • "Create a tool called weather-lookup that fetches weather data for a given city."
  • "List all my functions."
  • "Show the last 10 error activations for function fn_xyz."
  • "Roll back function fn_xyz to version 2."
  • "Diagnose errors for function fn_xyz."
  • "Store this context: the user's API uses v2 authentication."
  • "Search memory for authentication details."
  • "Search the tool registry for image processing tools."