Get the FREE Ultimate OpenClaw Setup Guide →

js

JavaScript MCP Server Component with WASM SDK for easy integration and deployment.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio positive-spaces-js-mcp-server node server.js \
  --env PORT="Port to run the MCP server on (default 8080)" \
  --env WASM_DIST="Path or URL to the built dist/js-mcp-server.wasm if required"

How to use

This JavaScript MCP Server provides a modular, WASM-assisted MCP server where handlers (tools) are registered in server.js and extended via the handlers directory. The server is designed to be wired with a set of tools like EchoTool, KgTool, and custom tools you add, enabling you to process MCP requests with synchronous or asynchronous handlers. You can define each tool with a name, description, and schema, and then register it in the tools map so the MCP runtime can discover and invoke it. The included sections show how to add new handlers, register them, and how to leverage the HTTP client and Postgres interface to build data-backed or external-service-enabled tools.

How to install

Prerequisites:

  • Git
  • Node.js (LTS version recommended) and npm
  • Optional: Python/uv if using alternative runtimes, but this server is Node-based

Step-by-step installation:

  1. Clone the repository:
git clone https://github.com/justin-echternach/js-mcp-server.git
cd js-mcp-server
  1. Install global tooling required for building components:
npm install -g @bytecodealliance/componentize-js @bytecodealliance/jco
  1. Install local dependencies:
npm install
  1. Build the project to generate the WebAssembly module (if applicable):
npm run build
  1. Run the server using Node:
node server.js

Note: The exact entry point for running the server may vary depending on your build output. If you bundle the server into dist/js-mcp-server.wasm, you may need to adjust the command to load the WASM module accordingly, but the default setup uses node server.js to bootstrap the MCP server.

Additional notes

Tips and common notes:

  • Handlers (tools) are registered in server.js and live in the handlers directory. To add a custom tool, create a new handler file, export the required functions, and register it in the server's tools map.
  • Each tool should export: an async handler function, a name, a description, and a schema describing the expected input.
  • When integrating with external services, you can use the Postgres interface (import { query } from "comapi:postgres/query@0.1.0";) and the HTTP client utilities (e.g., get, post, etc.).
  • Use the provided HTTP client helpers to simplify outgoing requests and ensure JSON parsing by using json: true where appropriate.
  • If you encounter environment-related issues, ensure environment variables like PORT and WASM_DIST are properly set. The WASM module path may be required depending on your build configuration.
  • For local development, you can use the example handlers (EchoTool, KgTool, FetchDogTool) as templates for new implementations and adjust as needed.

Related MCP Servers

Sponsor this space

Reach thousands of developers