A production-ready Model Context Protocol (MCP) server implemented in Go that provides time-related tools for AI assistants.
This MCP server implements the get_current_time tool, allowing AI assistants to query the current system time with timezone information. Built using the official MCP Go SDK, it follows best practices for extensibility and maintainability.
# Clone or navigate to the project directory
cd /home/david/go/src/skraak_mcp
# Download dependencies
go mod download
# Build the server
go build -o skraak_mcp
The server communicates over stdio (standard input/output) as per MCP specification and requires a DuckDB database path as an argument:
./skraak_mcp /path/to/database.duckdb
Example:
./skraak_mcp ./test.duckdb
Add to your Claude Desktop MCP configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"skraak_mcp": {
"command": "/home/david/go/src/skraak_mcp/skraak_mcp",
"args": ["/path/to/database.duckdb"]
}
}
}
Returns the current system time with comprehensive timezone information.
Input: None
Output:
{
"time": "2024-01-25T10:30:45Z",
"timezone": "UTC",
"unix": 1706181045
}
Fields:
time: Current system time in RFC3339 format (ISO 8601 compatible)timezone: System timezone identifierunix: Unix timestamp in seconds since epochskraak_mcp/
├── go.mod # Go module definition
├── go.sum # Dependency checksums
├── main.go # Server entry point
├── tools/ # Tool implementations
│ └── time.go # Time-related tools
└── README.md # This file
Create tool file in the tools/ package (e.g., tools/calculator.go)
Define input/output structures with jsonschema tags:
type CalculateInput struct {
Expression string `json:"expression" jsonschema:"Mathematical expression to evaluate"`
}
type CalculateOutput struct {
Result float64 `json:"result" jsonschema:"Calculated result"`
}
func Calculate(ctx context.Context, req *mcp.CallToolRequest, input CalculateInput) (
*mcp.CallToolResult,
CalculateOutput,
error,
) {
// Implementation
return &mcp.CallToolResult{}, output, nil
}
err := mcp.AddTool(
server,
"calculate",
"Evaluate mathematical expressions",
tools.Calculate,
)
Build and test the server:
# Build
go build -o skraak_mcp
# Run (will wait for MCP protocol messages on stdin)
./skraak_mcp ./test.duckdb
# In another terminal, you can test with an MCP client
# or manually send JSON-RPC messages
Unit tests can be added in .......
This server implements:
MIT
Contributions welcome! Please ensure:
Server won't start:
go versiongo build -o skraak_mcpTool not appearing in client:
Time format issues: