MCP JavaScript Server

by davlgd

2 stars
384 downloads
Not rated
GitHub Website

About

An unofficial JavaScript SDK to create customized servers for the Model Context Protocol, allowing definition of prompts, resources, and tools for tailored interactions.

Details

Author
davlgd
Repository
davlgd/mcp-js-server
GitHub stars
2
Downloads
384
License
Apache License 2.0
Categories
Developer Tools, AI

- Define prompts, resources, and tools in JavaScript
- Supports async tool handlers with JSON Schema validation
- Lightweight, unofficial implementation of the MCP spec
- Available as an npm package (mcp-js-server)
- Logs stored in platform‑specific system directories

Setting up with Highlight

Follow these steps to add this server as a custom Highlight plugin:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP JavaScript Server
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Import the package to your project:

npm install mcp-js-server

Create files to define the server's prompts, resources, and tools. See mcp-clever-demo, or the examples below:

simple_tool

A simple tool that returns the current date and time.

complex_tool

A complex tool that takes two parameters (param1, param2) and returns a formatted string. Parameters: param1 (string), param2 (string).

// tools.js
export const tools = {
    simple_tool: {
        description: 'A simple tool',
        handler: async () => new Date().toLocaleString(),
        schema: {
            type: 'object',
            properties: {},
            required: []
        }
    },
    complex_tool: {
        description: 'A complex tool',
        handler: async ({ param1, param2 }) => {
            return param1: ${param1}, param2: ${param2};
        },
        schema: {
            type: 'object',
            properties: {
                param1: { type: 'string' },
                param2: { type: 'string' }
            },
            required: ['param1', 'param2']
        }
    }
};

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp javascript server": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

Server

Then create a server instance with the following code:

// server.js
import { MCP } from 'mcp-server';
import { tools } from './tools.js';
import { prompts } from './prompts.js';
import { resources } from './resources.js';

const infos = {
name: 'mcp-demo-server',
version: '0.1.0'
};

const server = new MCP(infos, prompts, resources, tools);

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.