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 🙏

© 2025 – Pkg Stats / Ryan Hefner

web-search-zaimcp

v0.1.2

Published

Minimal CommonJS helper to call BigModel MCP webSearchPrime with per-call connection and robust parsing.

Downloads

40

Readme

web-search-zaimcp — Minimal CommonJS Utility

  • Zero-dependency helper that calls the BigModel MCP webSearchPrime tool.
  • Pure JavaScript (CommonJS), easy to embed in any agent framework or script.
  • Handles double-stringified JSON and {items|results|data} wrappers. Each call now creates a fresh connection and closes it afterwards.

Files

  • src/index.js — exports webSearchPrime(queryOrParams, options).
  • examples/run-web-search.js — CLI example that loads .env and prints normalized results.

Prerequisites

  • Node.js 18+.
  • Install deps already listed in package.json (@modelcontextprotocol/sdk, dotenv).

Environment Setup

  • Set BIGMODEL_API_KEY in your shell or add it to .env at repo root.
  • Utilities never call dotenv automatically; every script should do require('dotenv').config() first.

Run the Example

  • node examples/run-web-search.js "你的查询"
  • Without args it defaults to 福建舰正式服役的外媒报道.
  • Output prints - title + URL + optional summary snippet.

webSearchPrime Usage

  • CommonJS: const { webSearchPrime } = require('web-search-zaimcp')
  • ESM/TypeScript (CJS package default import):
    • import pkg from 'web-search-zaimcp'; const { webSearchPrime } = pkg;
    • Or createRequire: const { webSearchPrime } = createRequire(import.meta.url)('web-search-zaimcp')
  • Accepts either a string ('query') or full MCP params object.
  • Supported params mirror BigModel’s tool: search_query, count (1-50), content_size, location, search_domain_filter, search_recency_filter.
  • options (all optional):
    • apiKey (defaults to process.env.BIGMODEL_API_KEY).
    • endpoint (defaults to official WebSearch Prime MCP endpoint).
    • reuseConnection (deprecated; ignored — connections are per call).

TypeScript

  • This package ships src/index.d.ts and sets "types" and exports.types.
  • With NodeNext resolution, exports.default enables ESM default import to the CJS entry.

Return Value

  • { items, rawBlocks } where each item includes { title, url, summary, icon, siteName, media, publishedAt, refer, raw }.
  • rawBlocks exposes the original MCP text blocks for debugging or custom parsing.

Integrating With Agents

  • Wrap webSearchPrime inside any framework’s tool abstraction (LangChain StructuredTool, deepagents, LangGraph, custom orchestrators).
  • Typical handler: const { items } = await webSearchPrime(args); return JSON.stringify(items).

Further Customization

  • Add your own timeout wrapper via Promise.race if needed.
  • For TS users, consider adding a thin .d.ts file or porting the helper to .ts with types.
  • Modify _normalizeItems in src/index.js if you need different fields.