libofcongress-mcp-server

v0.5.1 pre-1.0

Search LOC digital collections, browse Chronicling America newspapers with full OCR text, and look up LC Subject Headings via MCP. STDIO or Streamable HTTP.

libofcongress.caseyjhand.com/mcp
claude mcp add --transport http libofcongress-mcp-server https://libofcongress.caseyjhand.com/mcp
codex mcp add libofcongress-mcp-server --url https://libofcongress.caseyjhand.com/mcp
{
  "mcpServers": {
    "libofcongress-mcp-server": {
      "url": "https://libofcongress.caseyjhand.com/mcp"
    }
  }
}
gemini mcp add --transport http libofcongress-mcp-server https://libofcongress.caseyjhand.com/mcp
{
  "mcpServers": {
    "libofcongress-mcp-server": {
      "command": "bunx",
      "args": [
        "mcp-remote",
        "https://libofcongress.caseyjhand.com/mcp"
      ]
    }
  }
}
{
  "mcpServers": {
    "libofcongress-mcp-server": {
      "type": "http",
      "url": "https://libofcongress.caseyjhand.com/mcp"
    }
  }
}
curl -X POST https://libofcongress.caseyjhand.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1.0.0"}}}'

Tools

6

libofcongress_search_items

open-world

Search the Library of Congress digital collections by keyword. Optionally filter by material format (photos, maps, newspapers, audio, etc.), date range, subject heading, or geographic location, or scope the search to a single curated collection with collection_slug. Returns item summaries with titles, dates, descriptions, LOC IDs, and format tags. Each result carries is_item: pass the id of a result where is_item is true to libofcongress_get_item for full metadata; results where is_item is false are non-item resources (collections, exhibit and research-guide pages, newspaper-page results, catalog.loc.gov records, hdl.loc.gov finding aids) with no item record — open their url instead. Use libofcongress_search_subjects to find an LCSH heading for the subject filter. To discover the subject and location values the filters accept for a search, set include_facets to get its top subject_facets and location_facets.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "libofcongress_search_items",
    "arguments": {
      "query": "<query>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "Full-text search across metadata and available descriptive text."
    },
    "format": {
      "description": "Material type filter. Options: photo, map, newspaper, manuscript, audio, film, book, notated-music. Omit to search all formats.",
      "type": "string",
      "enum": [
        "photo",
        "map",
        "newspaper",
        "manuscript",
        "audio",
        "film",
        "book",
        "notated-music"
      ]
    },
    "date_start": {
      "description": "Start year for date filter, inclusive (e.g., 1920). Omit for no lower bound.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "date_end": {
      "description": "End year for date filter, inclusive (e.g., 1930). Omit to run through the current year.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "subject": {
      "description": "Subject filter: an LCSH heading from libofcongress_search_subjects (e.g., \"World War, 1939-1945\", \"United States--History--Civil War, 1861-1865\") or a subject term from subject_facets (include_facets) or libofcongress_get_item subject_terms (e.g., \"world war\"). LOC indexes headings by their parts, so the value is split at \"--\" into lowercase terms with dates dropped, and an item must carry every term.",
      "type": "string"
    },
    "location": {
      "description": "Geographic location filter (e.g., \"oklahoma\", \"washington d.c.\"). Lowercase, matches LOC location facets; location_facets (include_facets) lists values for a search.",
      "type": "string"
    },
    "include_facets": {
      "default": false,
      "description": "Also return subject_facets and location_facets: LOC's top subject and location terms across every match, with counts — the values the subject and location filters accept. Default false: facets add time to each search, so request them when you need filter values to narrow by.",
      "type": "boolean"
    },
    "collection_slug": {
      "description": "Scope the search to one curated collection. Use a slug exactly as returned by libofcongress_browse_collections (e.g., \"aaron-copland\") — slugs are not derivable from the collection title. Cannot be combined with format; omit format and read each result's format field instead. Omit to search all of LOC.",
      "type": "string"
    },
    "limit": {
      "default": 25,
      "description": "Results per page. Default 25. A page holds at most 100 results: a larger limit (up to 1000) is served as a 100-result page, and page then counts 100-result pages.",
      "type": "integer",
      "minimum": 1,
      "maximum": 1000
    },
    "page": {
      "default": 1,
      "description": "1-indexed page number for paginating results.",
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "query",
    "include_facets",
    "limit",
    "page"
  ],
  "additionalProperties": false
}
view source ↗

libofcongress_get_item

open-world

Retrieve the full metadata record for a specific LOC digital item. Returns the imprint (place, publisher, and date of publication), contributors, LCSH subject headings and the subject terms the search subject filter accepts, summary, languages, locations, rights information, physical description, call number, original and online formats, access restrictions, former catalog IDs, notes, and related items, plus the item's digital resources (each with its page count, representative image, PDF, and audio) and a window of its pages. Each page has a page_url and has_text; pass a page_url with has_text true to libofcongress_get_newspaper_page to read that page's text (newspaper, book, and manuscript pages alike). A long item lists 50 pages per call: continue with page_offset set to next_page_offset. Set include_files for each listed page's downloadable files (TIFF, JP2, JPEG sizes, text). Use after libofcongress_search_items on a result whose is_item is true. Pass the result id — a simple ID, an LCCN, or a slash-separated newspaper path — or a loc.gov item link (`https://www.loc.gov/item/<id>/`) or LCCN permalink (`https://lccn.loc.gov/<lccn>`), which is read as its id. Non-item results (is_item: false) — collections, exhibits, guides, newspaper pages, catalog.loc.gov records, hdl.loc.gov finding aids — have no item record and cannot be retrieved here.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "libofcongress_get_item",
    "arguments": {
      "item_id": "<item_id>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "item_id": {
      "type": "string",
      "minLength": 1,
      "description": "LOC item id from a libofcongress_search_items result's \"id\" field (where is_item is true): a simple ID (\"2009632251\", \"2005691065\") or a slash-separated path for newspaper issues (\"sn95047246/1935-09-05/ed-1\"). A loc.gov item link is also read as its id: \"https://www.loc.gov/item/2009632251/\", http or without \"www.\", or \"item/2009632251\"; so is an LCCN permalink, as its normalized LCCN: \"https://lccn.loc.gov/2005567251\", http or without a scheme; \"lccn.loc.gov/2005-568294\" reads as 2005568294. Any other URL, such as a /resource/ page URL, is rejected."
    },
    "page_offset": {
      "default": 0,
      "description": "Index of the first page to list, 0-based across all of the item's resources. Default 0. Pass next_page_offset from the previous response to continue.",
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "page_limit": {
      "default": 50,
      "description": "Pages to list. Default 50. A response lists at most 100 pages: a larger page_limit (up to 1000) is served as 100.",
      "type": "integer",
      "minimum": 1,
      "maximum": 1000
    },
    "include_files": {
      "default": false,
      "description": "Also list the download URLs of each listed page's files — every JPEG size, the JP2 and TIFF masters, OCR XML, and text files. Default false.",
      "type": "boolean"
    }
  },
  "required": [
    "item_id",
    "page_offset",
    "page_limit",
    "include_files"
  ],
  "additionalProperties": false
}
view source ↗

libofcongress_search_newspapers

open-world

Search historical newspaper pages in the Chronicling America corpus. Returns matching pages with the opening of each page's OCR text (~500 characters), publication title, date, the states LOC indexes the title under, and the page URL needed for libofcongress_get_newspaper_page. Filters by keyword, date range, US state, and newspaper title. The excerpt is the page's first lines, not the text around the match: to read where the query occurs, call libofcongress_get_newspaper_page with the returned url field and this query as its match, which returns the passages around each occurrence; omit match for the full page text. OCR quality varies: 19th-century and degraded materials may contain fragmented or garbled text.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "libofcongress_search_newspapers",
    "arguments": {
      "query": "<query>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "Keyword search across OCR text and newspaper metadata."
    },
    "date_start": {
      "description": "Start of the date filter, inclusive: an integer year (e.g., 1900) or a \"YYYY\", \"YYYY-MM\", or \"YYYY-MM-DD\" string (e.g., \"1912-04-15\"); month and day may be one or two digits. A year or month starts on its first day. Omit for no lower bound.",
      "anyOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "A year, e.g., 1912."
        },
        {
          "type": "string",
          "pattern": "^(\\d{4})(?:-(\\d{1,2})(?:-(\\d{1,2}))?)?$",
          "description": "A date: \"YYYY\", \"YYYY-MM\", or \"YYYY-MM-DD\", e.g., \"1912-04-16\"."
        },
        {
          "type": "string",
          "const": ""
        }
      ]
    },
    "date_end": {
      "description": "End of the date filter, inclusive, in the same forms as date_start (e.g., 1920 or \"1912-04-16\"). A year or month ends on its last day, so \"1912-04\" runs through April 30. Omit to run through the current year.",
      "anyOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "A year, e.g., 1912."
        },
        {
          "type": "string",
          "pattern": "^(\\d{4})(?:-(\\d{1,2})(?:-(\\d{1,2}))?)?$",
          "description": "A date: \"YYYY\", \"YYYY-MM\", or \"YYYY-MM-DD\", e.g., \"1912-04-16\"."
        },
        {
          "type": "string",
          "const": ""
        }
      ]
    },
    "state": {
      "description": "Filter to newspapers LOC indexes under this US state: the full state name (e.g., \"oklahoma\", \"new york\") or its two-letter postal code (e.g., \"OK\", \"NY\"), case-insensitive. Use \"district of columbia\" (or \"DC\") for Washington, D.C.; \"washington\" means Washington state. City and county names match nothing.",
      "type": "string"
    },
    "newspaper_title": {
      "description": "Filter to one newspaper. Pass the newspaper_title value of a libofcongress_search_newspapers result exactly (case-insensitive), e.g., \"new-york tribune (new york [n.y.]) 1866-1924\" — the full catalog title with place and run. A shortened title such as \"New-York Tribune\" matches nothing.",
      "type": "string"
    },
    "limit": {
      "default": 25,
      "description": "Results per page. Default 25. A page holds at most 100 results: a larger limit (up to 1000) is served as a 100-result page, and page then counts 100-result pages.",
      "type": "integer",
      "minimum": 1,
      "maximum": 1000
    },
    "page": {
      "default": 1,
      "description": "1-indexed page number for paginating results.",
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "query",
    "limit",
    "page"
  ],
  "additionalProperties": false
}
view source ↗

libofcongress_get_newspaper_page

open-world

Retrieve the full text of one LOC page — a historical newspaper page, or a book or manuscript page — or, with match, only the passages around your search terms, with its publication metadata: for newspapers the title, issue date, place of publication, indexed states, and edition; for every page its sequence, the page count, and the item_title and item_id of the issue, book, or manuscript it belongs to — pass item_id to libofcongress_get_item to list every page of the item. Pass the url field from a libofcongress_search_newspapers result, or a pages[].page_url from libofcongress_get_item (has_text true), or a Chronicling America page link (…/ed-N/seq-M/) — do not construct this URL manually. A dense newspaper page runs to 50,000 characters: to find the article a search hit on, pass the search query as match and read the passages around it rather than the whole page. The text is OCR, or for some manuscripts a volunteer transcription; OCR quality varies by digitization batch and era, and 19th-century and degraded materials may contain fragmented text, garbled words, and line-break artifacts that are surfaced as-is. When a page exists but has no digitized text, ocr_available is false and ocr_text is empty — this is a data property, not an error.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "libofcongress_get_newspaper_page",
    "arguments": {
      "page_url": "<page_url>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "page_url": {
      "type": "string",
      "description": "A LOC page URL: the url field from a libofcongress_search_newspapers result (e.g., \"https://www.loc.gov/resource/sn83045462/1905-03-15/ed-1/?sp=1\"), or a pages[].page_url from libofcongress_get_item for a newspaper, book, or manuscript page (e.g., \"https://www.loc.gov/resource/mss93930.mss93930-001/?sp=3\"). Also accepted: the same /resource/ URL over http or without \"www.\", a newspaper page path ending /ed-N/seq-M/, and a Chronicling America page link (`chroniclingamerica.loc.gov/lccn/<lccn>/<date>/ed-N/seq-M/`); each is read as its https://www.loc.gov/resource/…/?sp=M page. Pass the value as returned — do not construct page URLs."
    },
    "match": {
      "description": "Return the passages around these terms instead of the whole page — pass the query you gave libofcongress_search_newspapers (e.g., titanic, or \"the titanic\" iceberg); the q= in a search result url is not read as match. Words separated by spaces are separate terms, any of which matches; a double-quoted span is one phrase. Each matches case-insensitively as literal text, with line breaks read as spaces; OCR misreads are not repaired. When set, ocr_text is empty, matches holds up to 10 passages of about 300 characters either side of each occurrence — when they need more, occurrences of the rarest terms come first, so a common word only fills the slots left — and match_count counts every occurrence. Omit match for the whole page. Up to 200 characters; blank is ignored.",
      "type": "string",
      "maxLength": 200
    }
  },
  "required": [
    "page_url"
  ],
  "additionalProperties": false
}
view source ↗

libofcongress_search_subjects

open-world

Search Library of Congress Subject Headings (LCSH) by keyword. Returns authorized subject headings and their URIs, ranked by relevance with a heading that exactly matches the query first; a partial word with no keyword match returns the headings that begin with it. Use the returned label as the subject filter in libofcongress_search_items — LCSH uses precise, standardized terms that differ from natural language (e.g., "World War, 1939-1945" not "World War II"; "Aerial photography" not "Photography, Aerial"). Running this tool before a subject-filtered libofcongress_search_items dramatically improves result quality.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "libofcongress_search_subjects",
    "arguments": {
      "query": "<query>"
    }
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "Keyword or partial subject heading to search for (e.g., \"civil war\", \"immigration\", \"jazz\")."
    },
    "limit": {
      "default": 10,
      "description": "Maximum number of subject headings to return. Default 10. A call returns at most 50 headings; a larger limit (up to 1000) returns up to 50.",
      "type": "integer",
      "minimum": 1,
      "maximum": 1000
    }
  },
  "required": [
    "query",
    "limit"
  ],
  "additionalProperties": false
}
view source ↗

libofcongress_browse_collections

open-world

List and browse Library of Congress curated digital collections. Returns collection names, descriptions, item counts, slugs, and URLs. Optionally filter by keyword. Collections are curated subsets of the digital holdings with specific focuses (e.g., "Civil War Glass Negatives", "Baseball Cards", "WPA Posters"). Use the returned URL to navigate directly to a collection on loc.gov.

read
invocation
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "libofcongress_browse_collections",
    "arguments": {}
  }
}
schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "description": "Optional keyword to filter collections by name or description. Omit to list all collections.",
      "type": "string"
    },
    "limit": {
      "default": 25,
      "description": "Maximum number of collections to return. Default 25. A page holds at most 100 collections: a larger limit (up to 1000) is served as a 100-collection page, and page then counts 100-collection pages.",
      "type": "integer",
      "minimum": 1,
      "maximum": 1000
    },
    "page": {
      "default": 1,
      "description": "1-indexed page number for paginating results.",
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "limit",
    "page"
  ],
  "additionalProperties": false
}
view source ↗

Resources

1

LOC digital item metadata by ID. Returns the same full record as libofcongress_get_item with its default page window: the first 50 pages, without per-page files. When next_page_offset is present, call libofcongress_get_item with page_offset to list the rest. Item IDs with internal slashes (newspaper pages) are written with their slashes intact: libofcongress://item/sn95047246/1935-09-05/ed-1. Use libofcongress_search_items to discover item IDs first.

uri libofcongress://item/{+item_id} mime application/json