Get the FREE Ultimate OpenClaw Setup Guide →

example

Example code for Anthropic MCP server.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio megmogmog1965-example-mcp-server /path/to/node /path/to/example-mcp-server/build/index.js

How to use

This MCP server is a minimal example demonstrating how to register an MCP server that can be loaded by Claude (Anthropic) via the Model Context Protocol. The repository builds into a JavaScript/Node.js service that exposes an MCP endpoint when started. To use it with Claude Desktop, you configure Claude to invoke the built server via Node.js, pointing to the generated index.js. The provided configuration example registers a server named "time" and runs the built JavaScript code from this repository with Node.js. After building, you can reference this server in Claude Desktop by supplying the path to the node executable and the path to the built index.js as shown in the example.

How to install

Prerequisites:

  • Node.js and npm installed on your system
  • Access to this repository (clone or download)

Steps:

  1. Install dependencies and build the server: npm install npm run build

  2. Prepare the MCP config for your environment:

    • Decide on a node executable path and the location of the built server script (index.js).
    • Use the example configuration as a template to register your MCP server under a unique name.
  3. Integrate with Claude Desktop or your MCP host:

    • Update your Claude Desktop configuration (or your MCP hosting configuration) to point to the Node.js command and the built index.js path as shown in the example.
    • Ensure file permissions allow execution of node and access to the built index.js.
  4. Run the server:

    • Start Claude Desktop (or your MCP host) and verify the server named "time" is loaded and responding.

Additional notes

Notes:

  • The example uses a Node.js environment and the built output at build/index.js. Ensure the paths you provide in your environment reflect your actual build outputs.
  • If you change the server name from "time" or relocate the built script, update the MCP configuration accordingly.
  • This repository serves as a minimal illustration for integrating an MCP server; for production use, replace or extend the example with your specific tooling and logic.
  • When using Claude Desktop, ensure your config.json is valid JSON and that the MCP server script exports the required handler compatible with the MCP protocol.

Related MCP Servers

Sponsor this space

Reach thousands of developers