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

@wener/ai

v0.1.18

Published

AI utilities and MCP server definitions

Downloads

101

Readme

@wener/ai

AI utilities, provider-agnostic schemas, and MCP (Model Context Protocol) server definitions.

Install

pnpm add @wener/ai

Modules

AI Provider Schemas

Zod-based schema definitions for major AI providers, covering Chat Completions, Responses API, streaming, and tool calling.

Each provider offers two schema flavors:

  • Strict schemas (@wener/ai/<provider>/schema) — precise z.object() definitions for strong validation
  • Generic/loose schemas (@wener/ai/<provider>) — z.looseObject() definitions that allow extra properties to pass through, suitable for protocol conversion, proxying, and auditing
// Generic (loose) — good for proxies and protocol conversion
import {
  CreateChatCompletionRequestSchema,
  CreateChatCompletionResponseSchema,
  CreateChatCompletionStreamChunkSchema,
  CreateResponseRequestSchema,
  UsageSchema,
} from '@wener/ai/openai';

// Strict — good for direct API interaction
import {
  ChatCompletionRequestSchema,
  ChatCompletionResponseSchema,
  ChatCompletionChunkSchema,
} from '@wener/ai/openai/schema';

Supported providers:

| Import path | Provider | Notes | | --- | --- | --- | | @wener/ai/openai | OpenAI | Chat Completions + Responses API | | @wener/ai/openai/schema | OpenAI | Strict schemas | | @wener/ai/anthropic | Anthropic | Claude-compatible schemas | | @wener/ai/anthropic/schema | Anthropic | Strict schemas | | @wener/ai/google | Google | Gemini-compatible schemas | | @wener/ai/google/schema | Google | Strict schemas |

MCP Server Definitions

Reusable, factory-based MCP server definitions that follow a standard McpServerDef pattern. Each server provides tools and resources accessible via the Model Context Protocol.

import { defineMcpServer, type McpServerDef, type McpServerInstance } from '@wener/ai/mcp';

Prometheus

PromQL-based metrics querying with instant and range query support.

import { createPrometheusMcpServer } from '@wener/ai/mcp/prometheus';

const { server, close } = createPrometheusMcpServer({
  url: 'http://prometheus:9090',
  username: 'admin', // optional
  password: 'secret', // optional
});

Tools: query (instant & range PromQL queries), list_metrics, metric_metadata, label_values

Resources: promql-guide — PromQL syntax reference

Tencent CLS

Tencent Cloud Log Service for log search, analysis, and pattern clustering.

import { createTencentClsMcpServer } from '@wener/ai/mcp/tencent-cls';

const { server, close } = createTencentClsMcpServer({
  clientId: 'AKID...',
  clientSecret: '...',
  region: 'ap-shanghai', // optional, defaults to ap-shanghai
});

Tools: search (CQL log search), cluster_logs (Drain3-based pattern clustering), log_context (surrounding context), list_topics, describe_topic, get_histograms

Resources: search-guide — CQL search syntax reference

SQL Database

Multi-dialect SQL database access via Kysely.

import { createSqlMcpServer } from '@wener/ai/mcp/sql';

const { server, close } = createSqlMcpServer({
  url: 'mysql://user:pass@localhost:3306/mydb',
});

Tools: query (execute SQL), list_tables, describe_table

Supported dialects: MySQL, PostgreSQL, SQLite, MSSQL

Peer dependencies: kysely, and the dialect driver (mysql2, tedious, etc.)

Feishu / Lark

Messaging and document operations for Feishu (飞书) / Lark.

import { createFeishuMcpServer } from '@wener/ai/mcp/feishu';

const { server, close } = createFeishuMcpServer({
  appId: 'cli_...',
  appSecret: '...',
  domain: 'feishu', // 'feishu' | 'lark' | custom domain
});

Tools: IM (messaging), document operations

Peer dependency: @larksuiteoapi/node-sdk

Apollo Config

Read application configurations from Apollo Config configuration center.

import { createApolloConfigMcpServer } from '@wener/ai/mcp/apolloconfig';

const { server, close } = createApolloConfigMcpServer({
  url: 'http://apollo-config:8080',
  appId: 'my-app',
  cluster: 'default', // optional
});

Tools: Configuration reading and namespace listing

MCP Relay

Proxy requests to another MCP server, supporting both Streamable HTTP and SSE transports.

import { createRelayMcpServer } from '@wener/ai/mcp/relay';

const { server, close } = createRelayMcpServer({
  url: 'http://other-mcp-server:3000/mcp',
  transport: 'http', // 'http' | 'sse'
  headers: { Authorization: 'Bearer ...' }, // optional
});

Tools: relay_list_tools, relay_call_tool, relay_list_resources, relay_read_resource

Custom MCP Server Definition

Use defineMcpServer to create your own server definition that integrates with @wener/mcps infrastructure:

import { defineMcpServer, type McpServerInstance } from '@wener/ai/mcp';

interface MyOptions {
  apiKey: string;
}

export const MyMcpServerDef = defineMcpServer<MyOptions>({
  name: 'my-service',
  title: 'My Service',
  description: 'My custom MCP server',
  version: '1.0.0',
  tags: ['custom'],
  validateOptions(options) {
    if (!options.apiKey) return { valid: false, error: 'Missing apiKey' };
    return { valid: true };
  },
  getCacheKey(options) {
    return `my::${options.apiKey}`;
  },
  create(options): McpServerInstance {
    const server = new McpServer({ name: 'my-service', version: '1.0.0' });
    // register tools, resources...
    return { server, async close() { await server.close(); } };
  },
});

Peer Dependencies

Heavy or optional dependencies are declared as optional peer dependencies to avoid eager loading:

| Dependency | Required by | | --- | --- | | kysely | @wener/ai/mcp/sql | | mysql2 | SQL MCP with MySQL dialect | | tedious | SQL MCP with MSSQL dialect | | tarn | Connection pooling for SQL | | @larksuiteoapi/node-sdk | @wener/ai/mcp/feishu |

License

ISC