Skip to main content

Vertical SDK

Build domain-specific applications (verticals) that plug into MeetLoyd. A vertical packages MCP tools, tRPC APIs, databases, and UIs for a specific domain like wealth management, claims processing, or HR payroll.

Installation

pnpm add @meetloyd/vertical-sdk

Or scaffold a complete project:

npx create-meetloyd-vertical claims-management
npx create-meetloyd-vertical claims-management --scope cm --description "Insurance claims"

Quick Start

1. Define Tools

import { defineTool, createToolRegistry } from "@meetloyd/vertical-sdk";

const registry = createToolRegistry("claims");

registry.register(
defineTool({
name: "claims_file_new",
description: "File a new insurance claim",
parameters: {
type: "object",
properties: {
policyNumber: { type: "string", description: "Policy number" },
description: { type: "string", description: "Claim description" },
amount: { type: "number", description: "Claimed amount" },
},
required: ["policyNumber", "description"],
},
handler: async (args) => {
return { claimId: "CLM-001", status: "filed" };
},
category: "claims",
})
);

2. Create the Vertical Entry Point

import { defineVertical } from "@meetloyd/vertical-sdk";
import { claimsTools } from "./tools/index.js";

export default defineVertical({
name: "claims",
displayName: "Claims Management",
description: "Insurance claims processing and management",
version: "0.1.0",
scope: "@meetloyd/cm",
categories: ["insurance", "claims"],
tools: claimsTools,
});

3. Add a Manifest

Create meetloyd.vertical.json at the root of your project to declare capabilities to the platform.

Project Structure

The scaffolder creates this monorepo layout:

PackagePurpose
core/Business logic
db/Database layer (PostgreSQL via Drizzle)
api/tRPC API routes
mcp-server/Standalone MCP server
meetloyd-tools/Tool definitions + vertical entry
web/Web UI components

API Reference

defineVertical(definition)

Creates a vertical that MeetLoyd can mount and discover. Key fields: name, displayName, description, version, scope, categories, tools, and optional resources, prompts, compliance.

defineTool(options)

Defines a single MCP tool with type safety.

FieldTypeDescription
namestringUnique tool name (prefix with vertical scope)
descriptionstringWhat the tool does
parametersMCPToolParametersJSON Schema input definition
handlerfunctionExecution function receiving (args, context?)
categorystringTool category for filtering
requiresAuthbooleanRequires authenticated user
requiresApprovalbooleanTriggers HITL approval
requiredRolesstring[]Required RBAC roles
rateLimitobject{ maxCalls, windowMs }
governanceobjectData classification, audit level, compliance frameworks

createToolRegistry(prefix)

Creates a registry to manage tools. Methods: register(), registerAll(), getAll(), getByCategory(), getNames(), getStats(), getSchemas(), execute().

createMCPServer(options)

Creates a pre-configured MCP server for standalone use with stdio transport.

createVerticalTRPC()

Creates a typed tRPC instance with auth middleware. Provides publicProcedure and protectedProcedure (requires userId).

createDBSingleton(key, factory)

Creates a global-safe database client instance (avoids multiple connections in dev). Works with Drizzle ORM, which matches the platform's database layer.

Manifest Reference

The meetloyd.vertical.json file declares your vertical's capabilities:

FieldTypeRequiredDescription
namestringYesLowercase kebab-case identifier
displayNamestringYesHuman-readable name
versionstringYesSemver version
scopestringYesnpm scope (must start with @meetloyd/)
meetloyd.minVersionstringYesMinimum platform version
entryPoints.*stringNoPaths to tools, MCP server, API, DB schema, web UI
capabilitiesstring[]Yesmcp-tools, mcp-server, trpc-api, web-ui, db
categoriesstring[]YesDomain categories
compliancestring[]NoCompliance frameworks (e.g., "Solvency II")

MCPContext

Every tool handler receives an optional context with userId, tenantId, agentId, teamId, appId, runId, conversationId, and vertical-specific state.

Governance

Tools support governance metadata for regulated industries:

defineTool({
name: "claims_approve_payout",
requiresApproval: true,
requiredRoles: ["claims_manager"],
rateLimit: { maxCalls: 10, windowMs: 3600000 },
governance: {
dataClassification: "confidential",
auditLevel: "full",
complianceFrameworks: ["Solvency II", "GDPR"],
},
// ...handler
});

Next Steps