# MCP Server with UTC Datetime Tool This project implements a simple MCP (Model Context Protocol) server using the `mcp-golang` framework. It exposes a tool that provides the current date and time in UTC. ## Features - Provides current UTC datetime via an MCP tool named `current_utc_datetime`. - Can be run locally or using Docker Compose. ## Prerequisites - Go (if running locally) ## Local Execution 1. **Clone the repository (if applicable) or ensure you have the `main.go`, `go.mod` and `go.sum` files.** 2. **Install dependencies:** ```bash go mod tidy ``` 3. **Build the server:** ```bash go build -o mcp-datetime-server ``` 4. **Run the server:** ```bash ./mcp-datetime-server ``` You should see the output: `MCP Server with UTC Datetime tool started. Waiting for requests...` ## Configuration with Cursor To use this MCP server with an AI assistant like Cursor: 1. **Ensure the MCP server is running locally.** 2. **Locate your AI assistant's MCP configuration file.** For Cursor, you can typically find this by: * Clicking the settings icon (often a gear). * Navigating to an "MCP" or "AI Settings" section. * There might be an option like "Add new global MCP Server" or "Edit MCP Config". This will usually open a JSON file (e.g., `mcp.json` or `claude_desktop_config.json` if you were using Claude directly, but Cursor will have its own). 3. **Edit the MCP configuration file to add your server.** You'll need the **absolute path** to your compiled `mcp-datetime-server` executable if running locally. **Example for local execution:** Assuming your executable `mcp-datetime-server` is located at `/Users/youruser/path/to/project/mcp-datetime-server`: ```json { "mcpServers": { "utc-datetime-server": { "command": "/Users/youruser/path/to/project/mcp-datetime-server", "args": [], "env": {} } } } ``` * Replace `"/Users/youruser/path/to/project/mcp-datetime-server"` with the actual absolute path to your `mcp-datetime-server` executable. * `"utc-datetime-server"` is a friendly name you choose for this server configuration. For simplicity with `stdio` transport, **running the server locally is the most straightforward way to integrate with Cursor's MCP command configuration.** 4. **Save the configuration file.** 5. **Restart your AI assistant (Cursor) if necessary.** ## Testing the MCP Server Once the server is running and configured in your AI assistant (e.g., Cursor): 1. Open a chat with the assistant. 2. Ask a question that would invoke the tool. For example: `What is the current UTC datetime?` 3. The assistant should indicate that it needs to use the `current_utc_datetime` tool. 4. Grant permission if prompted. 5. The assistant should then display the current UTC date and time provided by your MCP server. Example output you might see from the assistant: `Current UTC datetime: 2023-10-27T10:30:00Z` (the actual datetime will vary).