Provides tools for basic JavaScript operations including echo functionality, arithmetic calculations, and system information retrieval
Enables access to Node.js system information and provides a framework for running server-side JavaScript tools through an MCP interface
Allows access to package configuration through resource retrieval, enabling inspection of npm dependencies and project metadata
My JavaScript MCP Server
A Model Context Protocol (MCP) server built with JavaScript that provides basic tools and resources.
Features
Tools
echo: Echo back any message
calculate: Perform basic arithmetic operations (add, subtract, multiply, divide)
get_system_info: Get basic system information
Resources
package.json: Access to the server's package configuration
Installation
Make sure you have Node.js installed
Install dependencies:
npm install
Usage
Running the Server
Development Mode
Testing with MCP Inspector
You can test your server using the MCP Inspector:
Configuration
This server runs on stdio transport, which means it communicates through standard input/output. This is the most common way to run MCP servers.
Example Usage
Once connected to an MCP client, you can:
Echo a message:
Tool:
echo
Parameters:
{"message": "Hello, World!"}
Perform calculations:
Tool:
calculate
Parameters:
{"operation": "add", "a": 5, "b": 3}
Get system information:
Tool:
get_system_info
Parameters:
{}
Read resources:
Resource:
file://package.json
Extending the Server
To add new tools or resources:
Add tool definitions to the
ListToolsRequestSchema
handlerAdd tool logic to the
CallToolRequestSchema
handlerAdd resource definitions to the
ListResourcesRequestSchema
handlerAdd resource reading logic to the
ReadResourceRequestSchema
handler
Error Handling
The server includes proper error handling for:
Division by zero in calculations
Unknown tools and resources
File reading errors
Graceful shutdown on SIGINT
local-only server
The server can only run on the client's local machine because it depends on local resources.
A server that handles messaging or commands over a custom protocol
Related MCP Servers
- AsecurityAlicenseAqualityAn MCP server to run commands.Last updated -1403195MIT License
- AsecurityFlicenseAqualityA MCP Server used to collect MCP Servers over the internet.Last updated -319
- -securityAlicense-qualityA server that provides document processing capabilities using the Model Context Protocol, allowing conversion of documents to markdown, extraction of tables, and processing of document images.Last updated -17MIT License
- AsecurityAlicenseAqualityA hub server that connects to and manages other MCP (Model Context Protocol) servers.Last updated -74849MIT License