A Model Context Protocol server implementation in Rust that provides comprehensive time-related functionality.
- 6 Time Tools: Current time, timezone conversion, duration calculation, time formatting, timezone info, and timezone listing
- Dual Transport: Supports both STDIO and HTTP transports
- MCP 2025 Compliant: Implements the latest MCP specification (2025-03-26)
- Comprehensive Timezone Support: Uses the IANA timezone database via chrono-tz
- Authentication Support: Optional OAuth2/JWT-based authentication for HTTP mode
- RESTful API: Full HTTP REST endpoints for all MCP operations
- Comprehensive Testing: Unit tests, integration tests, and HTTP API tests
cargo build --release
./target/release/time-mcp-server --transport=stdio
./target/release/time-mcp-server --transport=http --host=localhost --port=8080
Set the OAUTH_ENABLED=true
environment variable to enable authentication:
OAUTH_ENABLED=true ./target/release/time-mcp-server --transport=http --host=localhost --port=8080
get_current_time
- Get current time in various formatsconvert_timezone
- Convert time between timezonescalculate_duration
- Calculate time differencesformat_time
- Format timestampsget_timezone_info
- Get timezone detailslist_timezones
- List available timezones
When running in HTTP mode, the following REST endpoints are available:
GET /health
- Health check endpointGET /mcp/capabilities
- Get server capabilitiesPOST /mcp/tools/call
- Call a time toolPOST /mcp/resources/read
- Read resources (if applicable)POST /mcp/prompts/get
- Get prompts (if applicable)
# Run in development mode
cargo run -- --transport=stdio
# Run all tests
cargo test
# Run specific test suites
cargo test --test unit_tests
cargo test --test http_integration_tests
cargo test --test main_integration_tests
# Build release
cargo build --release
Add to your MCP client configuration:
{
"mcpServers": {
"time-server": {
"command": "./target/release/time-mcp-server",
"args": ["--transport=stdio"]
}
}
}
src/
├── main.rs # Application entry point
├── lib.rs # Library exports
├── auth.rs # Authentication management
├── config.rs # Configuration handling
├── models.rs # Data models and types
├── tools.rs # Time tool implementations
└── handlers/
├── mod.rs # Handler module exports
├── http.rs # HTTP transport handler
├── stdio.rs # STDIO transport handler
└── mcp.rs # Core MCP protocol logic
tests/
├── unit_tests.rs # Unit tests
├── http_integration_tests.rs # HTTP API integration tests
└── main_integration_tests.rs # Main integration tests
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).