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 Outdated · Nov 25, 2026

@lushly-dev/afd-server has 6,920 recorded weekly downloads on npm, a decrease of 72.8% over the past 30 days, ranking #1409 of 3,247 tracked listings.

Weekly downloads
6,920
Official API · Dec 5, 2026
7-day growth
-25.6%
-2.4K weekly downloads
30-day growth
-72.8%
-18.6K weekly downloads
90-day growth
-53.7%
-8K weekly downloads
Rank
#1409
▼ 141 in 7 days

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 and Streamable HTTP (/mcp), each serving MCP 2026-07-28 and 2025 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, approvals, and custom middleware
  • Pre-execution Approvals - Hold commands for human sign-off with signed, short-lived approval tokens
  • 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

stdio serves both MCP protocol eras on one connection: a client that opens with server/discover and per-request _meta gets MCP 2026-07-28, and a client that opens with initialize gets the 2025 protocol for the rest of the connection.

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,
});…

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: 6,920 weekly downloads as of Dec 5, 2026, -53.7% over 90 days.@lushly-dev/afd-serverWeekly downloads on npm · Last 90 days6,920downloads / week-53.7% over 90 days05K10K15K20K25K30KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
@lushly-dev/afd-server weekly downloads on npm, last 90 days: 6,920 weekly downloads as of Dec 5, 2026, -53.7% over 90 days.

7/30/90-day growth

@lushly-dev/afd-server weekly downloads growth on npm: -25.6% over 7 days, -72.8% over 30 days, -53.7% over 90 days.@lushly-dev/afd-serverWeekly downloads growth on npm6,920downloads / week now7-day growth-2,378 weekly downloads-25.6%30-day growth-18,566 weekly downloads-72.8%90-day growth-8,026 weekly downloads-53.7%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
@lushly-dev/afd-server weekly downloads growth on npm: -25.6% over 7 days, -72.8% over 30 days, -53.7% over 90 days.

Ranking history

@lushly-dev/afd-server npm ranking history: currently #1409 (by weekly downloads).@lushly-dev/afd-servernpm ranking · by weekly downloads · Last 90 days#1409current rank#200#400#600#800#1000#1200#1400#1600Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 39 observations · Updated Dec 5, 2026pluginstats.com
@lushly-dev/afd-server npm ranking history: currently #1409 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 71, #9 (overall #1,409)
All npm: every listing in weekly downloads order

Listing placement

MCP servers468 listings · 24 pages · page 17, #7 (overall #327)
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 (592)
Recent weekly downloads observations for @lushly-dev/afd-server
Date (UTC)Weekly downloadsChange vs. previous
6,920-309
7,229+868
6,361-52
6,413+607
5,806+1.8K
3,965-230
4,195-5.1K
9,298-1.5K
10,838-936
11,774-740
12,514-310
12,824-565
13,389+807
12,582—

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 Nov 25, 2026. See the methodology.