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

@socketly/mcp

v0.2.0

Published

Model Context Protocol server for Socketly — publish, subscribe and inspect realtime channels from an agent.

Downloads

19

Readme

@socketly/mcp

An MCP server for Socketly, the hosted WebSocket API. It gives an agent four things a developer does constantly while wiring up realtime — publish an event, watch a channel, read a presence roster, and read the docs — so the agent can verify its own work instead of writing code and hoping.

That last part is the point. An agent that publishes blind and reports success is how generated realtime code ends up quietly wrong. One that can subscribe and see the message come back cannot.

Install

No install step. Point your MCP client at it with npx.

Claude Code

claude mcp add socketly \
  --env SOCKETLY_SECRET_KEY=sk_app_… \
  --env SOCKETLY_PUBLIC_KEY=pk_app_… \
  -- npx -y @socketly/mcp

Anything reading mcp.json (Claude Desktop, Cursor, Windsurf, VS Code…)

{
  "mcpServers": {
    "socketly": {
      "command": "npx",
      "args": ["-y", "@socketly/mcp"],
      "env": {
        "SOCKETLY_SECRET_KEY": "sk_app_…",
        "SOCKETLY_PUBLIC_KEY": "pk_app_…"
      }
    }
  }
}

Both keys are minted together when you create an app at app.socketly.co. The secret is shown exactly once.

Configuration

| Variable | Required | What it does | |---|---|---| | SOCKETLY_SECRET_KEY | yes | sk_app_…. Publishing and channel inspection. The app id is read out of it, so there is no second variable that can disagree. | | SOCKETLY_PUBLIC_KEY | no | pk_app_…. Needed to watch channels. Without it, socketly_subscribe / receive / unsubscribe are not registered at all — a tool that is always going to fail is worse than one that is absent. | | SOCKETLY_URL | no | Defaults to https://api.socketly.co. | | SOCKETLY_DOCS_URL | no | Defaults to https://docs.socketly.co. |

The secret key can publish to any channel on the app and sign a presence membership claiming to be anybody. That is the right credential for your own app on your own machine. It is the wrong one to hand an agent acting on someone else's behalf — see Not yet.

Tools

| Tool | Reversible | What it does | |---|---|---| | socketly_publish | no | Publishes an event to one or more channels, as your server would. Real clients receive it. | | socketly_channel_info | read-only | A channel's kind, and for presence- channels who is currently in it. | | socketly_subscribe | read-only | Opens a connection and starts buffering. Returns a handle. | | socketly_receive | read-only | Drains a handle. waitSeconds long-polls for the first message. | | socketly_unsubscribe | yes | Closes the subscription and its connection. |

socketly_publish is annotated readOnlyHint: false so a client can gate it behind confirmation. It is the only tool here that changes anything.

Resources

socketly://docs — the full documentation as markdown, fetched from docs.socketly.co/llms-full.txt, which the docs site generates from the same constants its own pages render.

That indirection is deliberate. A toolkit multiplies whatever is underneath it, so a copy of the code samples baked into this package would multiply a copy that drifts. Fetching means that when the pattern improves, every agent's output improves without anyone republishing this package.

Read it before writing Socketly code. It carries the thing most likely to be got wrong from memory: channels are named by their access rule, and the prefix is the permission.

How watching works, and why it is a buffer

MCP cannot push a message into a model's turn. The specification's only server-to-client mechanism, subscriptions/listen, carries four notification types — tools, prompts and resources list-changed, plus resources/updated — and none of them reaches the model.

So this server holds the socket and buffers what arrives; the agent drains it with a tool call. That is the spec's own Stateful Tools pattern, and it has consequences worth knowing:

  • A subscription closes after 5 minutes without a receive. An expired handle returns an error saying to resubscribe, rather than an empty result that reads exactly like a quiet channel.
  • The buffer holds 256 messages. Past that the oldest are dropped and receive reports the count — a silently truncated buffer is a lie an agent would reason from.
  • An open subscription is a connection, and it counts against your app's concurrent connection limit. Call socketly_unsubscribe when done.

Only public- channels can be watched. private- and presence- need a signature from the app owner's backend, which is the whole point of them.

Not yet

Creating apps and rolling keys. Those are control-plane operations behind a session cookie, and exposing them needs a personal access token the API does not have. They are also a dashboard click and they are rare; this package covers the frequent half.

An agent as a channel member. Subscribing to presence-support-4821 and replying as a participant needs a credential scoped to a channel and to one identity — the secret key grants far too much. That is a new key type in the API, not a feature of this package.

Links

MIT