mcp-server-demo1

mcp-server-demo1

0

This project is a demonstration of an MCP Time Server, providing a service to fetch the current time with optional timezone specification. Built with TypeScript, it is a straightforward example to illustrate integration with MCP-enabled clients using standard input/output.

MCP Time Server Demo

This is a simple server example based on the Model Context Protocol (MCP), built with TypeScript and the @modelcontextprotocol/sdk. It offers a tool to fetch the current time, optionally specifying a timezone.

Features

  • getCurrentTime Tool: Fetches the current time.
    • Supports an optional timezone parameter (IANA timezone identifiers like America/New_York, Asia/Shanghai).
    • Returns server local time if no timezone or an invalid timezone is provided.
  • MCP Compatible: Integrates with any MCP client such as Claude Desktop or MCP Inspector.
  • Stdio-Based: Uses standard input/output for communication, facilitating easy integration.

Prerequisites

  • Node.js (LTS version recommended)
  • npm (typically installed with Node.js)

Installation

  1. Clone or download the repository.
  2. Open a terminal in the project root directory and install dependencies:

Usage

1. Compile the Project

Projects are written in TypeScript and need to be compiled to JavaScript.

2. Run the Server