Skip to main content
Glama

loc-mcp

A CLI and MCP server for the Library of Congress JSON API: newspapers, books and manuscripts, all full-text indexed and all resolvable to the individual page.

Keyless, no registration, no affiliation required.

Scope

Searches cover the whole of loc.gov by default. --collection <slug> narrows to one collection — chronicling-america for the historic newspapers, which is where the bulk of the transcribed text lives.

There is nothing special-cased about the newspapers. The dedicated chroniclingamerica.loc.gov API has been retired and that collection is now reachable only as one collection of loc.gov, so it is simply one value of --collection like any other.

Related MCP server: historical-investigator-mcp

Install

uv tool install .

Commands

locgov search "<query>" [--pages N|N-M|all] [filters] [--json]
locgov snippets <reference> "<query>"   # the query in context on that page
locgov get <reference>                  # OCR text, prints path to the cached file

A reference is the loc.gov URL printed for each search result. It is both the citation link and the argument the other two commands take.

$ locgov search '"Brooklyn Bridge"' --collection chronicling-america \
    --from-year 1883 --to-year 1883 --per-page 2
# "Brooklyn Bridge" — 2363 results in chronicling-america, page 1 of 1182
[1] 1883-06-16  Image 2 of The Lincoln County leader (White Oaks, Lincoln County, N.M.), June 16, 1883
    the lincoln county leader (white oaks, lincoln county, n.m.) 1882-189? · p. 2 · english · new mexico
    https://www.loc.gov/resource/sn87090072/1883-06-16/ed-1/?sp=2

Note the nested quotes. '"Brooklyn Bridge"' is a phrase search; "Brooklyn Bridge" lets the shell strip the quotes and becomes an AND search, which on this same 1883 range reports 11,098 hits instead of 2,363.

Filters for search: --from-year, --to-year, --language, --state, --title, --collection, --level, --per-page, --sort.

--sort takes relevance (default), date_asc or date_desc.

Query syntax

Bare words are ANDed, and "quoted phrases" match exactly.

There is no boolean OR and no NOT. The words OR and NOT, a leading -, parentheses and | are all silently stripped from the query rather than rejected:

Query

Hits

telegraph

3,212,711

telegraph cable

594,470

telegraph -cable

594,470

telegraph NOT cable

594,470

The last three are the same AND query. Each variant of a term therefore needs its own search, and a query written as (a OR b) quietly returns only pages holding both. This is the single most important thing to know before planning a sweep against this source.

Result totals are true counts

Unlike a relevance-ranked archive, loc.gov filters: the reported total is a real count of matching pages, so it can be quoted as one and --sort date_asc is safe on any query. The decade facet counts sum exactly to the reported total.

Pages, not documents

--level page is the default and resolves a hit to the individual page it sits on, for a book or a manuscript exactly as for a newspaper. That is what makes snippets and per-page text available. --level item returns whole documents instead; those have no snippet service, and get on one downloads the entire transcription in a single file.

Readability

By default search returns only material whose text can actually be retrieved (online-format:online text). A hit that cannot be read is of no use, so this is on unless you pass --include-unreadable, and anything unreadable that does slip through is flagged in the output.

Cost

Requests are paced at one every four seconds, shared across processes, so parallel callers share one budget. The Library publishes a limit of 20 requests per minute and blocks an offending IP for a full hour, which is what the conservative default is for. Override with LOC_MIN_REQUEST_INTERVAL only with reason.

Budget in requests: search is one request per result page (up to 150 results each), snippets and get are one request each after a one-off lookup per page that is then memoised on disk — and search seeds that memo for every result it returns. OCR downloads are cached under $XDG_CACHE_HOME/loc-mcp.

MCP server

uv run loc-mcp-install

Installs to Claude Code, Codex CLI and Gemini CLI. The CLI is the primary interface; the server exposes the same client.

License

Apache 2.0

Available Tools

3 tools
get_loc_textA

Download a page's OCR text, returning the path to the cached file.

Use when snippets are not enough and the whole page has to be read or grepped. Hyphenation broken across line ends is rejoined, so the cached text greps the way the search index matched.

ParametersJSON Schema
NameRequiredDescriptionDefault
referenceYesPage reference, as returned by `search_loc`

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Since no annotations are provided, the description carries full burden. It discloses the key behavior: the tool returns a path to a cached file (not the text inline) and mentions hyphenation rejoining. However, it does not explicitly state that the operation is read-only or non-destructive, nor does it describe any side effects like caching behavior or file lifetime. Still, it provides meaningful behavioral context beyond a simple 'download text'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is only two sentences, each earning its place. The first sentence states the core function, the second provides usage guidance. No wasted words, and the structure is front-loaded with the most important information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (single parameter, output schema present), the description covers the essential usage context and behavioral details. It explains what the tool does, when to use it, and a key processing detail (hyphenation). The only minor gap is that it doesn't describe the cached file's format or the path location, but the presence of an output schema likely covers that. Overall, it is sufficiently complete for this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for the single parameter 'reference'. The tool description does not add any additional meaning beyond the schema's description ('Page reference, as returned by `search_loc`'). Baseline score of 3 applies because schema already adequately documents the parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Download') and resource ('page's OCR text') and clearly states the return value ('path to the cached file'). It also distinguishes from siblings by contrasting with 'snippets' and mentioning 'grepping', which is not possible with snippets_loc.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool: 'Use when snippets are not enough and the whole page has to be read or grepped.' This gives clear guidance and implies the alternative (snippets_loc) is for partial text. It also mentions hyphenation rejoining, which helps the user understand the output's behavior.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_locA

Search the Library of Congress full text.

Covers every collection at once: newspapers 1736-1963 in more than a dozen languages, plus digitised books and manuscripts.

Bare words are ANDed and "quoted phrases" match exactly. There is no boolean OR and no NOT - those words, a leading minus, parentheses and | are all silently stripped - so each variant of a term needs its own search.

Results resolve to individual pages. Each carries a reference that is both the citation URL and the argument for snippets_loc and get_loc_text.

ParametersJSON Schema
NameRequiredDescriptionDefault
pageNoResult page number, 1-indexed
queryYesSearch terms

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description provides good transparency about search behavior, query limitations (stripping of boolean operators), and result format (individual pages with reference). It does not disclose rate limits or authentication but these are common for search APIs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is moderately concise with each sentence providing distinct information. It is front-loaded with the main purpose and organized logically, though a bit lengthy. Could be tightened without losing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema, the description need not detail return values. It covers the tool's scope, query behavior, and result usage with siblings, leaving some aspects like error handling unaddressed but adequate for a search tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds significant value beyond the schema by detailing query syntax (ANDing, exact phrases, ignored operators) and clarifying the page parameter's role and 1-indexing.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it searches the Library of Congress full text, covering multiple collections and time periods. It also distinguishes from sibling tools by explaining how results connect to snippets_loc and get_loc_text.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains query syntax (AND, quoted phrases, no boolean operators) and result structure, effectively guiding when and how to use the tool. However, it lacks explicit 'when not to use' guidance and could mention alternative tools for boolean searches.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

snippets_locA

Show a query in context on one page.

The cheap way to judge a search result without downloading it: returns the matched terms in {braces} with the surrounding sentences, and a citation URL. Works for any page-level reference, but not for a whole item.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesTerms to locate within the page
referenceYesPage reference, as returned by `search_loc`

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses that output includes matched terms in braces, surrounding sentences, and a citation URL, providing a good mental model for the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with three sentences, each earning its place: purpose, usage context, and a clear limitation. Front-loaded with key action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (2 required params, full schema coverage, output schema present), the description adequately covers what, when, and how. Minor gap: no mention of error handling or edge cases, but not critical for this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description does not add significant detail beyond the existing schema descriptions for 'reference' and 'query', thus meeting but not exceeding expectations.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Show a query in context on one page' with specific verb and resource. It distinguishes itself from siblings by noting it's a cheap way to judge results without downloading, and explicitly excludes whole items, clarifying its scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context by stating it's 'the cheap way to judge a search result without downloading it' and explicitly notes 'not for a whole item.' While sibling tools are not named, the guidance is sufficient to differentiate scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv0.1.0
    • First observedget_loc_text
    • First observedsearch_loc
    • First observedsnippets_loc

TDQS

A4.4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: search_loc for searching, snippets_loc for showing context, and get_loc_text for full text. No overlap in functionality.

Naming Consistency4/5

Tool names follow a consistent snake_case pattern with '_loc' suffix, though 'get_loc_text' deviates slightly from the verb_noun convention of the others. Still clear and predictable.

Tool Count5/5

Three tools is well-scoped for searching and retrieving text from the Library of Congress. Each tool serves a necessary step in the workflow without redundancy.

Completeness5/5

The tool set covers the full search-to-retrieval pipeline: search, context snippet, and full text download. No obvious gaps for the stated domain.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    MCP server for the Internet Archive's Wayback Machine. Search archived snapshots, extract page text from a specific date, track how a site has changed over time, check if broken links are recoverable, and perform research across Internet Archive collections.
    6
    3
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    MCP server for searching and accessing historical Austrian newspapers from ANNO, providing full-text search, snippet extraction, and OCR text download.
    3
    Apache 2.0
  • A
    license
    A
    quality
    B
    maintenance
    MCP server and CLI for full-text search of the Deutsches Zeitungsportal (German newspaper collection), enabling querying ~33.8 million digitized pages with Solr syntax, date/title/place filters, and snippet highlights.
    3
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nestordemeure/loc-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server