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

@xava-labs/playground

v0.2.2

Published

A comprehensive React component library for building MCP (Model Context Protocol) server management interfaces and AI chat experiences.

Readme

@xava-labs/playground

A comprehensive React component library for building MCP (Model Context Protocol) server management interfaces and AI chat experiences.

Installation

npm install @xava-labs/playground
# or
yarn add @xava-labs/playground

Usage

Complete Playground Component

The easiest way to get started is with the complete playground component:

import { PlaygroundProvider, Playground } from '@xava-labs/playground';
import '@xava-labs/playground/styles';

function App() {
  return (
    <PlaygroundProvider 
      config={{
        mcpProxyUrl: 'http://localhost:6050',
        mcpProxyWsUrl: 'ws://localhost:6050/client/ws',
        theme: 'dark',
        defaultModelConfig: {
          provider: 'openai',
          apiKey: process.env.OPENAI_API_KEY || '',
          model: 'gpt-4'
        }
      }}
    >
      <Playground />
    </PlaygroundProvider>
  );
}

Individual Components

You can also use individual components for more customized integrations:

import { 
  PlaygroundProvider, 
  ChatContainer, 
  MCPServerDirectory, 
  ModelSelector,
  useConfigurableMcpServerManager 
} from '@xava-labs/playground';

function CustomInterface() {
  return (
    <PlaygroundProvider config={{ /* your config */ }}>
      <div className="flex h-screen">
        <div className="w-1/3">
          <MCPServerDirectory 
            onServerToggle={(server, enabled) => {
              console.log(`${server.name} ${enabled ? 'enabled' : 'disabled'}`);
            }}
          />
        </div>
        <div className="flex-1">
          <ChatContainer title="Custom Chat" />
        </div>
        <div className="w-1/4">
          <ModelSelector onModelChange={(config) => console.log(config)} />
        </div>
      </div>
    </PlaygroundProvider>
  );
}

Using Hooks

Access MCP server management functionality directly:

import { useConfigurableMcpServerManager, PlaygroundProvider } from '@xava-labs/playground';

function ServerManager() {
  const {
    servers,
    connected,
    loading,
    addServer,
    deleteServer,
    refreshServers
  } = useConfigurableMcpServerManager();

  const handleAddServer = async () => {
    await addServer({
      uniqueName: 'my-server',
      command: 'npx',
      args: ['my-mcp-server'],
      env: { API_KEY: 'your-key' }
    });
  };

  return (
    <div>
      <button onClick={handleAddServer}>Add Server</button>
      <ul>
        {servers.map(server => (
          <li key={server.uniqueName}>{server.uniqueName}</li>
        ))}
      </ul>
    </div>
  );
}

function App() {
  return (
    <PlaygroundProvider config={{ /* config */ }}>
      <ServerManager />
    </PlaygroundProvider>
  );
}

Configuration

PlaygroundConfig

interface PlaygroundConfig {
  // Required: MCP Proxy URLs
  mcpProxyUrl: string;           // HTTP URL for MCP proxy
  mcpProxyWsUrl: string;         // WebSocket URL for real-time updates
  
  // Optional: API configuration
  apiBaseUrl?: string;           // Base URL for API calls (default: '/api')
  
  // Optional: Default model configuration
  defaultModelConfig?: {
    provider: 'openai' | 'anthropic';
    apiKey: string;
    model: string;
  };
  
  // Optional: UI configuration
  theme?: 'dark' | 'light';      // Default: 'dark'
  enabledFeatures?: {
    chat?: boolean;              // Default: true
    mcpServerDirectory?: boolean; // Default: true
    modelSelector?: boolean;     // Default: true
  };
}

Environment Variables

The playground supports the following environment variables:

# MCP Registry Configuration
NEXT_PUBLIC_MCP_REGISTRY_URL=https://mcp-registry.nullshot.ai/latest.json  # Default registry URL
NEXT_PUBLIC_MCP_PROXY_URL=http://localhost:6050                             # MCP proxy HTTP URL
NEXT_PUBLIC_MCP_PROXY_WS_URL=ws://localhost:6050/client/ws                  # MCP proxy WebSocket URL

# API Keys (for model providers)
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key

The NEXT_PUBLIC_MCP_REGISTRY_URL environment variable allows you to override the default MCP registry URL. This is useful for:

  • Using a custom/private MCP registry
  • Testing with a local registry during development
  • Using alternative registry endpoints

Playground Component Props

interface PlaygroundProps {
  className?: string;
  style?: React.CSSProperties;
  layout?: 'horizontal' | 'vertical';  // Default: 'horizontal'
  showModelSelector?: boolean;         // Default: true
  showMCPDirectory?: boolean;          // Default: true
  showChat?: boolean;                  // Default: true
}

Setting Up MCP Proxy

The playground requires an MCP proxy server to manage MCP servers. You can use the @xava-labs/mcp-proxy package:

# Install the proxy
npm install @xava-labs/mcp-proxy

# Run the proxy
npx wrangler dev --port 6050

Or set up your own proxy that implements the WebSocket protocol expected by the playground components.

Styling

The package includes default styles that can be imported:

import '@xava-labs/playground/styles';

The components use Tailwind CSS classes. Make sure your project has Tailwind CSS configured, or the components may not display correctly.

Examples

Complete MCP Development Environment

import { PlaygroundProvider, Playground } from '@xava-labs/playground';
import '@xava-labs/playground/styles';

export default function MCPDevelopmentEnvironment() {
  return (
    <PlaygroundProvider
      config={{
        mcpProxyUrl: process.env.NEXT_PUBLIC_MCP_PROXY_URL || 'http://localhost:6050',
        mcpProxyWsUrl: process.env.NEXT_PUBLIC_MCP_PROXY_WS_URL || 'ws://localhost:6050/client/ws',
        theme: 'dark',
        defaultModelConfig: {
          provider: 'anthropic',
          apiKey: process.env.ANTHROPIC_API_KEY || '',
          model: 'claude-3-5-sonnet-20241022'
        }
      }}
    >
      <Playground
        layout="horizontal"
        showModelSelector={true}
        showMCPDirectory={true}
        showChat={true}
      />
    </PlaygroundProvider>
  );
}

Custom Chat Interface

import { 
  PlaygroundProvider, 
  ChatContainer, 
  useConfigurableMcpServerManager 
} from '@xava-labs/playground';

function CustomChat() {
  const { servers, connected } = useConfigurableMcpServerManager();
  
  return (
    <div className="h-screen flex flex-col">
      <div className="bg-gray-100 p-4">
        Connected Servers: {servers.length} | Status: {connected ? 'Connected' : 'Disconnected'}
      </div>
      <div className="flex-1">
        <ChatContainer 
          title="Custom MCP Chat"
          showHeader={true}
          className="h-full"
        />
      </div>
    </div>
  );
}

export default function App() {
  return (
    <PlaygroundProvider config={{ /* your config */ }}>
      <CustomChat />
    </PlaygroundProvider>
  );
}

API Reference

Components

  • PlaygroundProvider - Configuration provider component
  • Playground - Complete playground interface
  • ChatContainer - AI chat interface
  • MCPServerDirectory - MCP server management UI
  • ModelSelector - AI model selection interface
  • MCPServerItem - Individual server item component
  • UI components: Button, Drawer, Sheet, Label, Textarea

Hooks

  • usePlaygroundConfig() - Access playground configuration
  • useConfigurableMcpServerManager() - MCP server management

Types

  • PlaygroundConfig - Configuration interface
  • McpServer - MCP server data structure
  • PlaygroundProps - Playground component props

Requirements

  • React 18+ or 19+
  • A running MCP proxy server
  • Tailwind CSS for styling

Development

See the main repository for development setup instructions.

License

MIT License - see LICENSE file for details.