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

@secondlayer/mcp

v2.2.0

Published

MCP server for Secondlayer's agent-native subgraph platform.

Downloads

2,218

Readme

@secondlayer/mcp

MCP server for Secondlayer's agent-native subgraph platform.

Install

bun add @secondlayer/mcp

Quick Start — Stdio (IDE)

Add to your Claude Desktop or Cursor config:

{
  "mcpServers": {
    "secondlayer": {
      "command": "bunx",
      "args": ["-p", "@secondlayer/mcp", "secondlayer-mcp"],
      "env": {
        "SECONDLAYER_API_URL": "https://<slug>.secondlayer.tools",
        "SL_SERVICE_KEY": "sl_live_..."
      }
    }
  }
}

Quick Start — HTTP (Remote)

export SECONDLAYER_API_URL=https://<slug>.secondlayer.tools
export SL_SERVICE_KEY=sl_live_...
export SECONDLAYER_MCP_SECRET=your-secret
bunx -p @secondlayer/mcp secondlayer-mcp-http
# Listening on port 3100

Agent Golden Path

Use MCP when the agent should do the full loop: scaffold a subgraph from a contract, deploy it, query generated tables, create a table subscription, and replay deliveries by block range when needed.

Environment Variables

| Variable | Required | Default | Description | | --- | --- | --- | --- | | SL_SERVICE_KEY | Yes | — | Tenant service key. SECONDLAYER_API_KEY is still accepted as a deprecated alias. | | SECONDLAYER_API_URL | No | https://api.secondlayer.tools | Base URL for the tenant API. Use https://<slug>.secondlayer.tools for a dedicated tenant or point at a local instance for dev. | | SECONDLAYER_MCP_PORT | No | 3100 | HTTP transport port | | SECONDLAYER_MCP_SECRET | No | — | Bearer token for HTTP auth. Disabled if unset. |

Tools

| Domain | Tools | | --- | --- | | Subgraphs (7) | subgraphs_list, subgraphs_get, subgraphs_query, subgraphs_reindex, subgraphs_delete, subgraphs_deploy, subgraphs_read_source | | Subscriptions (12) | subscriptions_list, subscriptions_get, subscriptions_create, subscriptions_update, subscriptions_pause, subscriptions_resume, subscriptions_delete, subscriptions_rotate_secret, subscriptions_replay, subscriptions_recent_deliveries, subscriptions_dead, subscriptions_requeue_dead | | Scaffold (2) | scaffold_from_contract, scaffold_from_abi | | Account (1) | account_whoami |

subgraphs_query enhancements

  • fields — comma-separated column projection (e.g. "sender,amount_x")
  • count — boolean, returns row count instead of rows
  • Filter operators: eq, neq, gt, gte, lt, lte, like
  • Max limit raised from 50 to 200

Resources

2 MCP resources for agent context:

| URI | Description | | --- | --- | | secondlayer://filters | Filter types reference | | secondlayer://column-types | Column type mappings and options |

Error Handling

All tools return structured errors with isError: true:

{ "error": { "type": "not_found", "status": 404, "message": "Subgraph not found" } }

| Error type | Status | When | | --- | --- | --- | | unauthorized | 401 | Invalid or missing API key | | not_found | 404 | Resource doesn't exist | | rate_limited | 429 | Too many requests | | server_error | 5xx | Server-side failure | | error | other | Validation, bundling, etc. |

Bundle/deploy errors use descriptive prefixes: "Bundle failed:", "Module evaluation failed:", "Validation failed:".

HTTP transport enforces a 1MB body limit (413) and JSON parse safety (400). Scaffold ABI fetch has a 10s timeout.

Programmatic Usage

import { createServer } from "@secondlayer/mcp";

const server = createServer();
// Connect to your own transport

License

MIT