distance-calculator-mcp

sp13ceg/distance-calculator-mcp

3.1

If you are the rightful owner of distance-calculator-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Distance Calculator MCP server calculates the distance between two locations using the Google Distance Matrix API.

Distance Calculator MCP server

This project calculates the distance between two locations using the Google Distance Matrix API.

Setup

  1. Install the dependencies:

    pip install -r requirements.txt
    
  2. Create a config.ini file in the root of the project with the following content:

    [google]
    api_key = YOUR_API_KEY
    

    Replace YOUR_API_KEY with your actual Google Distance Matrix API key.

Running the Application

  1. Start the server:

    uvicorn main:app --reload
    
  2. The API will be available at http://127.0.0.1:8000.

API Usage

Send a POST request to /distance with a JSON payload like this:

{
  "origin": {
    "location": "90210"
  },
  "destination": {
    "location": "New York, NY"
  }
}

Running the MCP Server

  1. Make sure you have configured your API key in config.ini as described in the "Setup" section.

  2. Start the MCP server:

    python mcp_server.py
    
  3. The MCP server will be available at http://127.0.0.1:8001.

Example with gemini CLI Distance Calculator Example