current-lucky-words
v1.1.0
Published
A sample MCP server that provides lucky words, lucky numbers (0-100), and current time with encouraging messages
Maintainers
Readme
Current Lucky Words MCP Server
A simple Model Context Protocol (MCP) server that provides current time functionality with encouraging lucky words. This server demonstrates how to create a basic MCP server using Node.js.
Features
- get_current_lucky_time: Returns the current date and time in various formats
- Supports ISO, locale, and Unix timestamp formats
- Optional timezone specification
- Includes random lucky words for positive vibes! 🍀
- get_lucky_timestamp: Returns the current Unix timestamp in milliseconds
- Also includes encouraging lucky words
Lucky Words Feature ✨
Every time response includes a random positive word or phrase such as:
- "Good luck", "Happy", "Wonderful", "Amazing", "Fantastic"
- "Brilliant", "Excellent", "Marvelous", "Spectacular"
- "Joyful", "Blessed", "Fortunate", "Prosperous"
- And many more uplifting words!
Sample Responses
"Joyful! Current time: 2025-10-06T22:07:12.063Z"
"Marvelous! Current Unix timestamp: 1759788432461"
"Hopeful! Current time: 10/6/2025, 3:07:12 PM (America/New_York)"
"Wonderful! Current time: 2025-10-06T22:07:12.063Z (UTC)"Prerequisites
- Node.js 18.0.0 or higher
- npm or yarn package manager
Installation
Navigate to the sample_server directory:
cd sample_serverInstall dependencies:
npm install
Usage
Running the Server
Start the server:
npm startFor development with auto-restart:
npm run devAvailable Tools
get_current_lucky_time
Returns the current date and time with optional formatting and timezone, plus lucky words.
Parameters:
format(optional): Time format - "iso" (default), "locale", or "unix"timezone(optional): Timezone string (e.g., "UTC", "America/New_York")
Examples:
- Get current time in ISO format:
{"format": "iso"} - Get current time in New York timezone:
{"format": "locale", "timezone": "America/New_York"} - Get Unix timestamp:
{"format": "unix"}
get_lucky_timestamp
Returns the current Unix timestamp in milliseconds with lucky words.
Parameters: None
MCP Client Integration
To use this server with an MCP client, you'll need to configure the client to connect to this server via stdio transport. The server communicates through standard input/output.
Example configuration for MCP clients:
{
"mcpServers": {
"current-lucky-words": {
"command": "node",
"args": ["path/to/sample_server/server.js"]
}
}
}Development
The server is built using the official MCP SDK for JavaScript/TypeScript. Key components:
- Server Setup: Uses
@modelcontextprotocol/sdk/server - Transport: Uses stdio transport for communication
- Tool Handlers: Implements
ListToolsRequestSchemaandCallToolRequestSchema
Error Handling
The server includes comprehensive error handling for:
- Invalid tool names
- Invalid time formats
- Timezone parsing errors
- General runtime errors
All errors are returned as structured responses with error flags.
Distribution
This server is ready for distribution through multiple channels:
1. NPM Package Distribution
The server is configured for npm publication with:
- CLI executable via
sample-mcp-time-servercommand - Proper package metadata and dependencies
- MCP registry integration via
mcpNamefield
To publish to npm:
npm publishUsers can then install and run it:
npx current-lucky-words2. MCP Registry Integration
The server includes a server.json file for integration with the official MCP Registry:
- Standardized metadata format
- Tool capability descriptions
- Package reference for automated installation
To publish to the MCP Registry:
- Install the MCP publisher CLI:
brew install mcp-publisher - Authenticate:
mcp-publisher login github - Publish:
mcp-publisher publish
3. Direct Distribution
Users can also clone and run the server directly:
git clone <repository-url>
cd sample_server
npm install
npm start4. Docker Distribution (Future)
The server can be containerized for Docker distribution:
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY server.js ./
EXPOSE 3000
CMD ["npm", "start"]MCP Client Configuration
To use this server with MCP clients, add it to your client configuration:
{
"mcpServers": {
"current-lucky-words": {
"command": "npx",
"args": ["current-lucky-words"]
}
}
}Or if installed locally:
{
"mcpServers": {
"current-lucky-words": {
"command": "node",
"args": ["path/to/sample_server/server.js"]
}
}
}License
MIT License
