LibraryAPI — Claude Code MCP server for US public library data
Gives your agent US public library facts: branches closest to an address, holdings, finances and state-level totals.
claude mcp add libraryapi-mcp -e LIBRARYAPI_KEY=<LIBRARYAPI_KEY> -- uvx libraryapi-mcpWhat LibraryAPI does
The server talks to libraryapi.dev, which is built on the federal IMLS Public Libraries Survey. That data is public domain and cleared for commercial use. Six tools come with it: branch lookup by address or by latitude and longitude, a full outlet record by ID, a search over library systems by name, state or city, a system profile by FSCS ID, and statewide totals.
A system and an outlet are not the same thing. The system is the administrative body, an outlet is one building. Distance searches hand back outlets.
You need a free key from libraryapi.dev before anything works: 500 requests a month, no card. The key goes into LIBRARYAPI_KEY, and without it the server cannot authenticate. It launches through uvx libraryapi-mcp, so Python and uvx have to be present. Opening hours come only as annual and weekly totals. If you need to know that a branch opens at 9am, this server will not tell you, which matters for anything that builds a schedule.
What it helps with
- locate the nearest branches to a given US street address
- pull one branch record by its outlet ID
- list library systems by state or city
- get statewide library totals for a report
- feed collection and finance figures into an app
Example prompts for the agent
- Name the three public libraries closest to 350 Fifth Ave, New York.
- How many branches does Vermont have, and how big are their collections combined?
- Dump every branch within five miles of downtown Chicago as JSON.
How to install LibraryAPI
Platform CLI
claude mcp add libraryapi-mcp -e LIBRARYAPI_KEY=<LIBRARYAPI_KEY> -- uvx libraryapi-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from libraryapi-mcp <command>
Platform CLI
codex mcp add libraryapi --env LIBRARYAPI_KEY=<LIBRARYAPI_KEY> -- uvx libraryapi-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from libraryapi-mcp <command>
Config file
{
"mcpServers": {
"libraryapi": {
"command": "uvx",
"args": [
"libraryapi-mcp"
],
"env": {
"LIBRARYAPI_KEY": "<LIBRARYAPI_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from libraryapi-mcp <command>
Config file
{
"servers": {
"libraryapi": {
"type": "stdio",
"command": "uvx",
"args": [
"libraryapi-mcp"
],
"env": {
"LIBRARYAPI_KEY": "<LIBRARYAPI_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from libraryapi-mcp <command>
Platform CLI
gemini mcp add -e LIBRARYAPI_KEY=<LIBRARYAPI_KEY> libraryapi uvx libraryapi-mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from libraryapi-mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about LibraryAPI
How do I install LibraryAPI in Claude Code?
Run claude mcp add libraryapi-mcp -e LIBRARYAPI_KEY=<LIBRARYAPI_KEY> -- uvx libraryapi-mcp, replacing the placeholder with a key from libraryapi.dev.
What does LibraryAPI do?
It exposes tools that let an agent look up US public libraries: outlets near an address or coordinates, system profiles, single outlet records and state summaries.
Where does the data come from?
The IMLS Public Libraries Survey: locations, collections, staffing, visits, programs and finances. Hours are reported as annual and weekly totals, not as daily opening times.