MCP Developer Playground

Interactive MCP-powered developer assistant with LLM-driven workspace analysis tools and intelligent reasoning

typescriptnodejsexpressreactmcpllmai-toolsdeveloper-assistantworkspace-automationvite

Share this project:

Project Overview

MCP Developer Workspace

image

An AI-powered developer assistant that safely exposes project context through standardized MCP (Model Context Protocol) tools.

This system demonstrates how LLMs can interact with real-world codebases through a clean client-server architecture, providing transparency, safety, and extensibility.


๐ŸŽฏ Features

  • 6 MCP Tools: Read files, list files, search content, file metadata, directory tree, workspace statistics
  • Safety-First Design: Sandboxed workspace, path traversal protection, rate limiting
  • Transparent Tool Invocation: Visual timeline showing every tool call with inputs and outputs
  • Modern Web UI: React + TypeScript interface with dark mode and professional design
  • Simple Reasoning: Intent classification that maps natural language to tool invocations
  • Developer-Focused: Designed for understanding project context, not executing arbitrary commands

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Web UI    โ”‚  โ† React + TypeScript + Vite
โ”‚  (Port 5173)โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚ HTTP
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ MCP Client  โ”‚  โ† Intent Classification + Tool Selection
โ”‚  (Browser)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚ HTTP POST /invoke
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ MCP Server  โ”‚  โ† Express + Tool Registry
โ”‚  (Port 3000)โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚ Sandboxed Access
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Workspace  โ”‚  โ† ./workspace/* (read-only)
โ”‚   Directory โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“‹ Available MCP Tools

Tool Description Input Safety
read_file Read file content { path: string } 1MB size limit, path validation
list_files List files with optional pattern { directory?, pattern?, recursive? } Sandboxed to workspace
search_files Search for text in files { query, file_pattern?, case_sensitive? } 100 result limit
file_metadata Get file stats { path: string } Read-only operation
directory_tree Visual directory structure { depth?: number } Max depth 5 levels
workspace_stats Project statistics {} Cached computation

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 20+
  • npm 9+

Installation

  1. Install server dependencies:

    npm install
    
  2. Install UI dependencies:

    cd src/ui && npm install && cd ../..
    

Running the System

  1. Start the MCP Server (Terminal 1):
    npm run server
    
    Server runs on http://localhost:3000

2 Start the Web UI (Terminal 2):

npm run ui

UI runs on http://localhost:5173

  1. Open your browser: Navigate to http://localhost:5173

๐Ÿ’ก Example Queries

Try these natural language queries in the UI:

  • "Show all TypeScript files" โ†’ Invokes list_files with pattern: "*.ts"
  • "Read utils.txt" โ†’ Invokes read_file with path: "utils.txt"
  • "Search for 'function'" โ†’ Invokes search_files with query: "function"
  • "Show directory tree" โ†’ Invokes directory_tree
  • "Show workspace stats" โ†’ Invokes workspace_stats
  • "Get metadata for utils.txt" โ†’ Invokes file_metadata

๐Ÿ› ๏ธ Project Structure

mcp-playground/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ server/           # MCP Server (Express + TypeScript)
โ”‚   โ”‚   โ”œโ”€โ”€ index.ts      # Server entrypoint, routes, middleware
โ”‚   โ”‚   โ”œโ”€โ”€ tools.ts      # Tool registry and handlers
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/   # Rate limiter
โ”‚   โ”‚   โ””โ”€โ”€ utils/        # Validation utilities
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ client/           # MCP Client (CLI + Reasoning)
โ”‚   โ”‚   โ”œโ”€โ”€ index.ts      # Client entrypoint
โ”‚   โ”‚   โ””โ”€โ”€ reasoning.ts  # Intent classification
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ui/               # Web UI (React + TypeScript + Vite)
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ components/  # React components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ services/    # API client
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ types/       # TypeScript types
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ styles/      # Global CSS
โ”‚   โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”‚   โ”œโ”€โ”€ vite.config.ts
โ”‚   โ”‚   โ””โ”€โ”€ package.json
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ types/            # Shared TypeScript types
โ”‚       โ””โ”€โ”€ mcp.ts
โ”‚
โ”œโ”€โ”€ workspace/            # Sandboxed workspace directory
โ”‚   โ””โ”€โ”€ utils.txt
โ”‚
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ””โ”€โ”€ README.md

๐Ÿงช CLI Mode (Optional)

You can also use the MCP client from the command line:

npm run client -- "Show all TypeScript files"

๐Ÿ”’ Safety Mechanisms

Mechanism Implementation Purpose
Path Validation validatePath() in utils/validation.ts Prevents directory traversal attacks
File Size Limits 1MB max for read operations Prevents memory exhaustion
Result Limits Max 100 results for searches Prevents DoS
Rate Limiting 100 requests/minute per IP Prevents abuse
Operation Timeout 5 seconds max execution Handles long-running operations
Sandboxed Workspace All file access restricted to ./workspace/ Prevents system file access

๐ŸŽจ UI Features

  • Dark Mode Design: Professional color palette optimized for developers
  • Tool Call Timeline: Visual history of all tool invocations with status icons
  • Context-Aware Result Viewer: Different rendering for each tool type:
    • Syntax-highlighted code for read_file
    • File lists with metadata for list_files
    • Search results with line numbers for search_files
    • Statistics dashboard for workspace_stats
  • Example Prompts: Quick-start suggestions
  • Responsive Layout: Works on desktop and tablet

๐Ÿšง Future Enhancements

Phase 2: File Modification Tools

  • Add write_file, delete_file, rename_file
  • Implement confirmation dialogs and undo functionality

Phase 3: Real LLM Integration

  • Replace keyword-based reasoning with OpenAI/Anthropic/Gemini API
  • Implement chain-of-thought reasoning for complex queries

Phase 4: IDE Integrations

  • VS Code extension
  • JetBrains plugin
  • LSP integration for deeper code understanding

Phase 5: Multi-Project Support

  • Switch between multiple workspaces
  • Project-level configuration
  • Workspace templates

Phase 6: Hosted Service

  • Cloud deployment
  • Authentication and authorization
  • Team collaboration features

๐Ÿง‘โ€๐Ÿ’ป Development

Running Tests (Future)

npm test                  # Unit tests
npm run test:integration  # Integration tests
npm run test:e2e          # End-to-end tests

Building for Production

cd src/ui && npm run build

๐Ÿ“ License

MIT


๐Ÿ™ Acknowledgments

Built with inspiration from:


๐Ÿค” Why MCP?

MCP provides a standardized interface for LLMs to interact with external systems safely:

  • โœ… Explicit tools instead of free-form commands
  • โœ… Structured inputs with validation
  • โœ… Clear client-server separation
  • โœ… Transparency in tool invocation
  • โœ… Safety-first design with sandboxing

This project is a portfolio-worthy demonstration of understanding AI infrastructure, safety mechanisms, and full-stack development.


Made with ๐Ÿ”ง by following the MCP specification and best practices in AI safety.