About MCP Server Example
MCP Server Example is a basic Node.js MCP server example for developers learning server implementation with the official SDK. It demonstrates a hello-world tool over stdio, with Zod-based type-safe input validation.
Key features
- 01Official MCP SDK implementation
- 02Hello-world tool with optional name
- 03stdio transport
- 04Zod schema validation
Use cases
- 01Learning to build an MCP server
- 02Testing stdio-based MCP connections
MCP support
It implements an MCP server using the official SDK and exposes a hello-world tool to MCP clients over stdio.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP Server Example
A simple example of a Model Context Protocol (MCP) server implementation using the official SDK.
Overview
This project demonstrates how to create a basic MCP server with a simple "hello world" tool. The server uses the official MCP SDK and communicates via stdio transport.
Features
- MCP server implementation using
@modelcontextprotocol/sdk - Simple "hello world" tool with optional name parameter
- Stdio-based communication transport
- Type-safe tool definitions using Zod schema validation
Prerequisites
- Node.js (version 14 or higher)
- npm or yarn package manager
Installation
- Clone this repository
- Install dependencies:
npm install
Usage
To start the MCP server:
npm start
The server will start and listen for incoming connections via stdio.
Project Structure
server.js- Main server implementationpackage.json- Project configuration and dependencies
Dependencies
@modelcontextprotocol/sdk- Official MCP SDKzod- Schema validation library
License
This project is open source and available under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.