Linea Docs

MCP Integration

Attaching Model Context Protocol servers as tools to workflows.

MCP Integration

Linea supports the Model Context Protocol (MCP): a standard for connecting AI models to external tools and data sources. MCP servers are registered at the workspace level and can be attached to any workflow within that workspace.

What Is MCP?

MCP defines a client/server protocol where:

  • An MCP server exposes a set of tools (functions the model can call)
  • An MCP client (Linea's execution engine) discovers those tools and invokes them during workflow execution

This allows workflows to call external APIs, query databases, run scripts, or interact with any service that implements the MCP spec.

Schema

mcp_servers: {
  id: uuid PK
  workspaceId: uuid FKworkspaces (cascade delete)
  name: text
  description: text | null
  url: text                    // MCP server endpoint
  transport: enum('sse','stdio','streamable-http')
  authType: enum('none','bearer','basic','custom')
  authConfig: jsonb            // credentials (encrypted at rest)
  status: enum('active','inactive','error')
  lastCheckedAt: timestamp | null
  embedding: vector(1536)      // semantic search over server descriptions
  createdAt: timestamp
  updatedAt: timestamp
}
 
mcp_tools: {
  id: uuid PK
  serverId: uuid FKmcp_servers (cascade delete)
  name: text
  description: text | null
  inputSchema: jsonb           // JSON Schema for tool arguments
  embedding: vector(1536)      // semantic search over tool descriptions
  createdAt: timestamp
}

Both mcp_servers and mcp_tools store embeddings to enable semantic tool discovery (for example, "find me tools that can send emails") without requiring the exact tool name.

Transport Types

TransportDescription
sseServer-Sent Events, persistent HTTP stream
stdioStandard I/O (local process-based servers)
streamable-httpHTTP with streaming response (MCP 2025 spec)

API Endpoints

MethodPathDescription
GET/workspaces/:wId/mcp-serversList MCP servers
POST/workspaces/:wId/mcp-serversRegister server
GET/workspaces/:wId/mcp-servers/:idGet server
PATCH/workspaces/:wId/mcp-servers/:idUpdate server
DELETE/workspaces/:wId/mcp-servers/:idRemove server
POST/workspaces/:wId/mcp-servers/:id/syncDiscover and sync tools from server
GET/workspaces/:wId/mcp-servers/:id/toolsList synced tools
POST/workspaces/:wId/mcp-servers/searchSemantic tool search

Tool Sync

Calling POST .../sync connects to the MCP server, calls tools/list, and upserts mcp_tools rows. Embeddings are generated for each tool description to enable semantic search.

Semantic Tool Discovery

During execution, the workflow engine can search for relevant tools by description:

"find tools that can query a SQL database"
→ embed query
→ cosine search over mcp_tools.embedding
→ return top-K tools across all servers

This allows workflows to dynamically discover tools without hardcoding server/tool names.

On this page