npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@doclight/mcp

v0.1.0

Published

Automatic instrumentation for MCP servers via the Doclight Agent Observability SDK

Readme

@doclight/mcp

Automatic instrumentation for MCP servers via the Doclight Agent Observability SDK. Wraps @doclight/node with a trackTool convenience layer so each tool call is automatically timed and recorded without boilerplate.

Install

npm install @doclight/mcp

Before / after

// Before — plain MCP server
import { Server } from "@modelcontextprotocol/sdk/server/index.js"
const server = new Server({ name: "my-server", version: "1.0.0" })
server.setRequestHandler(CallToolRequestSchema, handler)

// After — automatic instrumentation (+2 lines)
import { withDoclight } from "@doclight/mcp"
const server = withDoclight(new Server({ name: "my-server", version: "1.0.0" }), {
  apiKey: process.env.DOCLIGHT_API_KEY!,
  projectId: process.env.DOCLIGHT_PROJECT_ID!,
})
server.setRequestHandler(CallToolRequestSchema, handler)

withDoclight monkey-patches all tool handlers on the server instance to automatically open a session, record timing and outcome, and close the session for every tool call.

What NEVER Gets Captured

  • Tool input arguments
  • Tool output / response content
  • Prompt text or user messages
  • Any secrets or credentials

What gets instrumented automatically

| Event type | Trigger | Key fields | | --- | --- | --- | | session_started | Tool call begins | goal = tool name | | tool_called | Tool handler runs | toolName, durationMs, status | | session_completed | Tool call returns | outcome = success/failed/timeout | | error_occurred | Handler throws | errorType, errorMessage |

Session lifecycle

stdio transport: One session per tool call (session_started → tool_called → session_completed). The process lifetime may span many sessions — each tool invocation is independent.

HTTP transport: Same single-call lifecycle. Sessions are independent between requests; there is no shared session across concurrent HTTP calls.

Manual quickstart (without withDoclight)

import { createDoclightMcp } from "@doclight/mcp"
import { Server } from "@modelcontextprotocol/sdk/server/index.js"
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import { CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js"

const mcp = createDoclightMcp({
  apiKey: process.env.DOCLIGHT_API_KEY!,
  projectId: process.env.DOCLIGHT_PROJECT_ID!,
})

const server = new Server({ name: "my-mcp-server", version: "1.0.0" })

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const sessionId = mcp.startSession(request.params.name)

  const result = await mcp.trackTool(
    request.params.name,
    sessionId,
    () => runTool(request.params),
  )

  mcp.endSession(sessionId, "success")
  return result
})

const transport = new StdioServerTransport()
await server.connect(transport)

process.on("SIGINT", async () => {
  await mcp.shutdown()
  process.exit(0)
})

API

createDoclightMcp(config)

Returns a DoclightMcp context. Lifecycle hooks are disabled by default so the MCP server process owns its own shutdown sequence. Pass lifecycleHooks: true to re-enable them.

| Method | Description | | --- | --- | | startSession(goal?) | Open a new session; returns sessionId | | endSession(sessionId, outcome) | Close the session | | trackTool(name, sessionId, fn) | Run fn, record duration + outcome | | flush() | Flush buffered events immediately | | shutdown() | Flush and close the transport | | client | The underlying Doclight instance |


Example MCP server →

Full documentation →