Skip to main content
Glama
Houston Open Data MCP

Houston Open Data MCP

by Sandysmile

Houston Open Data MCP

An MCP server that lets an AI assistant search and read public data from the City of Houston Open Data portal, which runs on CKAN.

Built from the GSA MCP hackathon template as a Dataset Access Server. It is read-only, and it needs no key or sign-in.

Disclaimer Hackathon prototype built on the City of Houston's public open data portal. This is an independent project and not an official City of Houston service. Answers reflect published datasets and may be incomplete or out of date — verify anything important against the source dataset.

Why it matters

People already ask AI about city services. This project tests whether AI can actually use Houston's open data to answer them. With the same AI and the same question, the answer goes from generic (no MCP), to grounded in City datasets (Ask Houston), to specific to your address (Ask Houston+).

Evaluation (November 2026): 8 known-answer questions, including one the portal can't answer, asked in two agent configurations. Each matched 7 and was partial on 1 (question 3: the district-dataset count is a lower bound); the Streamlit app also made one error in supporting detail, recorded separately. 80 live tool calls with 0 errors; 81 of 81 unit tests passing (November 16, 2026). The test also exposed metadata gaps worth fixing. See eval/EVALUATION.md.

Related MCP server: Calgary Open Data MCP Server

Works with any MCP client

This is a standard MCP server: any MCP client can connect, over stdio locally or stateless HTTP at /api/mcp. It was tested with Claude Desktop; the Streamlit demo app uses Claude. The server itself is not tied to any one AI vendor.

Design approach: built as an experiment

The server is designed to answer a question, not only to serve data: can AI actually use our open data, and where does it fail?

Design idea

How the code delivers it

A fair comparison. One server, two versions, same AI, same questions, so the only difference is the data.

One setting, USE_ARCGIS in config.py, turns Ask Houston into Ask Houston+

MCP as an AI-readiness test. Comparing answers with and without MCP shows which datasets AI can't use, and why.

scripts/run_eval.py collects known answers from the live tools; eval/EVALUATION.md scores the agent against them

Questions that probe failure. The test set includes data the portal doesn't have, so the agent must say so instead of guessing.

Question 5 (employee commute time); every tool returns an error with a fix-it hint

City data as the key to national data. The City's own list of 118 ZIP codes turns National Weather Service and EPA AirNow data into Houston answers.

src/houston_opendata/data/houston_zip_centroids.csv, used by conditions.py

Tools shaped like the questions people ask.

8 tools built around questions; houston_query_records counts and totals on the server; tool_docs.py gives every client the same descriptions

Tested in two agent configurations.

The same 8 questions in Claude Desktop (an MCP client, over stdio) and the Streamlit app's chat agent (the same tool functions, called directly); 7 matched and 1 partial in each

The evaluation found problems in three layers, data sources, tools and deployment, and each became a recommendation for the City's open data program.

Data sources, MCP design and deployment all matter. The data sources decide what the AI can know; the design of the tools and the choice of deployment decide how well it uses that data.

Architecture

flowchart TD
    subgraph IN["Ways in"]
        CD["Claude Desktop<br/>MCP client, stdio"]
        ANY["Any MCP client<br/>HTTP at /api/mcp"]
        ST["Streamlit app<br/>calls tools directly"]
    end

    subgraph SRV["Ask Houston MCP server (FastMCP, app.py)"]
        T["8 tools<br/>5 + 3 in Ask Houston+ (USE_ARCGIS)"]
        PR["2 prompts, 2 resources"]
        PY["Pydantic inputs (models.py)<br/>shared descriptions (tool_docs.py)"]
    end

    subgraph CON["Read-only connectors"]
        P["portal.py<br/>allow-listed CKAN read actions"]
        G["gis.py<br/>4 fixed City GIS layers"]
        C["conditions.py<br/>NWS + AirNow via 118 City ZIP codes"]
    end

    GR["Guardrails (utils.py): fixed origins, no redirects,<br/>5 MB response cap, sanitized errors"]

    subgraph SRC["Public data sources"]
        OD["City of Houston Open Data Portal<br/>data.houstontx.gov"]
        GIS["City GIS layers<br/>ArcGIS Online"]
        NWS["National Weather Service"]
        AQ["EPA AirNow"]
    end

    CD --> SRV
    ANY --> SRV
    ST -. "direct function calls, not MCP" .-> SRV
    SRV --> P & G & C
    P & G & C --> GR
    GR --> OD & GIS & NWS & AQ

Each layer has one job, so it can be read and tested on its own:

  • Ways in. Claude Desktop connects over stdio; any other MCP client can connect over stateless HTTP at /api/mcp. The Streamlit app calls the same tool functions directly, which is why the evaluation compares two agent configurations rather than two MCP clients.

  • Server. Tools are built around the questions people ask, not one per API endpoint. Every input is a validated Pydantic model, and both ways in read one shared set of tool descriptions.

  • Connectors. Each upstream service has one read-only client. Upstream addresses are fixed in code, so no tool accepts a URL from the caller.

  • Guardrails. All requests share the same limits, and errors return a fix-it hint instead of raw upstream output.

  • Data. Everything is public. The server stores no user data and has no write actions.

Tools

Each tool answers a question a person or agent actually asks, rather than mirroring one portal endpoint. Inputs are validated with Pydantic models (models.py); bad values in the right shape come back with a fix-it hint.

Tool

Question it answers

What it combines

houston_search_datasets

Is there data on this subject?

Keyword, department and topic filters in one search

houston_browse_catalog

What does the portal cover, and who publishes the most?

Department and topic listings, paged past the portal's 25-item cap, ranked

houston_get_dataset

What's in this dataset, and which table should I query?

Dataset metadata + column lists and row counts for up to 6 tables, read in parallel; picks the newest table

houston_describe_table

How are values written in this table?

Columns, row count and sample rows, so exact-match filters work

houston_query_records

Which records match? How many, or how much, by group?

Rows mode, or summary mode: counts, sums and averages over up to 100,000 rows, computed on the server

With USE_ARCGIS=true, the server adds three more tools:

Tool

Question it answers

houston_lookup_address

Who represents me, and what neighborhood am I in? Matches the address to City address points, then checks city limits, council district and super neighborhood layers in parallel: one call instead of five GIS queries. An exact match wins; if several addresses fit, it returns the choices to ask the user about

houston_weather_forecast

Should I plan around the weather? NWS forecast plus active alerts (such as flood warnings), joined to the City's own ZIP list (no key needed)

houston_air_quality

Is the air healthy right now? EPA AirNow current reading and forecast, joined to the City's ZIP list (needs AIRNOW_API_KEY)

Both ZIP code tools use src/houston_opendata/data/houston_zip_centroids.csv: the 118 ZIP codes fully or partially within the City (from the open data portal), each with a center point from the Census Bureau's 2026 ZCTA Gazetteer.

The server also offers two prompts (explore_houston_topic, compare_by_geography) and two resources (houston://info/server, houston://docs/join-keys).

Run it on your computer

Install uv, then, in PowerShell or any terminal:

uv sync --group dev
uv run pytest tests/ -v
uv run streamlit run streamlit_app.py

The page opens at http://localhost:8501 and the MCP endpoint is http://localhost:8501/api/mcp. Check the endpoint from a second terminal:

uv run python scripts/smoke_test.py http://localhost:8501/api/mcp

To run it as a local stdio server for Claude Code instead, use uv run python main.py.

Chat agent

The page's Ask tab is a chat agent that uses Claude and the same read-only tools. It needs ANTHROPIC_API_KEY and APP_PASSWORD, set as Streamlit secrets or locally in .streamlit/secrets.toml, which Git ignores. Copy .streamlit/secrets.toml.example to start. API usage is billed separately from a Claude plan.

Ask Houston and Ask Houston+

One codebase runs as two apps, so the only difference between them is the data:

App

USE_ARCGIS

Data sources

Ask Houston

"false" (default)

Open Data Portal

Ask Houston+

"true"

Open Data Portal + City GIS address lookup + weather (NWS) and air quality (AirNow) by ZIP code

Set USE_ARCGIS in each Streamlit app's secrets. The City GIS layers are fixed in src/houston_opendata/gis.py: site addresses, city limits, council districts, and super neighborhoods. For air quality, also add AIRNOW_API_KEY to Ask Houston+'s secrets; a free key comes from https://docs.airnowapi.org. Both apps also give the agent today's date in Houston time.

Host it

See deploy/streamlit/README.md. One process serves the Streamlit page at / and MCP at /api/mcp. Streamlit Community Cloud may block outside MCP clients, so test it with scripts/smoke_test.py.

Repo layout

streamlit_app.py            # Streamlit host: page + /api/mcp
Dockerfile.streamlit        # Same host, in a container
main.py                     # Local stdio entry point
src/houston_opendata/
├── app.py                  # Builds FastMCP, picks the transport
├── portal.py               # Read-only CKAN client, shared by the tools and the page
├── gis.py                  # Read-only City GIS client for Ask Houston+
├── conditions.py           # Weather (NWS) and air quality (AirNow) by ZIP code
├── data/                   # Houston ZIP codes with center points
├── page.py                 # Streamlit page
├── config.py, models.py, utils.py, routes.py
├── tools/                  # One file per tool
├── prompts/
└── resources/
scripts/smoke_test.py       # Checks a running server with a real MCP client
scripts/run_eval.py         # Collects known answers and response times
tests/                      # Tests that run without network access
eval/EVALUATION.md          # Evaluation write-up for the hackathon submission
eval/results.md             # Raw output of scripts/run_eval.py
deploy/streamlit/           # Hosting guide

Add a tool

Create src/houston_opendata/tools/my_tool.py with a register(mcp) function, then call it from tools/__init__.py. Put any portal call in portal.py.

Security

  • Tools use only allow-listed CKAN read actions. There is no SQL endpoint and no write action.

  • The portal and City GIS addresses come from server code and configuration, never from a tool argument.

  • Identifiers are validated before any request, and upstream errors are sanitized.

  • The endpoint has no authentication, which suits public data. Review your agency's requirements before using it beyond the hackathon.

License

MIT. See SECURITY.md.

Available Tools

6 tools
houston_describe_tableDescribe a Houston tableA
Read-onlyIdempotent

List a queryable resource's columns, types, and total row count.

Call this before houston_query_records so that filters, column lists, and sorting use real column names. Only works when queryable is true.

Inputs: resource_id (required). Returns: object

houston_get_datasetGet a Houston datasetA
Read-onlyIdempotent

Get a dataset's description, owner, license, and resources.

A dataset can hold several resources (for example one per year). Each resource reports queryable: when true, use its id with houston_describe_table and houston_query_records; when false, use its download_url. last_modified gives the resource's as-of date.

Inputs: dataset (required). Returns: object

houston_list_groupsList Houston topic groupsA
Read-onlyIdempotent

List the portal's topic groups and their dataset counts.

Use a group's name as the group filter in houston_search_datasets.

Inputs: no named parameters. Returns: object

houston_list_organizationsList Houston organizationsA
Read-onlyIdempotent

List publishing organizations (departments) and their dataset counts.

Use an organization's name as the organization filter in houston_search_datasets.

Inputs: no named parameters. Returns: object

houston_query_recordsQuery Houston recordsA
Read-onlyIdempotent

Read rows from a queryable resource, with filters and pagination.

Returns at most 100 rows per call. Use total to count matches without paging through them, for example with a limit of 1. There is no server-side aggregation, so for sums or averages over many rows, page through next_offset. Very long text values are truncated.

Inputs: resource_id (required), sort, text, columns, +2 more. Returns: object

houston_search_datasetsSearch Houston datasetsA
Read-onlyIdempotent

Search City of Houston open datasets by keyword, department, or topic.

Start here. Each result's metadata_modified shows when its catalog entry last changed; update frequency varies by dataset. Results include harvested GIS datasets. Pass a result's name to houston_get_dataset.

Returns datasets with total, has_more, and next_offset, or an error with a hint.

Inputs: group, query, pagination, organization. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct step of the same workflow: search → get dataset → describe table → query records, plus two facet-listing tools. The only superficially similar pair (list_organizations vs list_groups) is clearly differentiated by descriptions that explain which filter each name feeds into. No two tools could be reasonably confused.

    Naming Consistency5/5

    Every tool follows a uniform `houston_verb_noun` pattern (search_datasets, get_dataset, describe_table, list_organizations, query_records, list_groups) in snake_case throughout. The verb choice also consistently signals the operation type (search/get/describe/list/query).

    Tool Count5/5

    Six tools is tightly scoped for an open-data catalog: discovery, metadata retrieval, schema inspection, querying, and two facet listings. Every tool has an explicit role in the documented workflow and none appear redundant.

    Completeness4/5

    The core lifecycle (find → inspect → describe → query) is fully covered, including pagination and row counts, and non-queryable resources are handled via download_url. Minor gap: no dedicated tool to fetch or preview a resource download, and no aggregation, though both are documented workarounds rather than dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      A
      maintenance
      Enables AI assistants to search, explore, and query any CKAN open data portal through natural language, making public datasets accessible without requiring knowledge of the portal's API.
      20
      1,648 npm
      82
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables querying Austin, TX open data from data.austintexas.gov using the Socrata SODA API, allowing AI agents to access municipal datasets through natural language.
      74 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Provides AI assistants with plain-English access to official Houston-area public data including weather alerts and school ratings, no API keys required.
      3
      1
      Apache 2.0