When something breaks in your Next.js app, wouldn't it be amazing if your AI code editor could see exactly what happened? Kubiks CLI makes this possible.
- π Capture everything: Requests, AI SDK calls, tool calls and many more
- π€ Feed Cursor complete context available to Cursros through MCP (Model Context Protocol)
- β‘ Debug faster: Ask Cursor to fix issues with full trace data and request payloads
npm i -g @kubiks/clibrew install kubiks-inc/tap/kubiksnpm i @vercel/otel// instrumentation.ts
import { registerOTel, OTLPHttpJsonTraceExporter } from "@vercel/otel";
export function register() {
registerOTel({
serviceName: "your-project-name",
traceExporter: new OTLPHttpJsonTraceExporter({
// Prefer traces-specific endpoint, fallback to base
url: process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT || process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
}),
});
}To capture AI SDK calls like generateText, streamText, and generateObject, you need to enable experimental telemetry in your AI SDK configuration:
import { generateText } from 'ai';
const result = await generateText({
model: 'openai/gpt-4',
prompt: 'Hello, world!',
experimental_telemetry: {
isEnabled: true,
},
});Note: This experimental telemetry feature must be enabled for each AI SDK call to ensure proper trace capture.
# In your Next.js project directory
kubiksThis will automatically configure OpenTelemetry and start capturing traces from your Next.js application.
-
Local-first guarantees
- Kubiks runs a local OTLP HTTP collector at
http://localhost:7432and always writes to a local SQLite DB used by the UI and MCP. This path is permanent. - Remote export is an additional mirror.
- Kubiks runs a local OTLP HTTP collector at
-
Endpoints
OTEL_EXPORTER_OTLP_ENDPOINT(base, e.g.http://collector:4318) β used to derive per-signal endpoints if not explicitly setOTEL_EXPORTER_OTLP_TRACES_ENDPOINT(override) β if set, used as remote mirror target for traces; the app still also sends traces tohttp://localhost:7432/v1/tracesOTEL_EXPORTER_OTLP_LOGS_ENDPOINT(override) β remote mirror target for logsOTEL_EXPORTER_OTLP_PROTOCOLβhttp/json(default)OTEL_EXPORTER_OTLP_HEADERSβ comma-separatedKey=Valuepairs for auth (e.g.,Authorization=Bearer <token>)
-
Console logs forwarding
- Kubiks captures your app
stdout/stderrand forwards them to the remote logs endpoint as OTLP/HTTP JSON (and always stores them locally for the UI):- Derives remote logs endpoint from base β
/v1/logsunlessOTEL_EXPORTER_OTLP_LOGS_ENDPOINTis set
- Derives remote logs endpoint from base β
- Optional single-line JSON console output (less row spam):
KUBIKS_LOGS_SINGLE_LINE_JSON=true- Wraps console methods to emit a single JSON line per call:
{time, level, service, message}
- Kubiks captures your app
-
Local collector:
:7432- Receives OTLP HTTP JSON:
/v1/traces,/v1/logs,/v1/metrics - Inserts into local SQLite (UI + MCP read from here)
- If remote endpoints are configured, mirrors the same payloads upstream (local write never depends on remote success)
- Receives OTLP HTTP JSON:
-
App launcher
- Always sets
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:7432/v1/tracesfor the Next.js dev server to ensure the local DB is populated - Uses your
.envto derive the remote mirror target(s)
- Always sets
- MCP tools fetch from the local SQLite DB (never the remote).
- Because we always write locally first, MCP remains fully functional even if the remote collector is down.
We welcome contributions! This is an open-source project built for the developer community.
git clone https://github.com/kubiks-inc/kubiks-cli.git
cd kubiks-cli
make deps
make test
make buildDrop us a star β it keeps us building!
Apache 2.0 License - see LICENSE file for details.
- π Report issues
- π‘ Request features
- π¬ Join discussions
- π§ Email: support@kubiks.ai
Made with β€οΈ by engineers, for engineers. Happy debugging! πβ¨