js
JavaScript MCP Server Component with WASM SDK for easy integration and deployment.
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:
- Clone the repository:
git clone https://github.com/justin-echternach/js-mcp-server.git
cd js-mcp-server
- Install global tooling required for building components:
npm install -g @bytecodealliance/componentize-js @bytecodealliance/jco
- Install local dependencies:
npm install
- Build the project to generate the WebAssembly module (if applicable):
npm run build
- 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
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.