Example MCP Server
A simple Model Context Protocol (MCP) server built with TypeScript and Node.js. This server demonstrates how to create an MCP server that exposes tools for use in Claude Desktop and other MCP clients.
Features
Simple
say_hellotool that greets a person by nameBuilt with TypeScript for type safety
Uses the official MCP SDK for Node.js
STDIO transport for communication with MCP clients
Prerequisites
Node.js (v16 or higher)
npm
Installation
Install the project dependencies:
Building
Build the TypeScript source code:
This will compile the TypeScript files from src/ to build/ and make the output executable.
Running the Inspector
After building, you can test your server using the MCP Inspector:
Or run it directly:
The inspector provides a web-based interface where you can test your MCP tools interactively.
Development
For development with auto-reload, use:
Important: When developing MCP servers that use STDIO transport, always use console.error() for logging, never console.log(). Writing to stdout will corrupt the JSON-RPC messages and break your server.
Project Structure
Additional Resources
MCP Server Setup Gist - Additional information and walkthrough for setting up MCP STDIO servers, including project setup, configuration, and Claude Desktop integration
Official MCP Documentation - The official documentation for building MCP servers (Note: this documentation may not be up to date)
Claude Desktop Integration
To use this server with Claude Desktop, add it to your claude_desktop_config.json:
Note: Use the absolute path to the built index.js file. After making changes, fully quit and restart Claude Desktop for the configuration to take effect.
This server cannot be installed