Skip to content

Docs · Quickstart

Ask who governs any U.S. address, from your own app.

civic.bot answers one question well: who is my government? Give it an address, and it returns every government that covers that location, from the country down to the school district.

What it does

Finds every layer

Country, state, districts, county, city and school district, federal to local.

Names them the standard way

Each layer carries its Census GEOID and Open Civic Data ID. Your records join with everyone else's, with no lookup table to maintain.

Talks to AI assistants

civic.bot is an MCP server: the protocol AI assistants use to call tools. An assistant can answer "which school district am I in?" from public records instead of guessing.

Why it's worth it

For agency staff
Your website, your chatbot and your front desk give the same answer, from the same open record. Fix it once, and it's fixed everywhere.
For residents
They find the right office from their address, at any hour.
For developers
One open source of truth, instead of keeping your own list of governments and boundaries. No API key, and standard identifiers throughout.

How it fits together

  1. 1 Your app or assistant asks a question
  2. 2 civic.bot speaks MCP and shapes the answer
  3. 3 jurisdictional.org open data: Census boundaries, the .gov registry, community edits
See the answer in your browser

Same data, no code: 300 Hemlock St, Vacaville, CA.

Step 1

Ask who governs an address

Send one JSON-RPC request to the MCP endpoint. The tool is who_governs.

POST https://civic.bot/mcp/message

curl -X POST https://civic.bot/mcp/message \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "who_governs",
      "arguments": { "address": "300 Hemlock St, Vacaville, CA" }
    }
  }'

It answers with the stack, federal to local (trimmed here):

{
  "address": "300 Hemlock St, Vacaville, CA",
  "layers": [
    { "name": "United States of America", "level": "federal",
      "geoid": "US", "ocd_id": "ocd-division/country:us" },
    { "name": "California", "level": "state",
      "geoid": "06", "ocd_id": "ocd-division/country:us/state:ca" },
    …
    { "name": "Vacaville", "level": "place", "geoid": "0681554",
      "ocd_id": "ocd-division/country:us/state:ca/place:vacaville" },
    { "name": "Vacaville Unified School District",
      "level": "school_district_unified", "geoid": "0640590", … }
  ],
  "not_mapped_yet": ["Special district"]
}

The answer arrives as JSON text in result.content[0].text. Parse it to get the layers.

Step 2

See all nine tools

MCP clients call initialize once, then tools/list.

curl -X POST https://civic.bot/mcp/message \
  -H 'Content-Type: application/json' \
  -d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {} }'
  • who_governs start here

    Every government at an address or point, with GEOID and OCD-ID

  • search_jurisdictions

    Find a government by name

  • get_jurisdiction

    One government, with its parents

  • search_agencies

    Find departments and agencies

  • get_agency

    One agency, with its services and officials

  • search_services

    Find permits, benefits and other services

  • get_service

    One service in detail

  • search_officials

    Find officials by name or title

  • get_official

    One official in detail

The initialize request
curl -X POST https://civic.bot/mcp/message \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "clientInfo": { "name": "my-app", "version": "1.0.0" }
    }
  }'

Step 3

Call it from your code

Python

import json
import requests

def call_civic_bot(tool, arguments):
    response = requests.post(
        "https://civic.bot/mcp/message",
        json={
            "jsonrpc": "2.0",
            "id": 1,
            "method": "tools/call",
            "params": {"name": tool, "arguments": arguments},
        },
    )
    result = response.json()["result"]
    if result.get("isError"):
        raise RuntimeError(result["content"][0]["text"])
    return json.loads(result["content"][0]["text"])

stack = call_civic_bot("who_governs", {"address": "300 Hemlock St, Vacaville, CA"})
for layer in stack["layers"]:
    print(layer["level"], layer["name"], layer["ocd_id"])

JavaScript

async function callCivicBot(tool, args) {
  const response = await fetch("https://civic.bot/mcp/message", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      jsonrpc: "2.0",
      id: 1,
      method: "tools/call",
      params: { name: tool, arguments: args },
    }),
  });
  const { result } = await response.json();
  if (result.isError) throw new Error(result.content[0].text);
  return JSON.parse(result.content[0].text);
}

const stack = await callCivicBot("who_governs", { address: "300 Hemlock St, Vacaville, CA" });
console.log(stack.layers.map((l) => l.name).join(" → "));

Elixir

defmodule CivicBotClient do
  def call_tool(tool, arguments) do
    {:ok, response} =
      Req.post("https://civic.bot/mcp/message",
        json: %{
          jsonrpc: "2.0",
          id: 1,
          method: "tools/call",
          params: %{name: tool, arguments: arguments}
        }
      )

    case response.body["result"] do
      %{"isError" => true, "content" => [%{"text" => text}]} -> {:error, text}
      %{"content" => [%{"text" => text}]} -> {:ok, Jason.decode!(text)}
    end
  end
end

{:ok, stack} = CivicBotClient.call_tool("who_governs", %{address: "300 Hemlock St, Vacaville, CA"})
Enum.map(stack["layers"], & &1["name"])

When something goes wrong

Check two places. A protocol error (an unknown method, bad JSON) comes back as a JSON-RPC error.

{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found"}}

A tool error (no address, nothing found) comes back as a normal result with isError: true. Always check it before you parse.

{"result":{"content":[{"type":"text","text":"Error: Give an address, or lat and lng."}],"isError":true}

Next