VS Code with GitHub Copilot

VS Code with GitHub Copilot Integration Guide

This guide explains how to configure VS Code and GitHub Copilot to use the TomTom Traffic Analytics MCP Server for traffic analysis queries.

Prerequisites

  • VS Code installed with the GitHub Copilot extension
  • Node.js 22.9.0 or higher and TomTom API keys. See Quick Setup for details

Setup

  1. Create or edit the file .vscode/mcp.json in your workspace:

    1{
    2 "servers": {
    3 "tomtom-traffic-analytics": {
    4 "type": "stdio",
    5 "command": "npx",
    6 "args": ["-y", "@tomtom-org/tomtom-traffic-analytics-mcp@latest"],
    7 "env": {
    8 "TOMTOM_MOVE_PORTAL_KEY": "your_move_portal_key",
    9 "TOMTOM_API_KEY": "your_tomtom_developer_key"
    10 }
    11 }
    12 }
    13}

    Replace the API key values with your actual keys. Omit TOMTOM_API_KEY if you only need junction, route, and area analytics tools.

    If you want to connect to a separately-running HTTP instance (see HTTP Transport), use this shape instead:

    1{
    2 "servers": {
    3 "tomtom-traffic-analytics": {
    4 "type": "http",
    5 "url": "http://localhost:3000/mcp"
    6 }
    7 }
    8}
  2. Restart VS Code or reload the window (Ctrl+Shift+P → "Developer: Reload Window").

  3. You can see the TomTom Traffic Analytics tools in the GitHub Copilot tools menu.

Test the Integration

Ask GitHub Copilot a traffic analytics question to verify the setup:

Which of my monitored routes have the highest delay percentage right now?

If configured correctly, Copilot will use the tomtom-route-search tool with a SQL query to calculate and rank route delays.

What to Try Next

Once the connection is working, try these prompts to explore what's possible:

Show me all active junctions and their countries
Analyze morning rush hour congestion in central Amsterdam over the past two weeks
Compare traffic incidents between downtown Amsterdam and Schiphol Airport area

For more workflows with full prompts and expected responses, see the Example Use Cases.

Using Environment Variables

To avoid hardcoding API keys in your workspace configuration, you can reference environment variables. Set them in your shell profile:

macOS / Linux:

export TOMTOM_MOVE_PORTAL_KEY="your_move_portal_key"
export TOMTOM_API_KEY="your_tomtom_developer_key"

Windows (PowerShell):

$env:TOMTOM_MOVE_PORTAL_KEY="your_move_portal_key"
$env:TOMTOM_API_KEY="your_tomtom_developer_key"

Then reference them in your mcp.json:

1{
2 "servers": {
3 "tomtom-traffic-analytics": {
4 "type": "stdio",
5 "command": "npx",
6 "args": ["-y", "@tomtom-org/tomtom-traffic-analytics-mcp@latest"],
7 "env": {
8 "TOMTOM_MOVE_PORTAL_KEY": "${env:TOMTOM_MOVE_PORTAL_KEY}",
9 "TOMTOM_API_KEY": "${env:TOMTOM_API_KEY}"
10 }
11 }
12 }
13}

Troubleshooting

ProblemPossible Fix
Tools not appearingReload the VS Code window after saving mcp.json
Connection errorsCheck the VS Code Output panel (select "MCP" from the dropdown) for detailed logs

For other common issues, see Quick Setup > Common Issues.

Next Steps