Skip to content
PluginStats

@lushly-dev/afd-server weekly downloads statistics

By lushly-dev (4 listings) · npm · MCP servers

Server-side utilities for building AFD-compliant MCP servers with Zod validation

View on npm Stale · Oct 17, 2026

@lushly-dev/afd-server has 16,257 recorded weekly downloads on npm, an increase of 170% over the past 30 days, ranking #807 of 2,300 tracked listings.

Weekly downloads
16,257
Official API · Oct 18, 2026
7-day growth
+8.2%
+1.2K weekly downloads
30-day growth
+170%
+10.2K weekly downloads
90-day growth
+3698%
+15.8K weekly downloads
Rank
#807
Among tracked npm listings

About @lushly-dev/afd-server

@lushly-dev/afd-server

Server-side utilities for building AFD-compliant MCP servers with Zod validation.

Installation

npm install @lushly-dev/afd-server
# or
pnpm add @lushly-dev/afd-server

Features

  • Zod-based Command Definition - Define commands with Zod schemas for type-safe validation
  • Auto JSON Schema Generation - Automatic conversion to JSON Schema for MCP tool definitions
  • Multiple Transport Support - stdio for IDE/agent integration, HTTP/SSE for browser clients
  • Auto Transport Detection - Automatically selects the right transport based on environment
  • Built-in Validation - Automatic input validation before handler execution
  • Middleware System - Logging, tracing, rate limiting, and custom middleware
  • Command Prerequisites - Declare requires dependencies so agents can plan execution order
  • Agent Discovery - Grouped, individual or lazy tool strategies, afd-detail, and optional afd-help/afd-docs/afd-schema bootstrap tools
  • Full TypeScript Support - Complete type inference from Zod schemas

Quick Start

import { z } from 'zod';
import { defineCommand, createMcpServer, defaultMiddleware, success, failure } from '@lushly-dev/afd-server';

// Define a command with Zod schema
const greet = defineCommand({
  expose: { mcp: true }, // Explicitly allow remote invocation
  name: 'greet',
  description: 'Greet a user by name',
  category: 'demo',
  input: z.object({
    name: z.string().min(1, 'Name is required'),
    formal: z.boolean().default(false),
  }),

  async handler(input) {
    const greeting = input.formal
      ? `Good day, ${input.name}.`
      : `Hello, ${input.name}!`;

    return success({ greeting }, {
      reasoning: `Generated ${input.formal ? 'formal' : 'casual'} greeting`,
      confidence: 1.0,
    });
  },
});

// Create and start the server (auto-detects transport)
const server = createMcpServer({
  name: 'my-server',
  version: '1.0.0',
  commands: [greet],
  middleware: defaultMiddleware(),  // Trace IDs, logging, slow-command warnings
  port: 3100,
});

await server.start();
console.error(`Server running at ${server.getUrl()}`);

Remote Command Exposure

Remote invocation now enforces the core exposure contract: commands require expose: { mcp: true }. Omitting expose, omitting expose.mcp, or setting it to false keeps a command private. This applies to tool listing, discovery, direct MCP calls, afd-call, batch, pipelines, /rpc, and streaming. Existing applications should explicitly opt in their public commands. The server's in-process execute() and executePipeline() remain available for private commands.

Configured contexts automatically register afd-context-list, afd-context-enter, and afd-context-exit. Active contexts scope all remote execution paths. Context state belongs to the client, not the server: stdio has one stack, and each HTTP session has its own (see Context Management).

Embedding In A Host-Controlled HTTP Server

Use createMcpHandler() when your platform owns the HTTP server lifecycle and expects a request handler instead of a self-starting server object:

import { createServer } from 'node:http';
import { createMcpHandler } from '@lushly-dev/afd-server';

const handler = createMcpHandler({
  name: 'my-server',
  version: '1.0.0',
  commands: [greet],
  host: '127.0.0.1',
  port: 3100,
});

createServer((req, res) => {
  void handler(req, res);
}).listen(3100, '127.0.0.1');

Call handler.dispose() when the embedding host shuts down to close active SSE/stream responses and drop HTTP sessions. The host still owns its listener and other connections.

Use createMcpServer() for the batteries-included standalone server. Use createMcpHandler() when you need AFD to plug into an existing Node HTTP host.

Transport Protocols

The server supports multiple transport protocols for different use cases:

Auto-Detection (Default)

By default, the server auto-detects the best transport based on the environment:

const server = createMcpServer({
  name: 'my-server',
  version: '1.0.0',
  commands: [greet],
  // transport: 'auto' is the default
});

// When stdin is piped (IDE/agent context): uses stdio
// When stdin is a TTY (interactive context): uses HTTP

Pitfall: auto picks stdio whenever stdin is not a TTY. Under Docker without -t, systemd, pm2 or CI, the server therefore speaks stdio and the HTTP port never opens. Set transport: 'http' for any server that must listen on the network. start() logs the resolved transport to stderr, for example [my-server] MCP transport: stdio (auto-detected because stdin is not a TTY; set transport: 'http' to serve HTTP).

stdio Transport (IDE/Agent Integration)

Use stdio for integration with IDE MCP clients like Cursor, Claude Code, or Antigravity:

const server = createMcpServer({
  name: 'my-server',
  version: '1.0.0',
  commands: [greet],
  transport: 'stdio',  // Explicit stdio mode
});

await server.start();
// Server reads JSON-RPC from stdin, writes to stdout

In your IDE's MCP configuration (adjust the path to match your project):

{
  "mcpServers": {
    "my-server": {
      "command": "node",
      "args": ["path/to/your/server.js"]
    }
  }
}
HTTP Transport (Browser/Web UI)

Use HTTP for browser-based clients and web UIs:

const server = createMcpServer({
  name: 'my-server',
  version: '1.0.0',
  commands: [greet],
  transport: 'http',  // Explicit HTTP mode
  port: 3100,
});

await server.start();
console.error(`Server running at ${server.getUrl()}`);
// Exposes /sse, /message, /health endpoints

Defining Commands

Browser-safe entry point: @lushly-dev/afd-server/define…

Description from the npm listing.

  • afd
  • agent-first
  • mcp
  • server
  • zod
  • validation

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

@lushly-dev/afd-server weekly downloads on npm, last 90 days: 21,709 weekly downloads as of Oct 18, 2026, +3791% over 90 days.@lushly-dev/afd-serverWeekly downloads on npm · Last 90 days21,709downloads / week+3791% over 90 days010K20K30K40K50KJul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 18, 2026 · 89 observations · Updated Oc…pluginstats.com
@lushly-dev/afd-server weekly downloads on npm, last 90 days: 21,709 weekly downloads as of Oct 18, 2026, +3791% over 90 days.

7/30/90-day growth

@lushly-dev/afd-server weekly downloads growth on npm: +47.0% over 7 days, +228% over 30 days, +3791% over 90 days.@lushly-dev/afd-serverWeekly downloads growth on npm21,709downloads / week now7-day growth+6,942 weekly downloads+47.0%30-day growth+15,083 weekly downloads+228%90-day growth+21,151 weekly downloads+3791%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
@lushly-dev/afd-server weekly downloads growth on npm: +47.0% over 7 days, +228% over 30 days, +3791% over 90 days.

Ranking history

@lushly-dev/afd-server npm ranking history: currently #807 (by weekly downloads).@lushly-dev/afd-servernpm ranking · by weekly downloads · Last 90 days#807current rank#200#300#400#500#600#700#800#900Jul 21Aug 5Aug 20Sep 4Sep 19Oct 4Oct 19rankOct 17, 2026 – Oct 19, 2026 · 3 observations · Updated Oct 17, 2026pluginstats.com
@lushly-dev/afd-server npm ranking history: currently #807 (by weekly downloads).

Listing placement

All npm2,256 listings · 113 pages · 1,129 shown · page 41, #7 (overall #807)
All npm: every listing in weekly downloads order

Listing placement

MCP servers258 listings · 13 pages · page 6, #16 (overall #116)
MCP servers: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (544)
Recent weekly downloads observations for @lushly-dev/afd-server
Date (UTC)Weekly downloadsChange vs. previous
21,709+5.5K
16,257-4.7K
20,965+7.6K
13,368-2.5K
15,906-1.8K
17,6920
17,692+2.9K
14,767-252
15,019+1.6K
13,464-1.6K
15,044+388
14,656-1.4K
16,016-3.9K
19,927—

Similar npm MCP servers plugins

All 20 @lushly-dev/afd-server alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/@lushly-dev/afd-server. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.