Skip to main content

Use the Mailwoman MCP server

Use this procedure to give an MCP client, such as a coding assistant or an agent, Mailwoman's parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates. and geocode operations as tools. @mailwoman/mcp runs as a stdio server: the client starts it as a child process and exchanges messages over its standard input and output.

Prerequisites​

  • Node.js ^24.22.3 || >=26.13.1
  • ECMAScript module project with "type": "module" in its package.json
  • Install the server with the parser packages:

    sh
    npm install mailwoman @mailwoman/mcp

    The MCP server loads the parser and the place resolverresolverThe component that converts parsed address components (locality, region, postcode) into coordinates by looking them up in the gazetteer. The resolver ranks candidates by name match, population, and proximity, and returns the best-matching place with its centroid or polygon. together, so its parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates. and geocode tools need the global place candidates, even for a parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates.. Install them, plus address pointssitus dataA dataset of exact address-point coordinates (rooftop-level). Mailwoman's geocoder uses a national situs layer (124.9M US points built from state address-point sources) as the highest-precision tier of the geocode cascade. for the places you'll geocode. The example geocodes a Washington, DC address:

    sh
    export MAILWOMAN_DATA_ROOT="$HOME/mailwoman-data"

    npx mailwoman data pull candidate
    npx mailwoman data pull us --only us-dc

    The output below was captured with local builds of these bundlesevidence bundleThe pair of retrieval-augmented input channels (street-type + locality-surface) that feed lexicon membership as soft per-token evidence alongside the text. Shipped in 6.7.0; trained natively from step 0 in the from-scratch base line. that are newer than the 11.0.0 registry entries.

    1. Register the server with your client​

    The server's command is mailwoman-mcp. Clients that read an mcpServers JSON configuration take an entry of this shape:

    json
    {
    "mcpServers": {
    "mailwoman": {
    "command": "npx",
    "args": ["mailwoman-mcp"],
    "env": { "MAILWOMAN_DATA_ROOT": "/home/you/mailwoman-data" }
    }
    }
    }

    Set MAILWOMAN_DATA_ROOT to your data directory as an absolute path, because a client may start the server without your shell's environment. If the client starts the server outside the project where you installed it, give the full path to node_modules/.bin/mailwoman-mcp as command. Each client keeps this configuration in its own place, given in its documentation. The server was checked with the MCP TypeScript SDK client in step 2. No assistant's own configuration was tested.

    2. Check the server with one call​

    Install the MCP TypeScript SDK and save this script as mcp-check.ts. It starts the server the way a client does, lists the tools, and calls the parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates. and geocode tools:

    sh
    npm install @modelcontextprotocol/sdk@1.32.2
    ts
    import { Client } from "@modelcontextprotocol/sdk/client/index.js"
    import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"
    import { CallToolResultSchema } from "@modelcontextprotocol/sdk/types.js"

    // Pass the shell's environment, including MAILWOMAN_DATA_ROOT, to the server.
    const env: Record<string, string> = {}

    for (const [key, value] of Object.entries(process.env))
    if (value != null) {
    env[key] = value
    }

    const transport = new StdioClientTransport({ command: "npx", args: ["mailwoman-mcp"], env, stderr: "ignore" })
    const client = new Client({ name: "mcp-check", version: "1.0.0" })

    await client.connect(transport)

    const { tools } = await client.listTools()

    console.log(`tools: ${tools.map((tool) => tool.name).join(", ")}`)

    for (const name of ["mailwoman_parse", "mailwoman_geocode"]) {
    const result = CallToolResultSchema.parse(
    await client.callTool({
    name,
    arguments: { text: "1600 Pennsylvania Avenue NW, Washington, DC 20500" },
    })
    )

    console.log(`\n${name} isError: ${result.isError ?? false}`)

    for (const part of result.content)
    if (part.type === "text") {
    console.log(part.text)
    }
    }

    await client.close()

    The transport's env option takes string values only, so the loop copies each variable that has one. CallToolResultSchema.parse checks the tool result's shape and gives result.content its type.

    sh
    node mcp-check.ts

    The first line lists the nine tools:

    text
    tools: mailwoman_parse, mailwoman_geocode, mailwoman_poi_search, mailwoman_overpass_export, mailwoman_layer_manifest, mailwoman_bdc_filing_landscape, mailwoman_plausibility_check, mailwoman_filer_lookup, mailwoman_filer_family

    Both calls return isError: false. The geocode call returns the same result object as mailwoman geocode. These are its first fields:

    json
    {
    "input": "1600 Pennsylvania Avenue NW, Washington, DC 20500",
    "components": {
    "region": "DC",
    "locality": "Washington",
    "postcode": "20500",
    "street": "Pennsylvania Avenue NW",
    "house_number": "1600"
    },
    "dropped_components": null,
    "unfollowed_components": null,
    "lat": 38.89767510742324,
    "lon": -77.03654697024702,
    "resolution_tier": "address_point",
    "epistemic_status": "observed",
    "uncertainty_m": 1,

    The parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates. call returns the full parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates. pipelinestaged pipelineMailwoman's runtime architecture: a sequence of pure-function stages (normalize → query-shape → locale-hint → kind-classifier → phrase-grouper → classifier → decoder) connected by typed handoffs. Each stage is published as its own npm package. result: the normalized text, query shapequery shapeStage 1.5 of the runtime pipeline: computes a structural fingerprint of the input — script class, segmentation, known-format hits (postcode regexes, state abbreviations) — in microseconds without ML. Used by downstream stages for locale detection and kind classification., localelocaleThe combination of language and country an address comes from. en-US and fr-FR are the locales Mailwoman ships weights for., address kind (structured_address here), the tagged tree with character offsets, stagestageOne of the dataflow stages in the runtime pipeline (normalize, locale check, kind classify, phrase group, token classify, sequence correct, reconcile, resolve). Distinct from tier (model vocabulary) and phase (plan milestone). timings and faults. Both tools take their input as text. A call that passes another argument name, such as address, fails input validation with isError: true.

    3. Know which tools need local data​

    The server's message uses "gazetteergazetteerA geographical index that maps place names and postcodes to real-world coordinates. Mailwoman uses a custom-built Who's On First (WOF) SQLite database as its gazetteer — the 'atlas' half of the grammar/atlas architecture." for any resolverresolverThe component that converts parsed address components (locality, region, postcode) into coordinates by looking them up in the gazetteer. The resolver ranks candidates by name match, population, and proximity, and returns the best-matching place with its centroid or polygon. database: the candidate database or a Who's On FirstWOF (Who's On First). An open-source gazetteer of places maintained by Mapzen/whosonfirst. Mailwoman builds a custom SQLite database from WOF GeoJSON repos, extended with postcode data, importance scores, and coincident-role relations. database. If the server finds neither, the parseaddress parsingThe process of decomposing a free-text postal address string into structured components — house number, street name, locality, region, postcode, and country — so a geocoder can resolve them to coordinates. and geocode tools return isError: true with this message. The server process itself keeps running:

    text
    ✗ no gazetteer data found — the endpoint needs a resolver database to answer queries.

    Fastest path (worldwide resolution, population-first ranking, ~2.88 GB):
    mailwoman data pull candidate

    The full message ends with the server's own list of which tools need the gazetteergazetteerA geographical index that maps place names and postcodes to real-world coordinates. Mailwoman uses a custom-built Who's On First (WOF) SQLite database as its gazetteer — the 'atlas' half of the grammar/atlas architecture.:

    ToolData it needs
    mailwoman_parse, mailwoman_geocode, mailwoman_poi_search, mailwoman_overpass_exportThe gazetteergazetteerA geographical index that maps place names and postcodes to real-world coordinates. Mailwoman uses a custom-built Who's On First (WOF) SQLite database as its gazetteer — the 'atlas' half of the grammar/atlas architecture. in the data root. mailwoman_geocode also uses address pointssitus dataA dataset of exact address-point coordinates (rooftop-level). Mailwoman's geocoder uses a national situs layer (124.9M US points built from state address-point sources) as the highest-precision tier of the geocode cascade. for streetstreetThe named linear feature along which house numbers are ordered. Decomposes into a name plus street affixes; one of the Tier 2 fine labels. addresses.
    mailwoman_layer_manifest, mailwoman_bdc_filing_landscape, mailwoman_filer_lookup, mailwoman_filer_familyNo gazetteergazetteerA geographical index that maps place names and postcodes to real-world coordinates. Mailwoman uses a custom-built Who's On First (WOF) SQLite database as its gazetteer — the 'atlas' half of the grammar/atlas architecture.. Each one takes a path to the layerlayerOne transformer block — attention plus a feed-forward network, with normalization and residual connections — applied to every position. Stacking layers lets the model build up richer representations; Mailwoman's encoder has 6. database it reads.

    The server's message leaves mailwoman_plausibility_check out of both groups. That tool takes optional bdc_database_path and poi_database_path arguments and reports no evidence for a layerlayerOne transformer block — attention plus a feed-forward network, with normalization and residual connections — applied to every position. Stacking layers lets the model build up richer representations; Mailwoman's encoder has 6. it can't open. When it receives an address without a point, it geocodes the address. The documentation link in the published 11.0.0 message points to a page that's moved. The table above lists the same tool groups.

    mailwoman_parse also accepts poi: true to detect a point-of-interest request, such as a category or brand near a place. mailwoman_overpass_export builds an OverpassQL query string for such a request and never runs it.

    • Geocode a file of addresses explains the fields of a geocode result.
    • Inspect a parse explains the parse treeparse treeThe hierarchical address structure produced by decoding BIO labels into spans and nesting them per the schema's containment rules (house_number → street → locality → region → country). and its offsets.
    • Data and locales lists the data bundlesevidence bundleThe pair of retrieval-augmented input channels (street-type + locality-surface) that feed lexicon membership as soft per-token evidence alongside the text. Shipped in 6.7.0; trained natively from step 0 in the from-scratch base line..