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

@aivue/mcp-client

v1.0.0

Published

Model Context Protocol (MCP) client for Vue.js - Connect to MCP servers and interact with tools, resources, and prompts following official MCP architecture

Readme

@aivue/mcp-client

Official Model Context Protocol (MCP) client for Vue.js - Following the standard MCP architecture: Host App → MCP Client → MCP Server

npm version License: MIT

🏗️ Architecture

This package implements the official Model Context Protocol (MCP) client architecture:

┌─────────────┐      ┌─────────────┐      ┌─────────────┐
│  Host App   │ ───> │ MCP Client  │ ───> │ MCP Server  │
│  (Vue.js)   │ <─── │ (@aivue/mcp)│ <─── │             │
└─────────────┘      └─────────────┘      └─────────────┘

The MCP Client acts as a bridge between your Vue.js application (Host App) and MCP servers, handling:

  • JSON-RPC 2.0 protocol communication
  • Transport layer (HTTP/SSE)
  • Request/response management
  • Event handling and subscriptions

🎯 Features

Core MCP Operations (Official Spec)

  • tools/list - List available tools from MCP server
  • tools/call - Execute tools with parameters
  • resources/list - List available resources
  • resources/read - Read resource contents
  • prompts/list - List available prompts
  • prompts/get - Retrieve prompt templates

Additional Features

  • 🔌 Framework-Agnostic Core - Clean TypeScript API that works anywhere
  • 🎨 Vue Integration - Composables and components for seamless Vue.js integration
  • 🔄 JSON-RPC 2.0 - Full JSON-RPC protocol implementation
  • 🌐 HTTP/SSE Transport - Browser-compatible transport layer
  • 📡 Real-time Updates - Event-driven architecture for live updates
  • 💪 TypeScript - Full type safety and IntelliSense support

📦 Installation

npm install @aivue/mcp-client

🚀 Quick Start

Using the Composable (Recommended)

<template>
  <div>
    <button @click="connect" :disabled="connected">Connect</button>
    <button @click="disconnect" :disabled="!connected">Disconnect</button>

    <div v-if="connected">
      <h3>Available Tools ({{ tools.length }})</h3>
      <ul>
        <li v-for="tool in tools" :key="tool.name">
          {{ tool.name }} - {{ tool.description }}
        </li>
      </ul>

      <button @click="executeCalculator">Calculate 2 + 2</button>
      <div v-if="result">Result: {{ result }}</div>
    </div>

    <div v-if="error" class="error">{{ error.message }}</div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useMCP } from '@aivue/mcp-client';

const result = ref(null);

const {
  connected,
  tools,
  error,
  connect,
  disconnect,
  callTool,
} = useMCP({
  transport: {
    type: 'http',
    url: 'http://localhost:3000/mcp',
  },
});

const executeCalculator = async () => {
  const toolResult = await callTool({
    name: 'calculator',
    arguments: {
      operation: 'add',
      a: 2,
      b: 2,
    },
  });
  
  result.value = toolResult.content[0].text;
};
</script>

Using the Component

<template>
  <MCPToolExecutor
    :tools="tools"
    :connected="connected"
    :loading="loading"
    :error="error"
    @connect="connect"
    @refresh="refreshTools"
    @execute="callTool"
  />
</template>

<script setup lang="ts">
import { MCPToolExecutor, useMCP } from '@aivue/mcp';

const {
  connected,
  tools,
  loading,
  error,
  connect,
  refreshTools,
  callTool,
} = useMCP({
  transport: {
    type: 'http',
    url: 'http://localhost:3000/mcp',
  },
});
</script>

Using the Core Client (Framework-Agnostic)

import { MCPClient } from '@aivue/mcp';

const client = new MCPClient({
  transport: {
    type: 'http',
    url: 'http://localhost:3000/mcp',
  },
});

// Connect to server
await client.connect();

// List available tools
const tools = await client.listTools();

// Call a tool
const result = await client.callTool({
  name: 'calculator',
  arguments: { operation: 'add', a: 2, b: 2 },
});

// List resources
const resources = await client.listResources();

// Read a resource
const content = await client.readResource('file:///path/to/file.txt');

// Get prompts
const prompts = await client.listPrompts();
const messages = await client.getPrompt('greeting', { name: 'Alice' });

// Disconnect
await client.disconnect();

📚 API Reference

useMCP(config: MCPClientConfig)

Vue composable for MCP integration.

Returns:

  • connected - Connection status
  • serverInfo - Server information
  • tools - Available tools
  • resources - Available resources
  • prompts - Available prompts
  • loading - Loading state
  • error - Error state
  • connect() - Connect to server
  • disconnect() - Disconnect from server
  • callTool(toolCall) - Execute a tool
  • readResource(uri) - Read a resource
  • getPrompt(name, args) - Get a prompt
  • subscribeResource(uri) - Subscribe to resource updates
  • unsubscribeResource(uri) - Unsubscribe from resource updates

MCPClient

Core MCP client class.

Methods:

  • connect() - Connect to MCP server
  • disconnect() - Disconnect from server
  • listTools() - List available tools
  • callTool(toolCall) - Execute a tool
  • listResources() - List available resources
  • readResource(uri) - Read a resource
  • subscribeResource(uri) - Subscribe to resource updates
  • unsubscribeResource(uri) - Unsubscribe from updates
  • listPrompts() - List available prompts
  • getPrompt(name, args) - Get a prompt
  • on(event, handler) - Add event listener
  • off(event, handler) - Remove event listener

🔧 Configuration

interface MCPClientConfig {
  serverInfo?: {
    name: string;
    version: string;
  };
  transport: {
    type: 'http' | 'sse';
    url: string;
    headers?: Record<string, string>;
  };
  timeout?: number;  // Request timeout in ms (default: 30000)
  retries?: number;  // Number of retries (default: 0)
}

🎨 Styling

Import the CSS file in your main file:

import '@aivue/mcp/dist/mcp.css';

Or customize the styles by overriding CSS variables:

.mcp-tool-executor {
  --mcp-primary-color: #007bff;
  --mcp-border-radius: 8px;
  --mcp-spacing: 1rem;
}

📖 Examples

Check out the examples directory for more usage examples.

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details.

📄 License

MIT © reachbrt

🔗 Links