Alpha API

This API is currently in alpha. Breaking changes may occur between releases. We recommend pinning to a specific version and monitoring the changelog for updates.

MCP Server Reference

The @lightfastai/mcp package provides a Model Context Protocol server that exposes Lightfast tools to AI assistants.

Installation

bash
npx @lightfastai/mcp
# or
npm install -g @lightfastai/mcp

CLI Options

bash
npx @lightfastai/mcp [options]
OptionTypeDefaultDescription
--api-keystring$LIGHTFAST_API_KEYLightfast API key
--base-urlstringhttps://lightfast.aiAPI base URL
--help, -h--Show help message
--version, -v--Show version

Environment Variables

VariableDescription
LIGHTFAST_API_KEYAPI key (alternative to --api-key flag)

Tools

The MCP server exposes the following tool to AI assistants.

Search through connected tools for relevant decisions and observations.

Parameters

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

ParameterTypeRequiredDefaultDescription
querystringYesSearch query text
limitnumberNo10Max results (1–100)
offsetnumberNo0Pagination offset
mode"fast" | "balanced"No"balanced"fast = vector scores only, balanced = Cohere rerank
sourcesstring[]NoFilter by provider (e.g. ["github", "linear"])
typesstring[]NoFilter by entity type (e.g. ["pull_request", "issue"])
afterstringNoISO 8601 datetime lower bound
beforestringNoISO 8601 datetime upper bound

Example Request

json
{
  "name": "lightfast_search",
  "arguments": {
    "query": "how does authentication work",
    "limit": 5,
    "mode": "balanced",
    "sources": ["github"],
    "after": "2024-01-01T00:00:00Z"
  }
}

Error Responses

All tools return errors in the following format:

json
{
  "error": "ERROR_CODE",
  "message": "Human-readable error message",
  "requestId": "req_abc123"
}
Error CodeDescription
UNAUTHORIZEDInvalid or missing API key
VALIDATION_ERRORInvalid parameters
NOT_FOUNDResource not found
INTERNAL_ERRORServer error