Extending VS Code's AI: A Guide to Time MCP Servers Explained in 5 Minutes
This is the first in a series of articles about MCP servers. This article is an introduction to what MCP servers are and what we can do with them. We will learn how to extend the AI capabilities of Visual Studio Code with a time MCP server.
What is MCP?
MCP stands for Model-Context Protocol. It is an open standard developed by Anthropic, the company behind Claude models. It's an open protocol that enables seamless integration between AI apps and agents and your tools and data sources.
Prerequisites
To follow along with this guide, you'll need: - Visual Studio Code (latest version recommended) - A GitHub account - The GitHub Copilot Chat extension for VS Code - Docker Desktop
Setting Up a Local Time MCP Server
First, launch your Docker Desktop application.
Next, in a working directory of your choice, create a new folder to house our localized MCP server.
mkdir time-mcp-server
cd time-mcp-server
Now, open this newly created folder in VS Code. The folder will be empty.
A quick inspection of your VS Code extensions should show that you have both GitHub Copilot and GitHub Copilot Chat installed. Installing the chat extension adds a new icon to your activity bar. Click on it to open the chat window.
In the chat window, you need to enable agent mode and select one of the Claude models (e.g., Claude 3 Sonnet). While GPT-4.1 also works, the latest Claude models are preferred for this task. This combination enables a "Tools" icon. Clicking it reveals the various tools installed in your Visual Studio Code—there are numerous of them.
Configuring MCP in VS Code
Let's look at the VS Code settings. Click the gear icon at the bottom and choose Settings. In the search filter, enter MCP
. You will see a couple of experimental MCP settings.
If you click on Edit in settings.json, you'll see the configuration file. Pay attention to the line chat.mcp.discovery.enabled
, which should be set to true
. This allows your VS Code to discover MCP servers.
Now, let's configure the time MCP server. At this time, a suitable place to discover these servers is the official GitHub repository: github.com/model-context-protocol/servers
.
In your browser, navigate to that site and search for the "time" server. This will lead you to a link under the "Reference Servers" section. The description for the time server is "Time and timezone conversion capabilities." We'll use this MCP server because AI models like GPT-4 have knowledge that was frozen in the past and cannot provide the current time.
Click on the "time" link to explore it.
Installing the Server via Docker
An easy way to use this server is via Docker. The page indicates the Docker image name we'll need: mcp/time
.
Let's set it up in VS Code:
1. Open the Command Palette (Ctrl+Shift+P
or Cmd+Shift+P
).
2. Type and select MCP: Add Server
.
3. Choose Docker Image
as the installation source.
4. Enter the Docker image name we found earlier: mcp/time
.
5. A prompt will ask if you want to allow this MCP server. Click Allow.
6. It will then ask for a server ID. The default, time
, is fine.
7. You'll be asked whether to install the server globally or just for the current workspace. For this experiment, choose Workspace.
8. Finally, a popup will ask if you trust the "time" MCP server. Click Yes.
At this point, VS Code creates a .vscode
folder in your workspace containing a file named mcp.json
. The server should already be running. You can stop or restart it from this file's interface.
Behind the scenes, a new container named mcp-time
is now running in your Docker Desktop.
Interacting with the Time MCP Server
You can now start using the server. In the Copilot Chat window, ask:
what is the current time
The AI will detect the new tool and respond that it will use the time
MCP server to check. It will call a method named get_current_time
. Click Continue.
The result will be displayed, for example: The current time is 12:37 AM UTC.
Since converting from UTC can be tedious, you can ask for a conversion directly:
what is it in the Pacific time zone
The AI will correctly identify the time zone and provide the converted time, for instance: The time in this particular time zone is 5:37.
You can also ask for the time in any other city or country:
what is the time in Timbuktu
The AI will detect that Timbuktu is in Mali (West Africa) and use the appropriate time zone (Africa/Bamako). After you click Continue, it will return the local time, for example: The time in Timbuktu at the moment is 12:39 AM.
You can even ask it to refresh the time, and it will provide the updated value, demonstrating its real-time capability.
Conclusion
This article serves as a basic introduction to MCP servers and demonstrates how you can easily extend the functionality of your AI assistant within VS Code. By integrating simple, containerized tools, you can overcome the inherent limitations of large language models, such as their inability to access real-time data.
Future articles in this series will delve into more advanced topics and explore other powerful MCP servers.
Join the 10xdev Community
Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.