Skip to main content
Glama

MCP Tools Documentation

A VSCode/Cursor extension that provides an integrated MCP server and UI panel for retrieving and displaying command-line tool documentation. The extension automatically detects tools in your workspace and provides their documentation through a WebView panel.

Core Features

  • ๐Ÿ”„ Built-in MCP Server

    • Express + SSE server (ports 54321-54421)

    • Secure origin validation

    • Automatic port selection

    • Connection management and cleanup

    • Real-time event streaming

  • ๐Ÿ” Tool Discovery

    • Package scripts (npm, yarn, pnpm)

    • Local binaries (node_modules/.bin)

    • Global tools (git, npm, yarn, pnpm)

    • Monorepo workspace support

  • ๐Ÿ“š Documentation Retrieval

    • Help command execution (-h, --help)

    • Version information fetching

    • Secure command validation

    • Error handling

  • ๐Ÿ’ป VS Code Integration

    • React-based WebView panel

    • Status bar integration

    • Command palette support

    • Workspace path detection

Related MCP server: Nexus MCP Bridge for VSCode

Architecture

1. VS Code Extension (Backend)

Extension Host (src/extension.ts) โ”œโ”€โ”€ Activates when VS Code starts โ”œโ”€โ”€ Creates MCP Server โ”‚ โ””โ”€โ”€ Express + SSE Server (54321-54421 port range) โ””โ”€โ”€ Creates WebView Panel

2. MCP Server (Middle Layer)

MCP Server (src/server/*) โ”œโ”€โ”€ SSE Event Stream โ”‚ โ”œโ”€โ”€ Real-time tool discovery updates โ”‚ โ”œโ”€โ”€ Documentation streaming โ”‚ โ””โ”€โ”€ Connection state management โ”‚ โ””โ”€โ”€ Tool Discovery System โ”œโ”€โ”€ path-scanner.ts โ”‚ โ””โ”€โ”€ Finds tools in workspace (bin/, node_modules/.bin) โ””โ”€โ”€ package-scanner.ts โ””โ”€โ”€ Scans package.json for available tools

3. WebView Panel (Frontend)

React WebView (src/panel/*) โ”œโ”€โ”€ UI Components โ”‚ โ””โ”€โ”€ Shows available tools and their docs โ”‚ โ””โ”€โ”€ SSE Client โ”œโ”€โ”€ Requests available tools โ””โ”€โ”€ Streams tool documentation

Project Structure

my-tools-mcp/ โ”œโ”€โ”€ src/ # Source code โ”‚ โ”œโ”€โ”€ extension.ts # Extension entry point โ”‚ โ”œโ”€โ”€ env.ts # Environment configuration โ”‚ โ”œโ”€โ”€ server/ # Built-in MCP server โ”‚ โ”‚ โ”œโ”€โ”€ index.ts # Server setup and SSE handling โ”‚ โ”‚ โ””โ”€โ”€ controllers/ # Tool discovery and execution โ”‚ โ”‚ โ”œโ”€โ”€ docs/ # Documentation controllers โ”‚ โ”‚ โ”œโ”€โ”€ path-scanner.ts # Tool discovery โ”‚ โ”‚ โ””โ”€โ”€ package-scanner.ts # Package.json scanning โ”‚ โ”œโ”€โ”€ panel/ # WebView UI (React) โ”‚ โ”‚ โ”œโ”€โ”€ index.tsx # WebView entry point โ”‚ โ”‚ โ”œโ”€โ”€ App.tsx # Main React component โ”‚ โ”‚ โ””โ”€โ”€ components/ # UI components โ”‚ โ”œโ”€โ”€ types/ # Shared TypeScript types โ”‚ โ””โ”€โ”€ lib/ # Shared utilities โ”œโ”€โ”€ dist/ # Compiled output โ””โ”€โ”€ src/__tests__/ # Test files

Development Setup

  1. Install dependencies:

pnpm install
  1. Start development:

# Start webpack in watch mode pnpm run dev # Or build for production pnpm run build
  1. Launch the extension:

  • Press F5 in VSCode to start debugging

  • The extension will start both the MCP server and WebView panel

Usage

  1. Open the command palette (Cmd/Ctrl + Shift + P)

  2. Type "MCP Tools" and select the command

  3. The WebView panel will open and display available tools

  4. Select a tool to view its documentation

Technical Details

Tool Discovery

  • Package Scripts

    • Automatically detects npm/yarn/pnpm scripts

    • Shows script source and working directory

    • Supports monorepo workspaces

    • Validates script existence

  • Binary Tools

    • Finds tools in node_modules/.bin

    • Detects global tools (git, npm, yarn, pnpm)

    • Validates tool existence and permissions

    • Handles path resolution

Documentation Retrieval

  • Executes help commands (-h, --help)

  • Fetches version information

  • Handles command execution errors

  • Validates tool names and arguments

  • Implements proper timeouts

SSE Communication

  • Real-time tool discovery updates

  • Secure origin validation

  • Connection management and cleanup

  • Error handling and reporting

  • Automatic reconnection support

  • Event-based streaming

  • Bi-directional message passing

Security Features

  • Tool name validation

  • Command injection prevention

  • Origin validation for SSE connections

  • Proper error handling and reporting

  • Resource cleanup

  • Connection state management

Testing

The extension includes comprehensive tests:

  • Integration tests for server functionality

  • VS Code extension tests

  • Tool discovery tests

  • Security validation tests

  • SSE communication tests

License

ISC

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/patelnav/my-tools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server