### Clone Repository, Install Dependencies, and Run Development Server Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md Bash commands for setting up the development environment for the currentdt-mcp project. This includes cloning the repository, installing npm packages, and starting the development server. ```bash git clone https://github.com/biswajitpanday/CurrentDT-mcp.git ``` ```bash cd currentdt-mcp ``` ```bash npm install ``` ```bash npm run dev ``` -------------------------------- ### Create usage examples for each MCP client Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Provides practical code examples demonstrating how to use the datetime tool with different MCP clients like Cursor, Claude, and VS Code. This helps users quickly integrate the tool into their workflows. ```javascript // Example for a hypothetical MCP client import { McpClient } from '@strix-ai/mcp-client'; async function getDateTime() { const client = new McpClient(); try { const response = await client.sendRequest({ tool: 'currentdt', action: 'get', args: { format: 'YYYY/MM/DD' } }); console.log('Current Date:', response.data.datetime); } catch (error) { console.error('Failed to get datetime:', error); } } getDateTime(); ``` -------------------------------- ### Custom Date Format Examples Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md Demonstrates how the tool supports custom date and time formatting using familiar tokens, providing examples for common use cases like migration files and standard date displays. ```text YYYY-MM-DD HH:mm:ss โ†’ 2025-08-26 14:30:00 YYYY-MM-DD-HHmmss โ†’ 2025-08-26-143000 MM/DD/YYYY โ†’ 08/23/2025 ``` -------------------------------- ### Install currentdt-mcp CLI Tool Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md Installs the currentdt-mcp command-line interface globally using npm. This tool is essential for integrating datetime functionality into AI assistants via the MCP framework. ```bash npm install -g @strix-ai/currentdt-mcp ``` -------------------------------- ### Install @strix-ai/currentdt-mcp Globally Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md Installs the currentdt-mcp package globally using npm, making the command-line tool available system-wide. This is the first step for integrating the service. ```bash npm install -g @strix-ai/currentdt-mcp ``` -------------------------------- ### Verify CurrentDT-mcp Installation and Test Server Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md Bash commands to verify the global installation of the `@strix-ai/currentdt-mcp` package and to test the tool's server functionality directly. ```bash # Verify installation ``` ```bash npm list -g @strix-ai/currentdt-mcp ``` ```bash # Test server directly ``` ```bash npx @strix-ai/currentdt-mcp --test ``` -------------------------------- ### Mermaid Deployment Flowchart Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/Architecture.md Illustrates the deployment process from source code to user installation and integration, highlighting key stages like compilation, bundling, and registry publication. ```mermaid %%{init: {'theme':'neo-dark'}}%% flowchart LR A[Source Code] --> B[TypeScript Compilation] B --> C[Bundle Creation] C --> D[npm Package] D --> E[Registry Publication] E --> F[User Installation] F --> G[MCP Integration] style D fill:#4a5568,stroke:#718096,color:#e2e8f0 style G fill:#4a5568,stroke:#718096,color:#e2e8f0 ``` -------------------------------- ### Test MCP Tool Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TechnicalNotes.md This command-line example demonstrates how to perform a basic test of the currentdt-mcp tool. It's a quick way to verify the tool's installation and basic functionality. ```Bash currentdt-mcp --test ``` -------------------------------- ### Example Workflow with currentdt-mcp Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/PRD.md Demonstrates a future state workflow where the currentdt-mcp tool is used, resulting in zero interruptions and seamless integration with AI assistants like Claude for tasks like generating SQL migration files. ```shell Alice: "Create a new SQL migration file for adding user preferences table" Claude: *Automatically calls get_current_datetime tool* "Here's your migration file: `migration_2025-08-26T14-30-00_add_user_preferences.sql`" Alice: "Perfect! Now add the CREATE TABLE statement with proper columns." ``` -------------------------------- ### Example Filename Generation (UC-001) Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/SRS.md Demonstrates how the AI assistant uses the current datetime in ISO format to generate a date-stamped filename for a SQL migration script. ```bash # Example: migration_2025-08-26T14-30-00.sql ``` -------------------------------- ### Development Commands (Bash) Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/CLAUDE.md Provides essential npm commands for developing, testing, quality assurance, and releasing the @strix-ai/currentdt-mcp project. Includes commands for starting a dev server, building, watching, running unit/integration/coverage tests, linting, formatting, type checking, and publishing. ```Bash # Development npm run dev # Start development server with hot reload npm run build # Build TypeScript to JavaScript npm run watch # Watch mode for development # Testing npm test # Run all tests npm run test:unit # Run unit tests only npm run test:integration # Run integration tests npm run test:coverage # Run tests with coverage report # Quality Assurance npm run lint # Run ESLint npm run lint:fix # Fix ESLint issues automatically npm run format # Run Prettier formatter npm run type-check # TypeScript type checking # Release npm run prepublish # Pre-publish checks and build npm run publish # Publish to npm registry ``` -------------------------------- ### Development Flow Diagram Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md A Mermaid diagram illustrating the typical development lifecycle for a project, starting from a personal problem and progressing through research, design, implementation, testing, documentation, sharing, and community feedback. ```mermaid flowchart LR A["๐Ÿ˜ค Personal
Problem"] --> B["๐Ÿ” Research
MCP"] B --> C["๐Ÿ—๏ธ Design
Architecture"] C --> D["๐Ÿ’ป Implement
Solution"] D --> E["๐Ÿงช Test
& Debug"] E --> F["๐Ÿ“š Document
& Polish"] F --> G["๐Ÿš€ Share with
Community"] G --> H["๐Ÿ’ฌ Community
Feedback"] H --> A style A fill:#ffebee,stroke:#d32f2f,stroke-width:2px style G fill:#e8f5e8,stroke:#388e3c,stroke-width:2px style H fill:#e3f2fd,stroke:#1976d2,stroke-width:2px ``` -------------------------------- ### Test Specific Provider Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TechnicalNotes.md This command-line example shows how to test a specific datetime provider, such as a remote one. It helps in diagnosing connection or configuration issues with individual providers. ```Bash currentdt-mcp --test-provider remote-provider-name ``` -------------------------------- ### Configure CurrentDT-mcp Settings Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md An example of the `currentdt-config.json` file used for customizing the behavior of the currentdt-mcp tool. It allows setting default formats, providers, custom formats, and cache settings. ```json { "defaultFormat": "iso", "defaultProvider": "local", "providers": { "local": { "name": "local", "enabled": true, "priority": 1 }, "remote": { "name": "remote", "enabled": false, "priority": 2, "config": { "url": "https://worldtimeapi.org/api/timezone/UTC", "timeout": 5000 } } }, "customFormats": { "filename": "YYYY-MM-DD-HHmmss", "simple": "MM/DD/YYYY" }, "cache": { "enabled": true, "ttl": 1000 } } ``` -------------------------------- ### Example Custom Date Format Request (UC-002) Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/SRS.md Illustrates a scenario where an AI assistant calls the datetime tool with a custom format parameter for logging purposes. ```json # Example tool call with custom format parameter { "method": "get_current_datetime", "params": { "format": "yyyy-MM-dd HH:mm:ss" } } ``` -------------------------------- ### MCP Tool Call for SQL Migration Timestamp Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md An example of an MCP tool call to the get_current_datetime tool. It specifies a 'YYYY-MM-DD-HHmmss' format and requests the 'local' time provider, typically used for generating timestamped migration file names. ```json { "tool": "get_current_datetime", "arguments": { "format": "YYYY-MM-DD-HHmmss", "provider": "local" } } ``` -------------------------------- ### MCP Server Architecture Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md Illustrates the communication flow within the Model Context Protocol (MCP) tool, showing how an AI client interacts with the DateTime Server, Time Providers, and the System Clock or Remote APIs. ```text AI Client (Cursor/Claude) โ†’ MCP Protocol โ†’ DateTime Server โ†’ Time Providers โ†’ System Clock/Remote APIs ``` -------------------------------- ### Prepare npm package for publication Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Ensures the project is ready for publishing to the npm registry. This includes updating the `package.json` (version, description, keywords), cleaning up unnecessary files, and potentially running a build process. ```bash npm version patch npm publish ``` -------------------------------- ### Validate Format String Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TechnicalNotes.md This command-line example shows how to validate a custom date format string against supported tokens. It's useful for ensuring correct formatting before use. ```Bash currentdt-mcp --validate-format "YYYY-MM-DD HH:mm:ss" ``` -------------------------------- ### Set up package.json with MCP dependencies Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Configures the `package.json` file to include necessary dependencies for the MCP (Multi-Cloud Platform) integration. This ensures the project has access to required libraries for communication and functionality. ```json { "name": "@strix-ai/currentdt-mcp", "version": "1.1.7", "dependencies": { "@strix-ai/mcp-core": "^1.0.0", "moment": "^2.29.1" } } ``` -------------------------------- ### User Flow: Problem to Solution Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md A Mermaid diagram depicting the user journey from a developer requesting a timestamped file from an AI assistant to the AI successfully generating the file using the current datetime tool. ```mermaid graph TD A["๐Ÿ‘จโ€๐Ÿ’ป Developer asks AI:
'Create migration file'"] --> B["๐Ÿค– AI Assistant
receives request"] B --> C["๐Ÿ”ง AI calls
get_current_datetime tool"] C --> D["โšก CurrentDT MCP Server
processes request"] D --> E["โฐ Time Provider
fetches current time"] E --> F["๐Ÿ“ Formatted DateTime
returned to AI"] F --> G["โœ… AI generates
timestamped migration:
2025-08-26-143000_add_users.sql"] G --> H["๐ŸŽ‰ Developer continues
coding without interruption"] style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px style G fill:#e8f5e8,stroke:#4caf50,stroke-width:2px style H fill:#fff3e0,stroke:#ff9800,stroke-width:2px style D fill:#f3e5f5,stroke:#9c27b0,stroke-width:2px ``` -------------------------------- ### Initialize git repository and .gitignore Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Initializes a Git repository for version control and creates a `.gitignore` file to exclude unnecessary files and directories (like `node_modules` and build outputs) from being tracked. ```bash git init touch .gitignore echo "node_modules/" >> .gitignore echo "dist/" >> .gitignore ``` -------------------------------- ### IDateTimeProvider Interface (TypeScript) Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/CLAUDE.md Defines the contract for datetime providers within the MCP server. It includes methods to get the current date and time, check availability, retrieve the provider's name, and specify its priority. ```TypeScript interface IDateTimeProvider { getCurrentDateTime(): Promise; isAvailable(): Promise; getName(): string; getPriority(): number; } ``` -------------------------------- ### Get Current Datetime with Custom Format Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md Demonstrates how to use the `get_current_datetime` tool with a specified format and provider. This is useful for obtaining formatted date and time strings from either local or remote sources. ```json { "tool": "get_current_datetime", "arguments": { "format": "YYYY-MM-DD HH:mm:ss", "provider": "local" } } ``` -------------------------------- ### MCP Ecosystem Architecture Diagram Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md Visual representation of the CurrentDT-MCP ecosystem, showing AI clients (Cursor IDE, Claude Desktop, VS Code, Windsurf) interacting with the MCP Server (Protocol Handler, DateTime Service, Config Manager) and various Time Providers (Local System Clock, Remote Time APIs, Custom Sources) via JSON-RPC. ```mermaid graph TB subgraph "๐ŸŒ MCP Ecosystem" direction TB subgraph "AI Clients" A["๐ŸŽฏ Cursor IDE"] B["๐Ÿ’ฌ Claude Desktop"] C["๐Ÿ“ VS Code"] D["๐ŸŒŠ Windsurf"] end subgraph "CurrentDT MCP Server" E["๐Ÿ”ง MCP Protocol Handler"] F["๐Ÿ“‹ DateTime Service"] G["โš™๏ธ Config Manager"] end subgraph "Time Providers" H["๐Ÿ• Local System Clock"] I["๐ŸŒ Remote Time APIs"] J["๐Ÿ”Œ Custom Sources"] end end A -.->|JSON-RPC| E B -.->|JSON-RPC| E C -.->|JSON-RPC| E D -.->|JSON-RPC| E E --> F F --> G F --> H F --> I F --> J style E fill:#e1f5fe,stroke:#0277bd,stroke-width:2px style F fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px style H fill:#e8f5e8,stroke:#388e3c,stroke-width:2px style I fill:#fff8e1,stroke:#f57c00,stroke-width:2px style J fill:#fce4ec,stroke:#c2185b,stroke-width:2px ``` -------------------------------- ### Initialize npm package with @strix-ai scope Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md This task involves setting up a new npm package within the @strix-ai organization scope. It typically includes running `npm init` and configuring the `package.json` file with the correct scope. ```bash npm init @strix-ai/currentdt-mcp --scope=@strix-ai ``` -------------------------------- ### Set up linting and formatting (ESLint, Prettier) Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Configures ESLint for code linting and Prettier for code formatting to maintain code quality and consistency. This involves creating configuration files like `.eslintrc.js` and `.prettierrc.js`. ```bash npm install --save-dev eslint prettier eslint-config-prettier eslint-plugin-prettier npx eslint --init npx prettier --init ``` -------------------------------- ### Create a Feature Branch for Contributions Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md Bash commands demonstrating the Git workflow for contributing to the currentdt-mcp project, including forking, creating a new feature branch, committing changes, and pushing to the remote repository. ```bash git clone https://github.com/biswajitpanday/CurrentDT-mcp.git ``` ```bash cd currentdt-mcp ``` ```bash npm install ``` ```bash npm run dev ``` ```bash git checkout -b feature/amazing-feature ``` ```bash git commit -m 'Add amazing feature' ``` ```bash git push origin feature/amazing-feature ``` -------------------------------- ### MCP Tool: Get Current Datetime Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/SRS.md Defines the 'get_current_datetime' tool for MCP clients, allowing retrieval of the current date and time with optional format and provider parameters. This ensures AI assistants can access datetime information according to specified requirements. ```json { "name": "get_current_datetime", "description": "Retrieves the current date and time.", "parameters": { "type": "object", "properties": { "format": { "type": "string", "description": "Optional date format string (e.g., ISO 8601, custom formats).", "default": "2025-08-26T14:30:00.000Z" }, "provider": { "type": "string", "description": "Optional datetime provider selection (e.g., 'local', 'remote').", "default": "local" } }, "required": [] } } ``` -------------------------------- ### Document configuration options Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Details all available configuration settings for the datetime tool, explaining their purpose, default values, and how they affect the tool's behavior (e.g., date formats, provider selection). ```markdown ## Configuration The `@strix-ai/currentdt-mcp` tool can be configured via environment variables or a configuration file. ### `MCP_DATETIME_FORMAT` * **Description:** Specifies the default date format to use when none is provided in the request. * **Type:** `string` * **Default:** `ISO` (e.g., `YYYY-MM-DDTHH:mm:ss.sssZ`) * **Example:** `MCP_DATETIME_FORMAT=DD-MM-YYYY HH:mm` ### `MCP_DATETIME_PROVIDER` * **Description:** Selects the datetime provider. Use `local` for the system's clock or `remote` to fetch from a configured URL. * **Type:** `string` * **Default:** `local` ### `MCP_DATETIME_REMOTE_URL` * **Description:** The URL of the remote datetime service to use when `MCP_DATETIME_PROVIDER` is set to `remote`. * **Type:** `string` * **Required:** If `MCP_DATETIME_PROVIDER` is `remote`. ``` -------------------------------- ### Configure automated builds and CI/CD Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Sets up Continuous Integration and Continuous Deployment pipelines using services like GitHub Actions, GitLab CI, or Jenkins. This automates the build, test, and deployment process upon code changes. ```yaml name: CI/CD Pipeline on: push: branches: [ main ] jobs: build-and-publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '18' - name: Install Dependencies run: npm ci - name: Run Tests run: npm test - name: Build Project run: npm run build - name: Publish to npm uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} ``` -------------------------------- ### Abstract Configuration Loading Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Creates an abstraction layer for loading configuration settings, allowing different configuration sources (e.g., environment variables, JSON files, .env files) to be plugged in seamlessly. ```typescript interface IConfigLoader { load(): Promise>; } class EnvConfigLoader implements IConfigLoader { async load(): Promise> { /* ... load from process.env ... */ } } class ConfigManager { private config: Record = {}; constructor(private loader: IConfigLoader) {} async initialize() { this.config = await this.loader.load(); } get(key: string): any { return this.config[key]; } } ``` -------------------------------- ### Create release versioning strategy Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Defines a clear strategy for versioning the project releases, typically following Semantic Versioning (SemVer). This ensures predictable updates and clear communication of changes. ```markdown ## Versioning Strategy This project follows [Semantic Versioning (SemVer)](http://semver.org/). - **MAJOR** version when you make incompatible API changes, - **MINOR** version when you add functionality in a backward-compatible manner, - **PATCH** version when you make backward-compatible bug fixes. Initial development releases may be in the `0.y.z` range. ``` -------------------------------- ### Complete API documentation Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Generates comprehensive documentation for the project's API, detailing all available endpoints, request/response structures, parameters, and return values. This is crucial for users and other developers. ```markdown ## API Reference ### `GET /datetime` Retrieves the current date and time. **Query Parameters:** * `format` (string, optional): The desired output format (e.g., `YYYY-MM-DD HH:mm:ss`, `ISO`). Defaults to ISO format. * `timezone` (string, optional): The desired timezone (e.g., `America/New_York`, `UTC`). Defaults to UTC. **Responses:** * `200 OK`: ```json { "datetime": "2023-10-27T10:30:00.000Z", "timezone": "UTC", "format": "ISO" } ``` * `400 Bad Request`: ```json { "error": "Invalid format specified." } ``` ``` -------------------------------- ### Execute npm Scripts for Build, Test, Lint, and Format Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md Common npm scripts available for the currentdt-mcp project, including building the TypeScript code, running tests, performing ESLint checks, and formatting code with Prettier. ```bash # Build TypeScript ``` ```bash npm run build ``` ```bash # Run all tests ``` ```bash npm test ``` ```bash # ESLint check ``` ```bash npm run lint ``` ```bash # Prettier format ``` ```bash npm run format ``` -------------------------------- ### After AI Timestamp Correction with MCP Tool Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md Illustrates the improved developer experience after implementing the MCP tool, where the AI assistant automatically generates files with the correct, current timestamp. ```text You: "Create a migration to add user preferences" Claude: "I'll create a migration file with the current timestamp..." [Generates: 2025-08-26-143022_add_user_preferences.sql] You: [Perfect! Continues coding] ``` -------------------------------- ### Configuration Management Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/PRD.md Enables simple configuration file management for settings, allowing customizable behavior without code changes. It uses a JSON configuration format and supports runtime configuration reloading with validation. -------------------------------- ### Create GitHub releases with changelogs Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Automates the creation of GitHub releases, including tagging the commit and generating a changelog based on commit messages or conventional commits. This provides a clear history of changes. ```bash # Assuming conventional-commits are used and changelog is generated git tag v1.1.7 git push origin v1.1.7 # Use GitHub CLI or Actions to create release from tag and changelog ``` -------------------------------- ### Configure build and development scripts Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Defines scripts in `package.json` for building the project and running it in development mode. This typically involves using tools like `tsc` for TypeScript compilation and `nodemon` for hot-reloading. ```json { "scripts": { "build": "tsc", "dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts" } } ``` -------------------------------- ### Lazy Provider Initialization Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Optimizes performance by delaying the creation (initialization) of datetime provider instances until they are actually needed, rather than creating all providers at server startup. ```typescript class McpServer { private provider: IDatetimeProvider | null = null; private getProvider(): IDatetimeProvider { if (!this.provider) { this.provider = ProviderFactory.create(config.providerType, config); } return this.provider; } async handleRequest(request: DatetimeRequest) { const provider = this.getProvider(); return await provider.getDatetime(request); } } ``` -------------------------------- ### Provider Plugin System Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Develops a system that allows new datetime providers to be dynamically loaded as plugins (e.g., from separate npm packages) at runtime, enhancing extensibility without modifying the core application. ```typescript // Conceptual example async function loadProviderPlugin(pluginName: string): Promise { const module = await import(pluginName); if (module.default && typeof module.default.create === 'function') { return module.default.create(); } throw new Error('Invalid plugin format'); } ``` -------------------------------- ### Configure Claude Desktop for currentdt-mcp Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md Sets up Claude Desktop to utilize the currentdt-mcp server. This involves adding the server configuration to the Claude Desktop JSON configuration file, enabling access to date and time functionalities. ```json { "mcpServers": { "currentdt": { "command": "currentdt-mcp", "args": [] } } } ``` -------------------------------- ### Configure TypeScript project structure Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Sets up the TypeScript configuration (`tsconfig.json`) for the project, defining compilation options, module resolution, and output directories. This ensures type safety and efficient JavaScript compilation. ```json { "compilerOptions": { "target": "es2016", "module": "commonjs", "outDir": "./dist", "rootDir": "./src", "strict": true, "esModuleInterop": true }, "include": ["src/**/*"], "exclude": ["node_modules", "**/*.spec.ts"] } ``` -------------------------------- ### Create extensible provider architecture Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Designs the system to easily add new types of datetime providers in the future without modifying the core MCP server logic. This involves using a plugin or factory pattern. ```typescript class ProviderFactory { static create(providerType: string, config: any): IDatetimeProvider { switch (providerType) { case 'local': return new LocalDatetimeProvider(); case 'remote': return new RemoteDatetimeProvider(config.url); // ... other providers ... default: throw new Error('Unknown provider type'); } } } ``` -------------------------------- ### Create datetime provider interface Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Defines an interface for datetime providers, outlining the methods that any concrete datetime provider implementation must adhere to. This promotes a consistent and extensible architecture. ```typescript interface IDatetimeProvider { getDatetime(request: DatetimeRequest): Promise; } ``` -------------------------------- ### MCP Server JSON-RPC Output Requirement Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md Highlights a key technical challenge in MCP development: ensuring that MCP servers strictly output only JSON-RPC messages to stdout, with all other output directed to stderr. ```text MCP servers must output only JSON-RPC messages to stdout โ€” any logging or debugging must go to stderr. ``` -------------------------------- ### Implement provider selection logic Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Develops the logic for selecting the appropriate datetime provider (local or remote) based on configuration settings or runtime conditions. This allows for dynamic switching between providers. ```typescript function getProvider(config: AppConfig): IDatetimeProvider { if (config.useRemoteProvider && config.remoteApiUrl) { return new RemoteDatetimeProvider(config.remoteApiUrl); } else { return new LocalDatetimeProvider(); } } ``` -------------------------------- ### Before AI Timestamp Correction Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/blogs/introducing-currentdt-mcp.md Shows a typical developer interaction where an AI assistant generates a file with an incorrect, outdated timestamp, requiring manual correction. ```text You: "Create a migration to add user preferences" Claude: "I'll create a migration file..." [Generates: 2024-01-01-123456_add_user_preferences.sql] You: [Manually fixes timestamp to current date] ``` -------------------------------- ### Configure Cursor IDE for currentdt-mcp Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/README.md Configures the Cursor IDE to use the currentdt-mcp server by adding an entry to the MCP servers configuration file. This allows Cursor to access real-time date and time information through the specified command. ```json { "mcpServers": { "currentdt": { "command": "npx", "args": ["@strix-ai/currentdt-mcp"] } } } ``` -------------------------------- ### MCP Client Integration Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/PRD.md This feature focuses on ensuring seamless integration with major MCP clients such as Cursor IDE, Claude Desktop, and the VS Code MCP extension. -------------------------------- ### Component Architecture Diagram Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/Architecture.md Details the core components of the MCP server, including the MCPServer, DateTimeService, IDateTimeProvider interface, and concrete provider implementations (LocalProvider, RemoteProvider). It also shows the ConfigurationManager and ProviderFactory. ```mermaid %%{init: {'theme':'neo-dark'}}%% classDiagram class MCPServer { +start(): void +stop(): void +registerTool(tool: Tool): void -handleRequest(request: MCPRequest): MCPResponse } class DateTimeService { +getCurrentDateTime(options: DateTimeOptions): string +validateFormat(format: string): boolean -formatDateTime(date: Date, format: string): string } class IDateTimeProvider { <> +getCurrentDateTime(): Date +isAvailable(): boolean } class LocalProvider { +getCurrentDateTime(): Date +isAvailable(): boolean } class RemoteProvider { +getCurrentDateTime(): Date +isAvailable(): boolean -fetchRemoteTime(): Promise~Date~ } class ConfigurationManager { +getConfig(): Configuration +validateConfig(config: Configuration): boolean +watchConfig(): void -loadConfig(): Configuration } class ProviderFactory { +createProvider(type: string): IDateTimeProvider +getDefaultProvider(): IDateTimeProvider -providers: Map~string, IDateTimeProvider~ } MCPServer --> DateTimeService DateTimeService --> ProviderFactory DateTimeService --> ConfigurationManager ProviderFactory --> IDateTimeProvider IDateTimeProvider <|-- LocalProvider IDateTimeProvider <|-- RemoteProvider style MCPServer fill:#4a5568,stroke:#718096,color:#e2e8f0 style DateTimeService fill:#4a5568,stroke:#718096,color:#e2e8f0 style IDateTimeProvider fill:#2d3748,stroke:#4a5568,color:#e2e8f0 ``` -------------------------------- ### Data Flow Sequence Diagram Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/Architecture.md Illustrates the sequence of interactions for a 'get_current_datetime' request, from the MCP client to the MCP server, through the DateTimeService, ProviderFactory, and LocalProvider, including configuration retrieval. ```mermaid %%{init: {'theme':'neo-dark'}}%% sequenceDiagram participant C as MCP Client participant S as MCP Server participant DS as DateTime Service participant PF as Provider Factory participant LP as Local Provider participant CM as Config Manager C->>S: Request get_current_datetime S->>DS: getCurrentDateTime(options) DS->>CM: getConfig() CM-->>DS: configuration DS->>PF: getProvider(type) PF->>LP: getCurrentDateTime() LP-->>PF: Date object PF-->>DS: Date object DS->>DS: formatDateTime(date, format) DS-->>S: formatted datetime string S-->>C: MCP Response with datetime Note over C,CM: All interactions follow MCP protocol Note over DS,LP: Clean separation of concerns ``` -------------------------------- ### Mermaid User Flow Diagram Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/SRS.md Visualizes the interaction between a developer, an AI assistant, and the MCP client for retrieving and formatting the current datetime. ```mermaid %%{init: {'theme':'dark'}}%% flowchart TD A[Developer opens AI assistant] --> B[AI assistant needs current datetime] B --> C[Assistant calls MCP get_current_datetime tool] C --> D{Format specified?} D -->|Yes| E[Use specified format] D -->|No| F[Use ISO format default] E --> G[Datetime provider retrieves current time] F --> G G --> H{Provider available?} H -->|Yes| I[Format datetime string] H -->|No| J[Fallback to local system] J --> I I --> K[Return formatted datetime to assistant] K --> L[Assistant uses datetime in response] L --> M[Developer receives contextual datetime] style A fill:#2d3748,stroke:#4a5568,color:#e2e8f0 style M fill:#2d3748,stroke:#4a5568,color:#e2e8f0 style G fill:#4a5568,stroke:#718096,color:#e2e8f0 style I fill:#4a5568,stroke:#718096,color:#e2e8f0 ``` -------------------------------- ### High-Level Architecture Diagram Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/Architecture.md Visualizes the overall system architecture, showing the interaction between MCP clients, the MCP server components, datetime providers, and configuration sources. It highlights the flow of requests and data within the system. ```mermaid %%{init: {'theme':'neo-dark'}}%% graph TB subgraph "MCP Clients" A[Cursor IDE] B[Claude Desktop] C[VS Code] end subgraph "MCP Server (@strix-ai/currentdt-mcp)" D[MCP Protocol Handler] E[Tool Registry] F[Datetime Service] G[Configuration Manager] H[Provider Factory] end subgraph "Datetime Providers" I[Local System Provider] J[Remote Time Provider] K[Custom Provider] end subgraph "Configuration" L[config.json] M[Environment Variables] end A --> D B --> D C --> D D --> E E --> F F --> H H --> I H --> J H --> K G --> L G --> M G --> F style D fill:#4a5568,stroke:#718096,color:#e2e8f0 style F fill:#4a5568,stroke:#718096,color:#e2e8f0 style H fill:#4a5568,stroke:#718096,color:#e2e8f0 ``` -------------------------------- ### Create integration tests for MCP communication Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Tests the interaction between different components of the MCP system, such as the server and a mock MCP client, to ensure seamless communication and data exchange. ```typescript // Mock MCP Client class MockMcpClient { async sendRequest(request: any): Promise { /* ... */ } } // Test scenario it('should correctly process datetime request via MCP', async () => { const server = new McpServer(...); const client = new MockMcpClient(); await server.start(); const response = await client.sendRequest({ type: 'getDatetime', payload: { format: 'YYYY-MM-DD' } }); expect(response.datetime).toMatch(/\d{4}-\d{2}-\d{2}/); await server.stop(); }); ``` -------------------------------- ### Implement MCP server base class Source: https://github.com/biswajitpanday/currentdt-mcp/blob/master/docs/TaskList.md Defines the foundational class for the MCP server, handling core communication protocols and abstracting common server functionalities. This class serves as the base for specific provider implementations. ```typescript abstract class McpServerBase { protected abstract handleRequest(request: any): Promise; public start(): void { /* ... */ } public stop(): void { /* ... */ } } ```