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

@kiwa-lab/mcp

v2.0.0

Published

Model Context Protocol (MCP) server mock harness for kiwa — JSON-RPC 2.0 handshake + tool registration + schema validation + client-server roundtrip against a stable in-process transport. Ships with 5 fixture tools (echo / calc / weather / search / db-que

Readme

@kiwa-lab/mcp

Model Context Protocol (MCP) server + client mock harness for kiwa.

Anthropic MCP は JSON-RPC 2.0 の上に載る tool 交換 protocol。 本 package は kiwa test で real MCP server 実装を叩かずに tool 呼出 chain を組み立てるための in-process server + client + transport を提供する。

  • McpServer — JSON-RPC 2.0 dispatch + handshake 強制 (initialize → tools/list → tools/call の 3 op)
  • McpClient + InMemoryTransport — server と直結する in-process client、 real MCP client と mock server の突合 test 用に任意 McpTransport を注入可能
  • ToolRegistry + validateSchema — JSONSchema subset (type + properties + required + items + enum) の 5 keyword を検証
  • 5 fixture tools (echo / calc / weather / search / db-query) — tutorial + dogfood + smoke test を 1 行 setup で組める

Usage

import {
  connectClientToServer,
  McpServer,
  registerAllFixtureTools,
} from '@kiwa-lab/mcp';

const server = new McpServer({ name: 'my-mock', version: '1.0.0' });
registerAllFixtureTools(server);

const { client } = await connectClientToServer(server);
const tools = await client.listTools();
// [{ name: 'echo', ... }, { name: 'calc', ... }, ...]

const result = await client.callTool('calc', { op: 'add', a: 2, b: 3 });
// result.content = [{ type: 'text', text: '5' }]

対応 op (v0.1)

  1. initialize — 双方向 handshake
  2. notifications/initialized — client → server の初期化完了通知 (notification、 response なし)
  3. tools/list — 登録 tool 一覧
  4. tools/call — 1 tool を invoke、 schema validate → handler → result

resources/* / prompts/* / sampling/* / logging/* は v0.2 以降。 v0.1 は tool 呼出 chain に絞る。

Error codes

JSON-RPC 2.0 spec 4 種 + MCP server-defined 4 種。

| code | 意味 | |---|---| | -32700 | ParseError | | -32600 | InvalidRequest | | -32601 | MethodNotFound | | -32602 | InvalidParams | | -32603 | InternalError | | -32000 | ToolExecutionError (handler が throw) | | -32001 | ToolSchemaError (input が schema に不整合) | | -32002 | NotInitialized (handshake 前に tools/* を呼んだ) | | -32003 | ToolNotFound (未登録 tool 名) |