Spanly Docs

TypeScript SDK

Instrument a TypeScript or Node MCP server with @spanly/sdk in one line.

The TypeScript SDK is HTTP middleware: mount spanly() in front of any MCP server that speaks HTTP and it captures every tool call, prompt, resource access, and JSON-RPC packet, with no changes to your server code. It runs on Node, Bun, and Deno.

npm install @spanly/sdk
import express from "express";import { spanly } from "@spanly/sdk";const app = express();app.use(spanly({ apiKey: process.env.SPANLY_API_KEY }));// app.use("/mcp", mcpRouter);

In this section

  • Installation covers package install and the SPANLY_API_KEY environment variable.
  • Quickstart walks through mounting the middleware in a typical server end to end, including the Fetch/Hono binding and serverless delivery.
  • API reference documents spanly(), wrapFetchHandler(), and every option they accept.
  • Examples shows end-user attribution, a local test harness, and what the middleware does not do.

On this page