JavaScript MCP Server

JavaScript MCP Server

Allows AI models to run JavaScript/TypeScript code through Model Context Protocol tool calls, supporting both one-time script execution and stateful REPL sessions with npm package integration.

Category
Visit Server

README

JavaScript MCP Server

A JavaScript execution server for the Model Context Protocol (MCP), allowing AI models to run JavaScript code through MCP tool calls.

Features

  • JavaScript Execution: Run JavaScript code in one-time script execution mode
  • REPL Sessions: Maintain stateful REPL sessions across multiple interactions
  • TypeScript Support: Run TypeScript code with automatic transpilation
  • NPM Integration: Import and use npm packages dynamically
  • Interactive Mode: Direct command line REPL interface for interacting with the server
  • Named Pipe Interface: Use named pipes for communication with external processes

Installation

# Clone the repository
git clone https://github.com/yannbam/fresh-js-mcp.git
cd fresh-js-mcp

# Install dependencies
npm install

# Build the project
npm run build

Usage

# Start the MCP server in standard mode
npm start

# Start in interactive REPL mode
node dist/index.js --interactive

# Start with named pipe interface
node dist/index.js --pipe

# See all options
node dist/index.js --help

Operating Modes

The server supports three operating modes:

  1. Standard MCP Mode (default): Communicates via stdio using the Model Context Protocol
  2. Interactive Mode: Provides a REPL interface for direct user interaction
  3. Pipe Mode: Uses named pipes for communication with external processes

See the examples directory for detailed instructions on using these modes.

Available Tools

  • execute: Run JavaScript code once and return the result
  • createSession: Create a new REPL session
  • executeInSession: Execute code in an existing session
  • listSessions: List all active REPL sessions
  • deleteSession: Delete a REPL session

Development

# Run in development mode with hot reloading
npm run dev

# Lint the code
npm run lint

# Run tests
npm test

Architecture

The JavaScript MCP server follows a layered architecture:

  1. MCP Protocol Layer: Handles client communication
  2. JavaScript Execution Layer: Executes code in isolated environments
  3. Resource Management Layer: Manages packages and TypeScript
  4. Session Management Layer: Maintains REPL sessions with state persistence

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured