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:
| Package | Purpose |
|---|---|
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.
| Field | Type | Description |
|---|---|---|
name | string | Unique tool name (prefix with vertical scope) |
description | string | What the tool does |
parameters | MCPToolParameters | JSON Schema input definition |
handler | function | Execution function receiving (args, context?) |
category | string | Tool category for filtering |
requiresAuth | boolean | Requires authenticated user |
requiresApproval | boolean | Triggers HITL approval |
requiredRoles | string[] | Required RBAC roles |
rateLimit | object | { maxCalls, windowMs } |
governance | object | Data 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:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Lowercase kebab-case identifier |
displayName | string | Yes | Human-readable name |
version | string | Yes | Semver version |
scope | string | Yes | npm scope (must start with @meetloyd/) |
meetloyd.minVersion | string | Yes | Minimum platform version |
entryPoints.* | string | No | Paths to tools, MCP server, API, DB schema, web UI |
capabilities | string[] | Yes | mcp-tools, mcp-server, trpc-api, web-ui, db |
categories | string[] | Yes | Domain categories |
compliance | string[] | No | Compliance 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
- MCP Integration -- How MCP tools work in MeetLoyd
- Custom Tools -- Building tools without the SDK
- TypeScript SDK -- Platform client SDK