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 likeAmerica/New_York
,Asia/Shanghai
). - Returns server local time if no timezone or an invalid timezone is provided.
- Supports an optional
- 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
Installation
- Clone or download the repository.
- 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.