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

gpt-search

v0.1.4

Published

An implementation sample that uses one Hono-based application code to support four modes:

Downloads

37

Readme

gpt-search

An implementation sample that uses one Hono-based application code to support four modes:

  • CLI (local execution)
  • Remote MCP (HTTP /mcp)
  • Local MCP (stdio)
  • HTTP API (/search)

Core behavior is inspired by:

  • https://github.com/yoshiko-pg/o3-search-mcp/

What It Is

  • Purpose: Makes OpenAI’s high-end models and their powerful web search available to your AI agents.
  • Modes: Usable both as an MCP server (stdio or HTTP) and as a stand-alone CLI.
  • Agent integration: Register it as an MCP tool in any compatible AI coding agent, or instruct the agent to call the CLI. The agent can then autonomously consult OpenAI, research on the web, and work through multi-step, complex tasks.

Requirements

  • Node.js 18+ (or Bun)
  • OpenAI API Key (OPENAI_API_KEY)

Usage

1) CLI (recommended)

Use search <input>. Add --json for pretty JSON wrapping.

Run with npx (no local install):

# latest published version
OPENAI_API_KEY=sk-... npx gpt-search@latest search "Rust learning roadmap"

# pin a specific version
OPENAI_API_KEY=sk-... npx [email protected] search "Next.js image optimization"

# tip: skip npx prompts
OPENAI_API_KEY=sk-... npx --yes gpt-search@latest search "Supabase RLS basics"

Local runs during development:

# via npm script
OPENAI_API_KEY=sk-... npm run cli -- search "Rust learning roadmap"

# direct with Bun
OPENAI_API_KEY=sk-... bun src/cli.ts search "Next.js image optimization"

# shortcut
OPENAI_API_KEY=sk-... npm run search -- "Supabase RLS basics"

2) HTTP server (local)

Expose /search and /mcp over HTTP.

Aliases: serve | server | --server | --http

Examples:

# via npm script (serve alias)
OPENAI_API_KEY=sk-... npm run cli:serve

# with npx (flag)
OPENAI_API_KEY=sk-... npx --yes gpt-search@latest --server

# with npx (alias command)
OPENAI_API_KEY=sk-... npx --yes gpt-search@latest serve

# custom port (default: 9876)
PORT=8080 OPENAI_API_KEY=sk-... npx --yes gpt-search@latest --http

# POST /search example
curl -sS -X POST localhost:9876/search \
  --json '{"input":"Next.js image optimization"}'

# MCP over HTTP endpoint
# -> http://localhost:9876/mcp

3) Local MCP (stdio)

Run an MCP server over stdio for local MCP-compatible clients.

Flag: --stdio

Examples:

# via npm script
OPENAI_API_KEY=sk-... npm run cli:stdio

# with npx (no local install)
OPENAI_API_KEY=sk-... npx --yes gpt-search@latest --stdio

4) Remote MCP (HTTP)

Connect to /mcp using @hono/mcp’s StreamableHTTPTransport.

OPENAI_API_KEY=sk-... npm run cli:serve
# -> connect to http://localhost:9876/mcp

Cloudflare Workers (optional)

Development:

npm run dev

Deploy:

npm run deploy

Type generation (optional): https://developers.cloudflare.com/workers/wrangler/commands/#types

npm run cf-typegen

Single binary (Bun)

Build on each target platform.

# debug-like
npm run build:bin   # -> bin/gpt-search

# release-like (minify)
npm run build:bin:release  # -> bin/gpt-search

# run example
OPENAI_API_KEY=sk-... ./bin/gpt-search search "Compare LLMs"

Development

Install

npm i
# or with Bun
bun install

Environment

  • OPENAI_API_KEY (required)
  • SEARCH_CONTEXT_SIZE = low|medium|high (optional, default: medium)
  • REASONING_EFFORT = low|medium|high (optional, default: low)
  • TZ (optional, default: Asia/Tokyo)
  • PORT (optional, default: 9876)

hono-cli-adapter merges environment in this order: process.env < options.env < --env KEY=VALUE.

Structure

  • src/search.ts: Common OpenAI search core
  • src/env.ts: Environment variable type definition
  • src/app.ts: MCP Server (Tool) calling runSearch()
  • src/index.ts: Hono app providing POST /search and /mcp
  • src/cli.ts: Switches between CLI/serve/stdio via hono-cli-adapter

Notes

  • CLI normalizes search <input> into POST /search { input }.
  • MCP Tool name: gpt-web-search.
  • Core: OpenAI Responses API + web_search_preview tool.

Publishing & npm exec

  • This package exposes a bin entry (gpt-search) that points to dist/cli.js.
  • After publishing to npm, you can also run:
    • OPENAI_API_KEY=sk-... npm exec gpt-search -- search "..."
    • or simply prefer npx gpt-search@latest ... as shown above.

License / Credits

  • Main idea inspired by: https://github.com/yoshiko-pg/o3-search-mcp/
  • CLI adapter: https://github.com/kiyo-e/hono-cli-adapter