# LibraryAPI

Gives your agent US public library facts: branches closest to an address, holdings, finances and state-level totals.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI
- Author: library-api
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/library-api/libraryapi-mcp
- Updated: 2026-10-04
- HTML: https://affpapa.org/en/nevibecode/mcp/libraryapi

## What it 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.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `LIBRARYAPI_KEY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add libraryapi-mcp -e LIBRARYAPI_KEY=<LIBRARYAPI_KEY> -- uvx libraryapi-mcp
```
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>

### Codex

**Platform CLI**
```bash
codex mcp add libraryapi --env LIBRARYAPI_KEY=<LIBRARYAPI_KEY> -- uvx libraryapi-mcp
```
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>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "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>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "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>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e LIBRARYAPI_KEY=<LIBRARYAPI_KEY> libraryapi uvx libraryapi-mcp
```
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>

## When to use it
- 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
- 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.

## Similar
- [dashboarding](https://affpapa.org/en/nevibecode/skills/dashboarding.md) — skill · 8500 installs
- [openfda-database](https://affpapa.org/en/nevibecode/skills/openfda-database.md) — skill · 2200 installs
- [HasData Facebook](https://affpapa.org/en/nevibecode/mcp/hasdata-facebook.md) — MCP server · ★ 11
- [HasData Zillow](https://affpapa.org/en/nevibecode/mcp/hasdata-zillow.md) — MCP server · ★ 10
- [golang-popular-libraries](https://affpapa.org/en/nevibecode/skills/golang-popular-libraries.md) — skill · 39500 installs
- [geolocate-from-pixels](https://affpapa.org/en/nevibecode/skills/geolocate-from-pixels.md) — skill · 1800 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
