{
  "markdown": "# mcp-libraryofcongress\n\n[![npm](https://img.shields.io/npm/v/mcp-libraryofcongress.svg)](https://www.npmjs.com/package/mcp-libraryofcongress)\n[![CI](https://github.com/smeet666/mcp-libraryofcongress/actions/workflows/ci.yml/badge.svg)](https://github.com/smeet666/mcp-libraryofcongress/actions/workflows/ci.yml)\n[![license](https://img.shields.io/npm/l/mcp-libraryofcongress.svg)](./LICENSE)\n[![MCP Registry](https://img.shields.io/badge/MCP_Registry-listed-6E56CF)](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.smeet666/mcp-libraryofcongress)\n[![Glama](https://glama.ai/mcp/servers/smeet666/mcp-libraryofcongress/badges/score.svg)](https://glama.ai/mcp/servers/smeet666/mcp-libraryofcongress)\n[![M8ven](https://m8ven.ai/badge/mcp/smeet666-mcp-libraryofcongress-1rr3lc?variant=verified)](https://m8ven.ai/mcp/smeet666-mcp-libraryofcongress-1rr3lc)\n[![LobeHub](https://lobehub.com/badge/mcp/smeet666-mcp-libraryofcongress)](https://lobehub.com/mcp/smeet666-mcp-libraryofcongress)\n[![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=libraryofcongress&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIm1jcC1saWJyYXJ5b2Zjb25ncmVzcyJdfQ%3D%3D)\n[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=libraryofcongress&config=%7B%22name%22%3A%22libraryofcongress%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22mcp-libraryofcongress%22%5D%7D)\n\n<!-- m8ven-verify: 69c0541bf1d6a6e94b450b4d2b058659 -->\n\nThe [Library of Congress](https://www.loc.gov) is the national library of the\nUnited States, and it publishes a large part of its holdings online: books,\nphotographs, maps, sound recordings, manuscripts, and the pages of American\nnewspapers going back to the eighteenth century. The newspaper pages have been\nscanned and run through optical character recognition, so the words printed on\nthem can be searched. Curators also gather material into digital collections,\neach described and published as a body of its own.\n\nThis server connects a chat client to that library. You can search the words\nprinted inside the newspapers, search the catalogue by title, creator, subject,\nplace or language, read one record with its rights statement and where the\noriginal is held, and list the digital collections. It needs no API key and no\naccount.\n\n_[Version française](#mcp-libraryofcongress-français)_\n\n---\n\n## Install\n\n**One-click install**\n\n[![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=libraryofcongress&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIm1jcC1saWJyYXJ5b2Zjb25ncmVzcyJdfQ%3D%3D)\n[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=libraryofcongress&config=%7B%22name%22%3A%22libraryofcongress%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22mcp-libraryofcongress%22%5D%7D)\n\n**Claude Code**\n\n```bash\nclaude mcp add libraryofcongress -- npx -y mcp-libraryofcongress\n```\n\n**Claude Desktop, Cursor, and any client using the standard config format**\n\n```json\n{\n  \"mcpServers\": {\n    \"libraryofcongress\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-libraryofcongress\"]\n    }\n  }\n}\n```\n\nNode 24 or later is required, and no environment variable has to be set.\n\n### With Docker\n\n```json\n{\n  \"mcpServers\": {\n    \"libraryofcongress\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"-i\", \"--rm\", \"ghcr.io/smeet666/mcp-libraryofcongress:3.0.2\"]\n    }\n  }\n}\n```\n\n`-i` keeps stdin open, which is where the protocol travels, and `-t` is left out\nbecause a TTY rewrites the stream. The container needs outbound HTTPS to\n`www.loc.gov` and `chroniclingamerica.loc.gov`, and nothing else: no volume, no\nport, no credential.\n\n### Bundle, without npm\n\nDownload `mcp-libraryofcongress-3.0.2.mcpb` from\n[the latest release](https://github.com/smeet666/mcp-libraryofcongress/releases/latest)\nand open it. A client that supports MCP bundles installs it on its own, with no\nnpm and no configuration file to edit. The bundle carries its dependencies, so\nnothing is fetched at install time.\n\n## What you can ask\n\n- \"What did Oklahoma newspapers write about the 1907 statehood vote?\"\n- \"Find me photographs of Chicago tenements before 1920.\"\n- \"Read that record and tell me who holds the original.\"\n- \"What digital collections are there on the Civil War?\"\n- \"Can I reuse that photograph?\"\n\nThe ordinary path runs from a search to a record: a row carries an `identifier`,\nand `get_item` reads it.\n\n## Tools\n\n| Tool                | What it does                                                          |\n| ------------------- | --------------------------------------------------------------------- |\n| `search_newspapers` | Searches the words printed inside scanned newspaper pages.            |\n| `search_items`      | Searches the catalogue by title, creator, subject, place or language. |\n| `get_item`          | Reads one record, its rights and where the original is held.          |\n| `list_collections`  | Lists the digital collections curators published.                     |\n\n### `search_newspapers`\n\nSearches the text of scanned newspaper pages, which came off the page through\noptical character recognition.\n\n| Argument                 | Type                               | Required | What it does                        |\n| ------------------------ | ---------------------------------- | -------- | ----------------------------------- |\n| `query`                  | string, 1 to 300 characters        | yes      | The words to look for on the pages. |\n| `location`               | string, up to 120 characters       | no       | A place the paper was published in. |\n| `publication`            | string, up to 200 characters       | no       | One newspaper.                      |\n| `year_from`              | integer, 1000 to 9999              | no       | Earliest year, inclusive.           |\n| `year_to`                | integer, 1000 to 9999              | no       | Latest year, inclusive.             |\n| `limit`                  | integer, 1 to 25, default `10`     | no       | Matches to serve.                   |\n| `page`                   | integer, 1 to 100, default `1`     | no       | Which page of matches.              |\n| `max_excerpt_chars`      | integer, 80 to 1200, default `300` | no       | How much of a passage to serve.     |\n| `max_excerpts_per_match` | integer, 1 to 10, default `3`      | no       | Passages served per matching page.  |\n\n**In return:** `hits`, each carrying `identifier`, which `get_item` takes;\n`title`; `creator`, which is the library that contributed the scan; `year`;\n`page_number`, the leaf within the issue; `published_on`; `publication` with the\nyears the paper ran; `state`; `excerpts`; and `excerpt_kind`.\n\n**`excerpt_kind` decides what an excerpt is worth.** A `passage` is the text\naround the words that matched, centred on them. A `page_opening` is the start of\nthe leaf, sent because the text the Library returned with the row stops before\nthose words appear: it does not carry the match, so quoting it quotes something\nelse, and `source_url` opens the leaf with the query applied. **`total` counts\nnewspaper leaves, and it pages:** it is never a count of how many times the words\noccur.\n\n### `search_items`\n\nSearches the catalogue, one kind of thing at a time.\n\n| Argument      | Type                                                              | Required | What it does                                    |\n| ------------- | ----------------------------------------------------------------- | -------- | ----------------------------------------------- |\n| `query`       | string, 1 to 300 characters                                       | yes      | Words to look for.                              |\n| `media_type`  | `books`, `photos`, `maps`, `audio`, `manuscripts` or `newspapers` | no       | The catalogue to read.                          |\n| `year_from`   | integer, 1000 to 9999                                             | no       | Earliest year, inclusive.                       |\n| `year_to`     | integer, 1000 to 9999                                             | no       | Latest year, inclusive.                         |\n| `subject`     | string, up to 120 characters                                      | no       | A subject heading.                              |\n| `location`    | string, up to 120 characters                                      | no       | A place.                                        |\n| `language`    | string, up to 120 characters                                      | no       | A language, written in English.                 |\n| `collection`  | string, up to 160 characters                                      | no       | One collection, as `list_collections` names it. |\n| `online_only` | boolean, default `true`                                           | no       | Keep the records available online.              |\n| `sort`        | `relevance`, `newest`, `oldest` or `title`, default `relevance`   | no       | How the rows are ordered.                       |\n| `limit`       | integer, 1 to 50, default `10`                                    | no       | Rows to serve.                                  |\n| `page`        | integer, 1 to 100, default `1`                                    | no       | Which page of rows.                             |\n\n**In return:** `items`, each carrying `identifier`, `title`, `creator`, `year`,\n`date` as published, which is often a range, `is_collection` and `source_url`.\nThe Library keeps one catalogue per kind of thing, so a search without\n`media_type` reads the general one, and `total` counts the records matching\nthere.\n\n### `get_item`\n\nReads one record. The heavier parts are asked for rather than served by default,\nand a long description paginates.\n\n| Argument                | Type                                                                             | Required | What it does                          |\n| ----------------------- | -------------------------------------------------------------------------------- | -------- | ------------------------------------- |\n| `identifier`            | string, 1 to 300 characters                                                      | yes      | The identifier a row carries.         |\n| `sections`              | array of `basic`, `citations`, `resources`, `full_metadata`, default `[\"basic\"]` | no       | Which parts to return.                |\n| `offset`                | integer, 0 or more, default `0`                                                  | no       | Where to resume the description.      |\n| `max_description_chars` | integer, 200 to 20000, default `2000`                                            | no       | How much of the description to serve. |\n\n**In return:** the record with its `title`, `creator`, `year`, `date`, `format`\nand `source_url`, plus `description`, `subjects`, `location`, `language`,\n`part_of` for the collections and divisions it sits in, `repository` naming where\nthe original is held, `call_number` and `rights`. A field the record leaves empty\nis `null`. `next_offset` continues a long description and is `null` at the end.\nAn identifier can carry slashes: a single newspaper issue is named by its paper,\nits date and its edition together.\n\n### `list_collections`\n\nLists the digital collections, bodies of material a curator chose, described and\npublished together.\n\n| Argument                | Type                               | Required | What it does                                      |\n| ----------------------- | ---------------------------------- | -------- | ------------------------------------------------- |\n| `limit`                 | integer, 1 to 50, default `20`     | no       | Collections to serve.                             |\n| `page`                  | integer, 1 to 100, default `1`     | no       | Which page of collections.                        |\n| `searchable_only`       | boolean, default `false`           | no       | Keep the collections a search can be narrowed to. |\n| `max_description_chars` | integer, 80 to 2000, default `300` | no       | How much of each description to serve.            |\n\n**In return:** `collections`, each carrying `identifier`, the slug it is\naddressed by; `title`; `collection_filter`, the wording `search_items` takes;\n`searchable_media_types`; `description`; `item_count`; `subjects`; `formats` for\nthe kinds of thing it holds; and `source_url`. `total` counts the collections the\nLibrary publishes, which is more than the number returned.\n\n## What scanned text is worth\n\nThe words inside a newspaper page came off the page through optical character\nrecognition, so an excerpt carries the misreadings of that process. It is served\nas it was read rather than corrected. Quote it as scanned text, and link the page\nso a reader can look at the leaf itself.\n\n## Rights\n\nA record states its own rights in `rights`, and the Library's terms differ from\none deposit to the next. Read that statement before reusing anything, and repeat\nit beside whatever is shown.\n\n## Configuration\n\nEvery variable is optional. Set them in the `env` block of your client config.\n\n| Variable                   | Default              | What it does                                                                          |\n| -------------------------- | -------------------- | ------------------------------------------------------------------------------------- |\n| `LOC_USER_AGENT`           | the project identity | Names your application to the Library, with an address where a person can be reached. |\n| `LOC_MIN_INTERVAL_MS`      | `6000`               | Gap between two requests, from 3000 to 60000.                                         |\n| `LOC_TIMEOUT_MS`           | `30000`              | Deadline for one request, from 1000 to 120000.                                        |\n| `LOC_NEWSPAPER_TIMEOUT_MS` | `90000`              | Deadline for a newspaper search, from 1000 to 300000.                                 |\n| `LOC_MAX_RETRIES`          | `3`                  | Attempts after a transient failure, from 0 to 8.                                      |\n| `LOC_CACHE_TTL_MS`         | `900000`             | How long an answer stays in memory, from 0 to 86400000.                               |\n| `LOC_CACHE_MAX_ENTRIES`    | `200`                | Answers held in memory at once, from 1 to 5000.                                       |\n| `LOC_LOG_LEVEL`            | `error`              | `silent`, `error`, `info` or `debug`, written to stderr.                              |\n\nA value outside its range falls back to the default, and the reason is written to\nstderr.\n\n## Errors\n\nEvery failure carries one of six codes, a message, and where it helps a hint\nnaming the next move.\n\n| Code            | What happened                                           | What to do                                                                                                   |\n| --------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |\n| `not_found`     | The Library answered, and holds no such record.         | Check the identifier with `search_items`.                                                                    |\n| `invalid_input` | The arguments were refused before any request went out. | Read the message, which names the argument.                                                                  |\n| `rate_limited`  | The Library asked this client to slow down.             | Wait the number of seconds the hint names and call again with the same arguments. The record is still there. |\n| `parse_failure` | The answer arrived in a shape this client cannot read.  | Report it at [the issue tracker](https://github.com/smeet666/mcp-libraryofcongress/issues).                  |\n| `network_error` | The request did not complete.                           | Try again shortly.                                                                                           |\n| `timeout`       | The request passed its deadline.                        | Raise `LOC_TIMEOUT_MS`, or `LOC_NEWSPAPER_TIMEOUT_MS` for a newspaper search.                                |\n\n## As a library\n\nThe layer reading the Library is published on its own, with its pacing, its cache\nand its errors, and with no protocol attached.\n\n```ts\nimport { LocClient } from \"mcp-libraryofcongress/client\";\n\nconst client = new LocClient();\nconst { data, cached } = await client.searchItems({ query: \"tenement\", mediaType: \"photos\" });\nconsole.log(data.total, cached);\n```\n\nEach read answers `{ data, cached }`, and throws an error carrying one of the six\ncodes. The floor between two requests holds here as well.\n\n## Pacing and attribution\n\nThe Library publishes a limit of 20 requests a minute for its API and 10 for the\nsite as a whole, and the lower of the two governs: requests go out one at a time\nwith at least six seconds between them, and the floor of three seconds holds\nhowever the server is configured. The `User-Agent` always ends with the project\nidentity and an address where a person can be reached.\n\nEvery result carries the address of the page it was read from. The Library of\nCongress is a public institution, and its records state their own rights.\n\nThis MCP server is an unofficial project, with no affiliation to the Library of\nCongress.\n\n## Privacy\n\nThis server collects nothing about you and sends nothing to its author. It runs\non your machine, contacts `www.loc.gov` and `chroniclingamerica.loc.gov` and nothing else, holds its answers in memory\nwhile it runs, and writes nothing to disk.\n[PRIVACY.md](PRIVACY.md) states what a request carries and which settings change\nany of it.\n\n## Development\n\n```bash\nnpm install\nnpm run build:fixtures\nnpm test\nnpm run check\n```\n\nTests run against generated fixtures and make no network request. The live suite,\n`npm run test:live`, makes one request per route and runs nightly against the\nLibrary itself.\n\n## Contributing\n\nBugs, questions and ideas belong in\n[the issue tracker](https://github.com/smeet666/mcp-libraryofcongress/issues).\nPull requests are welcome; opening an issue first helps agree on the shape of the\nchange. See [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nMIT, see [LICENSE](LICENSE). The records belong to the Library of Congress and to\nthe depositors it names, under the rights each record states.\n\n---\n\n<a name=\"mcp-libraryofcongress-français\"></a>\n\n# mcp-libraryofcongress (français)\n\n_[English version](#mcp-libraryofcongress)_\n\nLa [Library of Congress](https://www.loc.gov) est la bibliothèque nationale des\nÉtats-Unis, et elle publie en ligne une large part de ses fonds : livres,\nphotographies, cartes, enregistrements sonores, manuscrits, et les pages des\njournaux américains depuis le dix-huitième siècle. Ces pages de journaux ont été\nnumérisées puis passées par la reconnaissance optique de caractères, si bien que\nles mots qui y sont imprimés sont cherchables. Des conservateurs rassemblent\naussi des documents en collections numériques, chacune décrite et publiée comme\nun ensemble à part entière.\n\nCe serveur relie un client de conversation à cette bibliothèque. On peut chercher\ndans les mots imprimés à l'intérieur des journaux, chercher au catalogue par\ntitre, auteur, sujet, lieu ou langue, lire une notice avec ses conditions de\ndroits et le lieu où l'original est conservé, et lister les collections\nnumériques. Aucune clé d'API, aucun compte.\n\n## Installation\n\n**Installation en un clic**\n\n[![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=libraryofcongress&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIm1jcC1saWJyYXJ5b2Zjb25ncmVzcyJdfQ%3D%3D)\n[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=libraryofcongress&config=%7B%22name%22%3A%22libraryofcongress%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22mcp-libraryofcongress%22%5D%7D)\n\n**Claude Code**\n\n```bash\nclaude mcp add libraryofcongress -- npx -y mcp-libraryofcongress\n```\n\n**Claude Desktop, Cursor, et tout client au format de configuration standard**\n\n```json\n{\n  \"mcpServers\": {\n    \"libraryofcongress\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-libraryofcongress\"]\n    }\n  }\n}\n```\n\nNode 24 ou plus récent est nécessaire, et aucune variable d'environnement n'est à\nrenseigner.\n\n### Avec Docker\n\n```json\n{\n  \"mcpServers\": {\n    \"libraryofcongress\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"-i\", \"--rm\", \"ghcr.io/smeet666/mcp-libraryofcongress:3.0.2\"]\n    }\n  }\n}\n```\n\n`-i` garde l'entrée standard ouverte, qui est le canal du protocole, et `-t` est\nomis parce qu'un TTY réécrit le flux. Le conteneur a besoin d'un accès HTTPS\nsortant vers `www.loc.gov` et `chroniclingamerica.loc.gov`, et de rien d'autre :\naucun volume, aucun port, aucun identifiant.\n\n### Bundle, sans npm\n\nTéléchargez `mcp-libraryofcongress-3.0.2.mcpb` depuis\n[la dernière publication](https://github.com/smeet666/mcp-libraryofcongress/releases/latest)\net ouvrez-le. Un client qui gère les bundles MCP l'installe seul, sans npm et\nsans fichier de configuration à modifier. Le bundle emporte ses dépendances, donc\nrien n'est téléchargé à l'installation.\n\n## Ce qu'on peut demander\n\n- « Qu'ont écrit les journaux de l'Oklahoma sur le vote d'accession de 1907 ? »\n- « Trouve-moi des photographies d'immeubles de rapport à Chicago avant 1920. »\n- « Lis cette notice et dis-moi qui conserve l'original. »\n- « Quelles collections numériques existent sur la guerre de Sécession ? »\n- « Puis-je réutiliser cette photographie ? »\n\nLe chemin ordinaire va d'une recherche à une notice : une ligne porte un\n`identifier`, et `get_item` la lit.\n\n## Les outils\n\n| Outil               | Ce qu'il fait                                                        |\n| ------------------- | -------------------------------------------------------------------- |\n| `search_newspapers` | Cherche dans les mots imprimés des pages de journaux numérisées.     |\n| `search_items`      | Cherche au catalogue par titre, auteur, sujet, lieu ou langue.       |\n| `get_item`          | Lit une notice, ses droits et le lieu de conservation de l'original. |\n| `list_collections`  | Liste les collections numériques publiées par les conservateurs.     |\n\n### `search_newspapers`\n\nCherche dans le texte des pages de journaux numérisées, texte issu de la\nreconnaissance optique de caractères.\n\n| Argument                 | Type                            | Requis | Ce qu'il fait                            |\n| ------------------------ | ------------------------------- | ------ | ---------------------------------------- |\n| `query`                  | chaîne, 1 à 300 caractères      | oui    | Les mots à chercher sur les pages.       |\n| `location`               | chaîne, jusqu'à 120 caractères  | non    | Un lieu de publication du journal.       |\n| `publication`            | chaîne, jusqu'à 200 caractères  | non    | Un journal en particulier.               |\n| `year_from`              | entier, 1000 à 9999             | non    | Année la plus ancienne, incluse.         |\n| `year_to`                | entier, 1000 à 9999             | non    | Année la plus récente, incluse.          |\n| `limit`                  | entier, 1 à 25, défaut `10`     | non    | Correspondances à servir.                |\n| `page`                   | entier, 1 à 100, défaut `1`     | non    | Quelle page de correspondances.          |\n| `max_excerpt_chars`      | entier, 80 à 1200, défaut `300` | non    | La longueur de passage à servir.         |\n| `max_excerpts_per_match` | entier, 1 à 10, défaut `3`      | non    | Passages servis par page correspondante. |\n\n**En retour :** `hits`, chacun portant `identifier`, que `get_item` reprend ;\n`title` ; `creator`, qui est la bibliothèque ayant fourni la numérisation ;\n`year` ; `page_number`, le feuillet dans le numéro ; `published_on` ;\n`publication` avec les années de parution du journal ; `state` ; `excerpts` ; et\n`excerpt_kind`.\n\n**`excerpt_kind` décide de ce que vaut un extrait.** Un `passage` est le texte\nautour des mots trouvés, centré sur eux. Un `page_opening` est le début du\nfeuillet, envoyé parce que le texte rendu par la bibliothèque avec la ligne\ns'arrête avant que ces mots apparaissent : il ne porte pas la correspondance,\ndonc le citer cite autre chose, et `source_url` ouvre le feuillet avec la requête\nappliquée. **`total` compte des feuillets de journaux, et il pagine :** ce n'est\njamais un compte du nombre de fois où les mots apparaissent.\n\n### `search_items`\n\nCherche au catalogue, un type de chose à la fois.\n\n| Argument      | Type                                                              | Requis | Ce qu'il fait                                          |\n| ------------- | ----------------------------------------------------------------- | ------ | ------------------------------------------------------ |\n| `query`       | chaîne, 1 à 300 caractères                                        | oui    | Les mots à chercher.                                   |\n| `media_type`  | `books`, `photos`, `maps`, `audio`, `manuscripts` ou `newspapers` | non    | Le catalogue à lire.                                   |\n| `year_from`   | entier, 1000 à 9999                                               | non    | Année la plus ancienne, incluse.                       |\n| `year_to`     | entier, 1000 à 9999                                               | non    | Année la plus récente, incluse.                        |\n| `subject`     | chaîne, jusqu'à 120 caractères                                    | non    | Une vedette-matière.                                   |\n| `location`    | chaîne, jusqu'à 120 caractères                                    | non    | Un lieu.                                               |\n| `language`    | chaîne, jusqu'à 120 caractères                                    | non    | Une langue, écrite en anglais.                         |\n| `collection`  | chaîne, jusqu'à 160 caractères                                    | non    | Une collection, telle que `list_collections` la nomme. |\n| `online_only` | booléen, défaut `true`                                            | non    | Ne garder que les notices en ligne.                    |\n| `sort`        | `relevance`, `newest`, `oldest` ou `title`, défaut `relevance`    | non    | L'ordre des lignes.                                    |\n| `limit`       | entier, 1 à 50, défaut `10`                                       | non    | Lignes à servir.                                       |\n| `page`        | entier, 1 à 100, défaut `1`                                       | non    | Quelle page de lignes.                                 |\n\n**En retour :** `items`, chacun portant `identifier`, `title`, `creator`, `year`,\n`date` tel que publié, souvent un intervalle, `is_collection` et `source_url`. La\nbibliothèque tient un catalogue par type de chose, donc une recherche sans\n`media_type` lit le catalogue général, et `total` y compte les notices\ncorrespondantes.\n\n### `get_item`\n\nLit une notice. Les parties lourdes se demandent au lieu d'être servies par\ndéfaut, et une description longue se pagine.\n\n| Argument                | Type                                                                              | Requis | Ce qu'il fait                        |\n| ----------------------- | --------------------------------------------------------------------------------- | ------ | ------------------------------------ |\n| `identifier`            | chaîne, 1 à 300 caractères                                                        | oui    | L'identifiant que porte une ligne.   |\n| `sections`              | tableau de `basic`, `citations`, `resources`, `full_metadata`, défaut `[\"basic\"]` | non    | Les parties à rendre.                |\n| `offset`                | entier, 0 ou plus, défaut `0`                                                     | non    | Où reprendre la description.         |\n| `max_description_chars` | entier, 200 à 20000, défaut `2000`                                                | non    | La longueur de description à servir. |\n\n**En retour :** la notice avec son `title`, `creator`, `year`, `date`, `format`\net `source_url`, plus `description`, `subjects`, `location`, `language`,\n`part_of` pour les collections et divisions où elle se range, `repository` qui\nnomme le lieu de conservation de l'original, `call_number` et `rights`. Un champ\nque la notice laisse vide vaut `null`. `next_offset` poursuit une description\nlongue et vaut `null` à la fin. Un identifiant peut porter des barres obliques :\nun numéro de journal est nommé par son titre, sa date et son édition ensemble.\n\n### `list_collections`\n\nListe les collections numériques, ensembles de documents qu'un conservateur a\nchoisis, décrits et publiés ensemble.\n\n| Argument                | Type                            | Requis | Ce qu'il fait                                                      |\n| ----------------------- | ------------------------------- | ------ | ------------------------------------------------------------------ |\n| `limit`                 | entier, 1 à 50, défaut `20`     | non    | Collections à servir.                                              |\n| `page`                  | entier, 1 à 100, défaut `1`     | non    | Quelle page de collections.                                        |\n| `searchable_only`       | booléen, défaut `false`         | non    | Ne garder que celles auxquelles on peut restreindre une recherche. |\n| `max_description_chars` | entier, 80 à 2000, défaut `300` | non    | La longueur de chaque description à servir.                        |\n\n**En retour :** `collections`, chacune portant `identifier`, le slug qui\nl'adresse ; `title` ; `collection_filter`, la formulation que `search_items`\nreprend ; `searchable_media_types` ; `description` ; `item_count` ; `subjects` ;\n`formats` pour les types de choses qu'elle contient ; et `source_url`. `total`\ncompte les collections que la bibliothèque publie, ce qui dépasse le nombre\nrendu.\n\n## Ce que vaut un texte numérisé\n\nLes mots contenus dans une page de journal sont issus de la reconnaissance\noptique de caractères, donc un extrait porte les erreurs de lecture de ce\nprocédé. Il est servi tel qu'il a été lu plutôt que corrigé. Citez-le comme un\ntexte numérisé, et liez la page pour qu'un lecteur puisse regarder le feuillet\nlui-même.\n\n## Les droits\n\nUne notice énonce ses propres droits dans `rights`, et les conditions de la\nbibliothèque diffèrent d'un dépôt à l'autre. Lisez cette mention avant toute\nréutilisation, et redonnez-la à côté de ce qui est montré.\n\n## Configuration\n\nChaque variable est facultative. Elles se posent dans le bloc `env` de la\nconfiguration du client.\n\n| Variable                   | Défaut               | Ce qu'elle fait                                                                              |\n| -------------------------- | -------------------- | -------------------------------------------------------------------------------------------- |\n| `LOC_USER_AGENT`           | l'identité du projet | Nomme votre application auprès de la bibliothèque, avec une adresse où joindre une personne. |\n| `LOC_MIN_INTERVAL_MS`      | `6000`               | Écart entre deux requêtes, de 3000 à 60000.                                                  |\n| `LOC_TIMEOUT_MS`           | `30000`              | Délai d'une requête, de 1000 à 120000.                                                       |\n| `LOC_NEWSPAPER_TIMEOUT_MS` | `90000`              | Délai d'une recherche dans les journaux, de 1000 à 300000.                                   |\n| `LOC_MAX_RETRIES`          | `3`                  | Tentatives après un échec passager, de 0 à 8.                                                |\n| `LOC_CACHE_TTL_MS`         | `900000`             | Durée pendant laquelle une réponse reste en mémoire, de 0 à 86400000.                        |\n| `LOC_CACHE_MAX_ENTRIES`    | `200`                | Réponses gardées en mémoire à la fois, de 1 à 5000.                                          |\n| `LOC_LOG_LEVEL`            | `error`              | `silent`, `error`, `info` ou `debug`, écrit sur la sortie d'erreur.                          |\n\nUne valeur hors de sa plage retombe sur le défaut, et la raison est écrite sur la\nsortie d'erreur.\n\n## Erreurs\n\nChaque échec porte un des six codes, un message, et quand cela aide une\nindication du geste suivant.\n\n| Code            | Ce qui s'est passé                                   | Que faire                                                                                         |\n| --------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- |\n| `not_found`     | La bibliothèque a répondu, et n'a pas cette notice.  | Vérifiez l'identifiant avec `search_items`.                                                       |\n| `invalid_input` | Les arguments ont été refusés avant toute requête.   | Lisez le message, qui nomme l'argument.                                                           |\n| `rate_limited`  | La bibliothèque demande à ce client de ralentir.     | Attendez les secondes indiquées et rappelez avec les mêmes arguments. La notice est toujours là.  |\n| `parse_failure` | La réponse est arrivée dans une forme illisible ici. | Signalez-le sur [le suivi d'incidents](https://github.com/smeet666/mcp-libraryofcongress/issues). |\n| `network_error` | La requête n'a pas abouti.                           | Réessayez sous peu.                                                                               |\n| `timeout`       | La requête a dépassé son délai.                      | Augmentez `LOC_TIMEOUT_MS`, ou `LOC_NEWSPAPER_TIMEOUT_MS` pour une recherche dans les journaux.   |\n\n## Comme bibliothèque\n\nLa couche qui lit la bibliothèque est publiée seule, avec son rythme, son cache\net ses erreurs, sans protocole attaché.\n\n```ts\nimport { LocClient } from \"mcp-libraryofcongress/client\";\n\nconst client = new LocClient();\nconst { data, cached } = await client.searchItems({ query: \"tenement\", mediaType: \"photos\" });\nconsole.log(data.total, cached);\n```\n\nChaque lecture répond `{ data, cached }`, et lève une erreur portant un des six\ncodes. Le plancher entre deux requêtes tient également ici.\n\n## Rythme et attribution\n\nLa bibliothèque publie une limite de 20 requêtes par minute pour son API et de 10\npour l'ensemble du site, et c'est la plus basse qui gouverne : les requêtes\npartent une à une avec au moins six secondes entre elles, et le plancher de trois\nsecondes tient quelle que soit la configuration. Le `User-Agent` se termine\ntoujours par l'identité du projet et une adresse où joindre une personne.\n\nChaque résultat porte l'adresse de la page d'où il a été lu. La Library of\nCongress est une institution publique, et ses notices énoncent leurs propres\ndroits.\n\nCe MCP est un projet non officiel, sans affiliation à la Library of Congress.\n\n## Confidentialité\n\nCe serveur ne collecte rien sur vous et n'envoie rien à son auteur. Il tourne sur\nvotre machine, ne joint que `www.loc.gov` et `chroniclingamerica.loc.gov`, garde ses réponses en mémoire le temps qu'il\ntourne, et n'écrit rien sur le disque. [PRIVACY.md](PRIVACY.md) dit ce qu'une\nrequête emporte et quels réglages changent cela.\n\n## Développement\n\n```bash\nnpm install\nnpm run build:fixtures\nnpm test\nnpm run check\n```\n\nLes tests s'exécutent sur des fixtures engendrées et n'émettent aucune requête.\nLa suite en direct, `npm run test:live`, émet une requête par route et tourne\nchaque nuit contre la bibliothèque elle-même.\n\n## Contribuer\n\nLes anomalies, les questions et les idées ont leur place dans\n[le suivi d'incidents](https://github.com/smeet666/mcp-libraryofcongress/issues).\nLes propositions de modification sont bienvenues ; ouvrir un ticket d'abord aide\nà s'accorder sur la forme du changement. Voir [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Licence\n\nMIT, voir [LICENSE](LICENSE). Les notices appartiennent à la Library of Congress\net aux déposants qu'elle nomme, sous les droits que chaque notice énonce.\n",
  "bytes": 36688,
  "sha": "da701f3018a9044ee76c3454c24f01138e40f002d3d82349ccaa2ec9904a2d75",
  "repo_slug": "smeet666/mcp-libraryofcongress",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_smeet666_mcp_libraryofcongress_ef8590a8/readme"
}