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

rcp-sdk

v0.2.0

Published

Reference SDK for RCP (REST Connector Protocol) — a lightweight, open protocol for exposing REST APIs as AI-callable tools.

Readme

RCP — REST Connector Protocol

A lightweight, open protocol for exposing REST APIs as AI-callable tools — without running a protocol server. If MCP is the right fit when you need rich, stateful capabilities, RCP is for the much more common case: you already have a REST API, and you just want an AI application to be able to call some of its endpoints as tools.

The shape of it

A server publishes a plain JSON manifest at a URL. A client fetches it, builds callable tools from it, and calls the endpoints it describes directly — no JSON-RPC, no persistent connection.

Client                             Server
------                             ------
GET  <manifest-url>          -->  200 { "rcpVersion": "0.1", "tools": [...] }
...model picks a tool...
<method> <tool's own url>    -->  (whatever that endpoint normally returns)

This package

rcp-sdk ships five entry points:

// Building the AI application? Import the client.
import { createRcpClient } from "rcp-sdk/client";

// Exposing your own REST endpoints as tools? Import the server helper.
import { defineTool } from "rcp-sdk/server";

// Using OpenAI? Import the adapter to convert RCP tools to OpenAI format.
import { rcpToolsToOpenAiTools, loadOpenAiTools } from "rcp-sdk/adapters/openai";

// Using LangChain? Import the adapter to convert RCP tools to LangChain tools.
import { rcpToolsToLangChainTools, loadRcpLangChainTools } from "rcp-sdk/adapters/langchain";

// Using Gemini? Import the adapter to convert RCP tools to Gemini format.
import { rcpToolsToGeminiInteractionsTools, loadGeminiTools } from "rcp-sdk/adapters/gemini";

See examples/basic for a minimal end-to-end example: a tiny server exposing one tool, and a client discovering + calling it.

LangChain adapter

The rcp-sdk/adapters/langchain entry point converts RCP-discovered tools into LangChain DynamicStructuredTool instances. It handles schema conversion, response mapping, and resolver-bound context injection automatically.

import { createRcpClient } from "rcp-sdk/client";
import { rcpToolsToLangChainTools, loadRcpLangChainTools } from "rcp-sdk/adapters/langchain";

const rcp = createRcpClient();

// One-call: discover + convert
const tools = await loadRcpLangChainTools("https://example.com/rcp/manifest", rcp, {
  context: { userId: "u_1" }, // resolver-bound values, hidden from model
  serverName: "myApi", // prefixes tool names: myApi__tool_name
});

// Or manually: discover then convert
const { tools } = await rcp.discover("https://example.com/rcp/manifest");
const langchainTools = rcpToolsToLangChainTools(tools, rcp);

// Pass to any LangChain agent or chain
import { createAgent } from "langchain";
const agent = createAgent({ model: "gpt-4o-mini", tools: langchainTools });

See examples/langchain-client for a full interactive chat example.

Gemini adapter

The rcp-sdk/adapters/gemini entry point converts RCP-discovered tools into Google GenAI format. It supports both the Interactions API and the classic generateContent API.

import { createRcpClient } from "rcp-sdk/client";
import { rcpToolsToGeminiInteractionsTools } from "rcp-sdk/adapters/gemini";
import { GoogleGenAI } from "@google/genai";

const rcp = createRcpClient();
const { tools } = await rcp.discover("https://example.com/rcp/manifest");
const geminiTools = rcpToolsToGeminiInteractionsTools(tools);

const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
const interaction = await ai.interactions.create({
  model: "models/gemini-2.5-flash",
  input: prompt,
  tools: geminiTools,
});

See examples/gemini-client for a full example with tool-calling loop.

Docs

  • docs/client.md — createRcpClient() API reference: options, discover(), call(), logging, describeManifest(), error classes.
  • docs/server.md — defineTool() API reference: options, t.arg(), how args maps to manifest params.
  • docs/langchain.md — LangChain adapter API reference: options, context providers, MultiServerRcpClient.
  • docs/openai.md — OpenAI adapter API reference: tool format conversion.
  • docs/gemini.md — Gemini adapter API reference: Interactions + classic format.

Status

v0.2.0, in active design.

  • Auth: none and header are implemented; oauth2 is fully specified but throws "not implemented" at runtime.
  • Per-tool auth overrides (a tool declaring different auth than its server's default) aren't implemented yet — call() throws rather than silently using the wrong credentials.
  • Resolvers, client-injected headers, and pluggable logging (silent by default) are implemented and tested — see docs/client.md.
  • LangChain adapter: rcpToolsToLangChainTools, loadRcpLangChainTools, MultiServerRcpClient, and rcpToolToLangChainTool are implemented and tested (43 tests).
  • OpenAI adapter: rcpToolToOpenAiTool, rcpToolsToOpenAiTools, loadOpenAiTools are implemented and tested (10 tests).
  • Gemini adapter: rcpToolToGeminiInteractionsTool, rcpToolsToGeminiInteractionsTools, rcpToolToGeminiFunctionDeclaration, rcpToolsToGeminiClassicTools, loadGeminiTools are implemented and tested (12 tests).
  • No skills/resources-equivalent primitive — tools only, for now.

Development

pnpm install
pnpm typecheck
pnpm test
pnpm build
pnpm example   # runs examples/basic/run.ts end-to-end