mcp-js-server
An unofficial JavaScript SDK for Model Context Protocol
Documentation
MCP Server - JavaScript SDK
This is an unofficial JavaScript SDK for Model Context Protocol.
Usage
Import the package to your project:
npm install mcp-js-serverCreate files to define the server's prompts, resources, and tools. See mcp-clever-demo, or the examples below:
Prompts
// prompts.js
export const prompts = {
hello_world: {
description: 'A simple prompt that says hello.',
arguments: [],
messages: [{
role: 'assistant',
content: {
type: 'text',
text: 'Hello, world!'
}
}]
}
};Resources
// resources.js
export const resources = {
apiReference: {
uri: 'https://api.example.com/openapi.json',
mimeType: 'application/json'
}
};Tools
// 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']
}
}
};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);Debugging
You can find logs of the server in your user system logs directory:
Linux: ~/.local/share/logs
macOS: ~/Library/Logs
Windows: %USERPROFILE%\AppData\Local\LogsFrequently asked questions
What is mcp-js-server?
mcp-js-server is An unofficial JavaScript SDK for Model Context Protocol
How do I install mcp-js-server?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-js-server open source?
Yes — it is hosted on GitHub at https://github.com/davlgd/mcp-js-server and has 5 stars.
Related MCP tools
CTTF: MCP integration between Cursor and Figma, allowing Cursor Agentic AI to communicate with Figma for reading designs and modifying them programmatically.
This is MCP server for Claude that gives it terminal control, file system search and diff file editing capabilities JavaScript-based implementation.
MCP server for interfacing with Godot game engine. Provides tools for launching the editor, running projects, and capturing debug output.
A text-based user interface (TUI) client for interacting with MCP servers using Ollama. Features include multi-server, dynamic model switching, streaming res...
The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.
An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others. Built for the Model Context Protocol to enhance AI capabiliti
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP