All tutorials

MCP Address Validation: Integrate Swiftcomplete with Your AI Agent

intermediate

Swiftcomplete’s Model Context Protocol (MCP) server lets any LLM-powered agent call one endpoint and return a verified, fully-formatted address in milliseconds. This tutorial shows you how to plug it in with just an API key and a couple of lines of code.

See it in action

Watch Jen from the what3words team demonstrate how an AI customer service agent uses the Swiftcomplete MCP to instantly validate an address.

1Get a Swiftcomplete API key

Create a Swiftcomplete account (or sign in) if you’re already registered.

GET API KEY

2Access the MCP server

The Swiftcomplete MCP base URL is:

https://mcp.swiftcomplete.com/sse

You can inspect the MCP API using the OpenAPI manifest: https://mcp.swiftcomplete.com/openapi.yaml

You can import it into Postman, Swagger UI, or your favourite client for auto-generated docs and test calls.

3Add MCP server to your AI agent

You can use the OpenAPI spec directly to integrate the Swiftcomplete MCP endpoint into any AI agent framework that supports OpenAPI tool definitions.

Example request and response

  • Initialisation (Agent connects to our MCP)

Request

{"jsonrpc": "2.0","id": 1,"method": "server/initialize","params": {}}

Response

{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-06-18","serverInfo":{"name":"Swiftcomplete MCP Server","version":"0.1.0"},"capabilities":{"tools":{"listChanged":false}}}}

  • Tools/List (Agent finds out what our MCP can do)

Request

{"jsonrpc": "2.0","id": 2,"method": "tools/list","params": {}}

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "tools": [
      {
        "name": "validate_address_lines",
        "title": "Validate Address Lines",
        "description": "Validates and standardises an address provided as structured fields: addressLine1, locality, postalCode, country. Use this when the address is split into fields. If you only have a single free-form string, use validate_full_address instead.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "description": "Swiftcomplete API key."
            },
            "company": {
              "type": "string",
              "description": "Optional company name (e.g. 'Tesco Ltd')."
            },
            "addressLine1": {
              "type": "string",
              "description": "Building and street (e.g. '10 Downing Street')."
            },
            "addressLine2": {
              "type": "string",
              "description": "Optional flat/suite/apartment (e.g. 'Flat 2')."
            },
            "locality": {
              "type": "string",
              "description": "All locality information (e.g. suburb, town, city, district), separated by commas. (e.g. 'Westminster, London')."
            },
            "postalCode": {
              "type": "string",
              "description": "Postal/ZIP code (e.g. 'SW1A 1AA')."
            },
            "administrativeArea": {
              "type": "string",
              "description": "Optional state/province/county (e.g. 'Nottinghamshire')."
            },
            "country": {
              "type": "string",
              "description": "ISO 3166-1 alpha-2 country code (e.g. 'GB')."
            }
          },
          "required": ["key", "addressLine1", "country"]
        },
        "outputSchema": {
          "type": "object",
          "description": "Validation result for a postal address.",
          "properties": {
            "nextStep": {
              "type": "string",
              "description": "Recommended handling step for the result.",
              "enum": ["AUTO_ACCEPT", "AUTO_ACCEPT_WITH_CHANGES", "MANUAL_REVIEW", "REJECT"]
            },
            "type": {
              "type": "string",
              "description": "Result classification (e.g., 'MATCH' for a valid match, 'NONE' when no match was found)."
            },
            "address": {
              "type": ["string", "null"],
              "description": "Standardised, formatted address, split into address lines by newline characters (\\n). Null when not available."
            },
            "latitude": {
              "type": "number",
              "description": "Latitude in decimal degrees."
            },
            "longitude": {
              "type": "number",
              "description": "Longitude in decimal degrees."
            },
            "coordinateGranularity": {
              "type": "string",
              "description": "Coordinate granularity (e.g. 'postcode', 'building')."
            }
          },
          "required": ["nextStep"]
        }
      },
      {
        "name": "validate_full_address",
        "title": "Validate Full Address",
        "description": "Validates and standardises a full free-form address string. Use this if you only have a single string (e.g. '10 Downing Street London SW1A'). If your address is already split into structured components, use validate_address_lines instead for more accurate results.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "description": "Swiftcomplete API key."
            },
            "address": {
              "type": "string",
              "description": "Full address to validate (e.g. '10 Downing Street London SW1A')."
            },
            "country": {
              "type": "string",
              "description": "ISO 3166-1 alpha-2 country code (e.g. 'GB')."
            }
          },
          "required": ["key", "address", "country"]
        },
        "outputSchema": {
          "type": "object",
          "description": "Validation result for a postal address.",
          "properties": {
            "nextStep": {
              "type": "string",
              "description": "Recommended handling step for the result.",
              "enum": ["AUTO_ACCEPT", "AUTO_ACCEPT_WITH_CHANGES", "MANUAL_REVIEW", "REJECT"]
            },
            "type": {
              "type": "string",
              "description": "Result classification (e.g., 'MATCH' for a valid match, 'NONE' when no match was found)."
            },
            "address": {
              "type": ["string", "null"],
              "description": "Standardised, formatted address, split into address lines by newline characters (\\n). Null when not available."
            },
            "latitude": {
              "type": "number",
              "description": "Latitude in decimal degrees."
            },
            "longitude": {
              "type": "number",
              "description": "Longitude in decimal degrees."
            },
            "coordinateGranularity": {
              "type": "string",
              "description": "Coordinate granularity (e.g., 'postcode', 'building')."
            }
          },
          "required": ["nextStep"]
        }
      }
    ]
  }
}
Copied
  • Tools/Call (Agent picks one of our available tools, and calls it)

Recommended approach

Request (address already split into individual fields)

{"jsonrpc": "2.0","id": 3,"method": "tools/call","params": {"name": "validate_address_lines","arguments": {"key": "Swiftcomplete API key","addressLine1": "10 downing st","locality": "london","postalCode": "sw1a","country": "GB"}}}

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"nextStep\":\"AUTO_ACCEPT_WITH_CHANGES\",\"type\":\"MATCH\",\"address\":\"10 Downing Street\\nLONDON\\nSW1A 2AA\\nUnited Kingdom\",\"latitude\":51.491318,\"longitude\":-0.14165,\"coordinateGranularity\":\"postcode\"}"
      }
    ],
    "structuredContent": {
      "nextStep": "AUTO_ACCEPT_WITH_CHANGES",
      "type": "MATCH",
      "address": "10 Downing Street\nLONDON\nSW1A 2AA\nUnited Kingdom",
      "latitude": 51.491318,
      "longitude": -0.14165,
      "coordinateGranularity": "postcode"
    }
  }
}
Copied

Request (full address on one line)

{"jsonrpc": "2.0","id": 3,"method": "tools/call","params": {"name": "validate_full_address","arguments": {"key": "Swiftcomplete API key","address": "what3words alfred road london","country": "GB"}}}

{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"nextStep\":\"AUTO_ACCEPT_WITH_CHANGES\",\"type\":\"MATCH\",\"address\":\"What3words Ltd\\n65 Alfred Road\\nLONDON\\nW2 5EU\\nUnited Kingdom\",\"latitude\":51.521198,\"longitude\":-0.196334,\"coordinateGranularity\":\"postcode\"}"
      }
    ],
    "structuredContent": {
      "nextStep": "AUTO_ACCEPT_WITH_CHANGES",
      "type": "MATCH",
      "address": "What3words Ltd\n65 Alfred Road\nLONDON\nW2 5EU\nUnited Kingdom",
      "latitude": 51.521198,
      "longitude": -0.196334,
      "coordinateGranularity": "postcode"
    }
  }
}
Copied

Response:

Validated address: Great Western Studios
65 Alfred Road
LONDON
W2 5EU
United Kingdom

Note: Make sure you replace “YOUR-SWIFTCOMPLETE-API-KEY” with your Swiftcomplete API key

How your AI agent might benefit from Swiftcomplete:

  • Customer service assistants: Ensuring address info in chats is accurate before updating CRMs
  • Travel planners: Validating pick-up/drop-off points for smoother journeys
  • e-Commerce agents: Confirming customer shipping info at checkout in real-time
  • Voice-based assistants: Transcribing and resolving spoken address input into verified location data
  • CRM assistants: Sales and support teams can rely on AI agents to maintain clean, validated address data across customer records
  • Personal shopping assistants: validating delivery addresses to prevent fulfilment issues

mcp-integration

Note: To find out more our the benefits of our MCP server, you can read our blog and to learn about Swiftcomplete, visit our webpage.

4Troubleshooting

Need help, or have any questions? If your AI agents handle addresses, don’t leave accuracy to chance. Swiftcomplete’s MCP server makes it effortless to deliver reliable, instant validation, all with a single, powerful integration.

If you need any help getting started or to learn more about Swiftcomplete and our MCP, reach out to our customer support team at support@swiftcomplete.com.

Server and ScriptingAdd a 3 word address input fieldUse 3 word addresses within an address search.NETAndroidDartFlutterGoJavaJavaScriptNodeJSPHPPythonRubyRustSwiftSwiftComplete

Related tutorials