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:
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!"}
- Tool:
- Perform calculations:
- Tool:
calculate
- Parameters:
{"operation": "add", "a": 5, "b": 3}
- Tool:
- Get system information:
- Tool:
get_system_info
- Parameters:
{}
- Tool:
- Read resources:
- Resource:
file://package.json
- Resource:
Extending the Server
To add new tools or resources:
- Add tool definitions to the
ListToolsRequestSchema
handler - Add tool logic to the
CallToolRequestSchema
handler - Add resource definitions to the
ListResourcesRequestSchema
handler - Add 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
This server cannot be installed
A server that handles messaging or commands over a custom protocol
Related MCP Servers
- AsecurityAlicenseAqualityAn MCP server to run commands.Last updated -2933160TypeScriptMIT License
- AsecurityFlicenseAqualityA MCP Server used to collect MCP Servers over the internet.Last updated -318Python
- -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 -6PythonMIT License
- -securityAlicense-qualityA hub server that connects to and manages other MCP (Model Context Protocol) servers.Last updated -13126TypeScriptMIT License