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

@ag-ui/mcp-apps-middleware

v0.0.3

Published

MCP Apps middleware for AG-UI that enables UI-enabled tools from MCP (Model Context Protocol) servers.

Readme

@ag-ui/mcp-apps-middleware

MCP Apps middleware for AG-UI that enables UI-enabled tools from MCP (Model Context Protocol) servers.

Installation

npm install @ag-ui/mcp-apps-middleware
# or
pnpm add @ag-ui/mcp-apps-middleware

Usage

import { MCPAppsMiddleware } from "@ag-ui/mcp-apps-middleware";

const agent = new YourAgent().use(
  new MCPAppsMiddleware({
    mcpServers: [
      { type: "http", url: "http://localhost:3001/mcp", serverId: "weather-server" }
    ],
  })
);

Features

  • Discovers UI-enabled tools from MCP servers
  • Injects tools into the agent's tool list
  • Executes tool calls and emits activity snapshots with resource URIs
  • Supports proxied MCP requests for frontend resource fetching

Configuration

interface MCPAppsMiddlewareConfig {
  mcpServers?: MCPClientConfig[];
}

type MCPClientConfig =
  | { type: "http"; url: string; serverId?: string }
  | { type: "sse"; url: string; headers?: Record<string, string>; serverId?: string };

Server ID

The optional serverId field provides a stable identifier for the server. This is useful when:

  • Server URLs may change (e.g., different environments)
  • You want human-readable server identification
  • Frontend code needs to reference servers by name

If serverId is not provided, the server is identified by an MD5 hash of its configuration.

Activity Snapshot

The middleware emits activity snapshots with the following structure:

{
  type: "ACTIVITY_SNAPSHOT",
  activityType: "mcp-apps",
  content: {
    result: MCPToolCallResult,     // Result from the tool execution
    resourceUri: string,           // URI of the UI resource to fetch
    serverHash: string,            // MD5 hash of server config
    serverId?: string,           // Server ID (if configured)
    toolInput: Record<string, unknown>  // Arguments passed to the tool
  },
  replace: true
}

The frontend should fetch the resource content via proxied MCP request using resourceUri and either serverHash or serverId.

Proxied MCP Requests

The middleware supports proxied MCP requests from the frontend. Pass a ProxiedMCPRequest in forwardedProps.__proxiedMCPRequest:

interface ProxiedMCPRequest {
  serverHash: string;      // MD5 hash of server config
  serverId?: string;     // Optional server ID for lookup
  method: string;          // MCP method (e.g., "resources/read", "tools/call")
  params?: Record<string, unknown>;
}

Server lookup prefers serverId if provided, falling back to serverHash.

Exported Utilities

import {
  MCPAppsActivityType,  // "mcp-apps" constant
  getServerHash         // Generate server hash from config
} from "@ag-ui/mcp-apps-middleware";

License

MIT