README.mdโข4.77 kB
# MCP-WTIT (What Time Is It?)
A Model Context Protocol (MCP) server that provides current time in ISO8601 format with timezone support.
## ๐ Features
- โฐ Get current time with detailed information (ISO8601, timestamp, timezone)
- ๐ Support for all IANA timezones
- ๐ฏ Optional milliseconds precision
- ๐๏ธ Clean Architecture design
- ๐ฆ ESModules with TypeScript 5.6+
- โ
Comprehensive test coverage
- ๐ง Type-safe with strict TypeScript configuration
## ๐ Requirements
- Node.js 18.0.0 or higher
- npm or yarn
## ๐ ๏ธ Installation
### As a global package
```bash
# Install globally
npm install -g mcp-wtit
# Run the server
mcp-wtit
```
### As a dependency
```bash
# Install as a dependency
npm install mcp-wtit
```
### From source
```bash
# Clone the repository
git clone https://github.com/yorifuji/mcp-wtit.git
cd mcp-wtit
# Install dependencies
npm install
# Build the project
npm run build
# Run the server
npm start
```
## ๐ฆ Quick Start
### For MCP Clients (Claude Desktop, etc.)
Add to your MCP client configuration:
#### If installed globally:
```json
{
"mcpServers": {
"mcp-wtit": {
"command": "mcp-wtit"
}
}
}
```
#### If installed locally:
```json
{
"mcpServers": {
"mcp-wtit": {
"command": "node",
"args": ["./node_modules/mcp-wtit/dist/index.js"]
}
}
}
```
#### From source:
```json
{
"mcpServers": {
"mcp-wtit": {
"command": "node",
"args": ["/path/to/mcp-wtit/dist/index.js"]
}
}
}
```
### Debug with MCP Inspector
MCP Inspector provides a web-based interface to test and debug your MCP server:
```bash
# Build the project first
npm run build
# Run with MCP Inspector
npm run inspect
```
This will:
1. Start the MCP Inspector on http://localhost:6274
2. Automatically open your browser
3. Connect to the MCP server with debug capabilities
In the Inspector, you can:
- View available tools and their schemas
- Test tool calls with different parameters
- Monitor request/response communication
- Debug server behavior in real-time
### For Development
```bash
# Run in development mode
npm run dev
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Lint code
npm run lint
# Type check
npm run typecheck
```
## ๐ API Documentation
### Tools
#### `get_current_time`
Get the current time with detailed information.
**Parameters:**
- `includeMilliseconds` (boolean, optional): Include milliseconds in ISO8601 format (default: true)
- `timezone` (string, optional): Timezone for the time (default: "UTC")
**Response:**
```json
{
"iso8601": "2024-01-15T10:30:45.123Z",
"timestamp": 1705315845123,
"timezone": "UTC"
}
```
## ๐๏ธ Architecture
This project follows Clean Architecture principles:
```
src/
โโโ domain/ # Business logic (no dependencies)
โโโ application/ # Use cases
โโโ infrastructure/ # External interfaces (MCP)
โโโ shared/ # Shared types and utilities
โโโ di/ # Dependency injection
```
See [Architecture Documentation](docs/ARCHITECTURE.md) for details.
## ๐งช Testing
Tests are located in the `tests/` directory and use Vitest:
```bash
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage
```
## ๐ฆ Scripts
| Script | Description |
|--------|-------------|
| `npm run build` | Build the TypeScript project |
| `npm run dev` | Run in development mode |
| `npm start` | Run the built server |
| `npm run inspect` | Debug with MCP Inspector |
| `npm test` | Run tests |
| `npm run test:watch` | Run tests in watch mode |
| `npm run test:coverage` | Run tests with coverage report |
| `npm run lint` | Run ESLint |
| `npm run lint:fix` | Run ESLint and fix issues |
| `npm run typecheck` | Run TypeScript type checking |
## ๐ค Contributing
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- Built for the [Model Context Protocol](https://modelcontextprotocol.io/)
- Inspired by Clean Architecture principles
## ๐ฆ NPM Package
[](https://www.npmjs.com/package/mcp-wtit)
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
Published on npm: [mcp-wtit](https://www.npmjs.com/package/mcp-wtit)