# Data.gov Catalog Search MCP Server (`rl1987/datagov-catalog-mcp-server`) Actor

MCP server exposing search over catalog.data.gov (dataset search, organization/publisher/keyword/place suggestions, dataset detail).

- **URL**: https://apify.com/rl1987/datagov-catalog-mcp-server.md
- **Developed by:** [R.L.](https://apify.com/rl1987) (community)
- **Categories:** MCP servers, Developer tools
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 price for completing a tool calls

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### Data.gov Catalog Search MCP Server

An [MCP](https://modelcontextprotocol.io) server that exposes dataset search on [catalog.data.gov](https://catalog.data.gov/?q=) to AI agents as tools — full-text dataset search plus organization, publisher, keyword, and geographic-area filtering, matching the [catalog.data.gov search form](https://catalog.data.gov/?q=). Built on [FastMCP](https://gofastmcp.com) and deployed as an [Apify Actor](https://docs.apify.com/platform) in Standby mode, so it runs as a persistent HTTP endpoint rather than a one-shot batch job.

#### Why use this?

catalog.data.gov has no public dataset-search API — its `/api/3/action/*` CKAN endpoints are disabled. Anyone wanting to search it programmatically has to hand-roll HTML scraping and reverse-engineer its filter form. This server does that work once: it wraps the site's search results, its internal autocomplete endpoints (organization, publisher, keyword, place), and per-dataset detail pages into MCP tools an agent can call directly. Running it on Apify gives you a hosted, always-on endpoint with API-token auth and usage-based billing, instead of self-hosting a scraper.

#### How to use

1. If you don't have one, create a free [Apify account](https://console.apify.com/sign-up) and grab your API token from [console.apify.com/settings/integrations](https://console.apify.com/settings/integrations).
2. Open this Actor's page in Apify Console and copy its MCP endpoint URL from the API tab (it looks like `https://rl1987--datagov-catalog-mcp-server.apify.actor/mcp`).
3. Connect your MCP client (Claude Code, Claude Desktop, an agent framework, etc.) to that URL over Streamable HTTP, passing your Apify API token as a Bearer token — see **Connect to Claude Code** below for the exact command.
4. Call `search_datasets`, `get_dataset`, or one of the `suggest_*` tools from your agent. You're billed per completed tool call — see **Pricing**.

#### Connect to Claude Code

With the Actor's MCP endpoint URL and your Apify API token from above, run:

```
claude mcp add --transport http datagov-catalog https://rl1987--datagov-catalog-mcp-server.apify.actor/mcp \
  --header "Authorization: Bearer <YOUR_APIFY_API_TOKEN>"
```

Replace `<YOUR_APIFY_API_TOKEN>` with your own Apify API token — not the Actor owner's.

This adds the server at `local` scope (private, current project only). Add `--scope user` instead to make it available in every project on your machine.

Verify it connected: run `claude mcp list`, or type `/mcp` in an interactive Claude Code session — `datagov-catalog` should show as connected with 10 tools.

Try it: ask Claude "find EPA drinking-water datasets in California" or "what keywords does data.gov use for water-quality datasets?" — it will call the tools directly.

Remove it later with `claude mcp remove datagov-catalog`.

If you're on a team and want everyone to pick up this server automatically, commit a `.mcp.json` with just the URL (never the token) to your repo root:

```
{
  "mcpServers": {
    "datagov-catalog": {
      "type": "http",
      "url": "https://rl1987--datagov-catalog-mcp-server.apify.actor/mcp"
    }
  }
}
```

Each teammate then runs the `claude mcp add ... --scope local` command above once with their own token, which layers on top of the shared `.mcp.json` config without ever touching the repo.

#### Input

No Actor input is required to start the server — it runs in Standby mode and accepts MCP tool calls directly over HTTP.

#### Tools

- **search_datasets** — search datasets by free-text query plus organization, organization type, publisher, keyword, and geographic-area filters. Cursor-paginated.
- **get_dataset** — fetch full detail for one dataset (schema.org JSON-LD plus resource/download links) by its dataset id/slug.
- **suggest_organizations** — autocomplete publishing organizations by name, for use as `search_datasets(organization_slug=...)`.
- **suggest_publishers** — autocomplete publishers by name, for use as `search_datasets(publisher=...)`.
- **suggest_keywords** — autocomplete keywords/tags, for use in `search_datasets(keywords=[...])`.
- **suggest_places** — autocomplete geographic places (states, counties, etc.), resolving a place name to the `location_id` used by `search_datasets(location_id=...)`.
- **list_organization_types** — the fixed set of organization-type values (e.g. `Federal Government`).
- **list_metrics_organizations** — the organizations selectable in the [data.gov/metrics/](https://data.gov/metrics/) dropdown, for use as `organization_slug` in `get_organization_metrics`.
- **get_sitewide_metrics** — data.gov's sitewide usage metrics (pageviews, device breakdown, most downloaded files, most clicked outbound links, datasets/harvest-sources per organization), with every table's CSV download link and per-row links.
- **get_organization_metrics** — one organization's usage metrics (most viewed dataset pages, most downloaded files, most clicked outbound links), e.g. from [data.gov/metrics/organization/fcc/index.html](https://data.gov/metrics/organization/fcc/index.html).

#### Output

Each tool returns structured JSON. Example `search_datasets` output:

```json
{
  "results": [
    {
      "title": "Drinking Water - Public Water System Information",
      "url": "https://catalog.data.gov/dataset/drinking-water-public-water-system-information",
      "dataset_id": "drinking-water-public-water-system-information",
      "organization": "State of California",
      "organization_slug": "california",
      "last_updated": "August 22, 2024 at 03:39 PM",
      "description": "Curated dataset of information for all public water systems (PWS) in California...",
      "formats": ["CSV", "PDF"],
      "search_relevance": 85.33
    }
  ],
  "total_matches": 10000,
  "total_is_lower_bound": true,
  "next_cursor": "Wzc4LjMwODM5NSwwLC...",
  "has_more": true
}
```

#### Pricing

This Actor uses [Pay Per Event](https://docs.apify.com/platform/actors/publishing/monetize#pay-per-event-pricing-model) pricing: a flat fee per completed tool call (see `.actor/pay_per_event.json`). There is no charge for failed calls or for connecting/idling.

#### Tips

- Resolve human-typed filter values first with `suggest_organizations` / `suggest_places` / `suggest_publishers` / `suggest_keywords`, then pass the returned slug/id into `search_datasets` — don't guess the exact organization or place name.
- The first page of `search_datasets` (no `cursor`) always returns up to 20 results regardless of `per_page`; pass the returned `next_cursor` back in to page further, where `per_page` takes effect.
- `total_matches` comes back with `total_is_lower_bound: true` above roughly 10,000 matches — the site itself only reports "Found over 10000 datasets" rather than an exact count at that scale.

#### FAQ

This Actor only reads publicly published search results and JSON endpoints from catalog.data.gov — it performs no authentication and stores no personal data. There is no public dataset-search API on catalog.data.gov, so `search_datasets` parses the site's own server-rendered search-results HTML; a future redesign of that page could require an update here. Report issues via the Actor's Issues tab.

#### Did you find this useful?

Rate this actor on Apify! Your feedback helps other users find it and helps us keep improving it.

# Actor input Schema

## Actor input object example

```json
{}
```

# Actor output Schema

## `server` (type: `string`):

This Actor runs as a server rather than producing dataset rows. Start it in Standby mode and call this URL; the run's log records each request.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("rl1987/datagov-catalog-mcp-server").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("rl1987/datagov-catalog-mcp-server").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call rl1987/datagov-catalog-mcp-server --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rl1987/datagov-catalog-mcp-server"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/PIVefZT9oh5D8EdKg/builds/E97EbZt3Z3lq9aKH2/openapi.json
