MCP Server

Cataloger MCP Server

Give Claude and other AI assistants direct access to the Library of Congress authorities database. Search LCSH and LCNAF through the Model Context Protocol.

What is MCP?

The Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. Instead of the AI guessing or relying on training data, MCP lets it reach out to authoritative databases in real time.

The Cataloger MCP Server bridges AI assistants with the Library of Congress's public APIs, giving them the ability to search for subject headings and name authorities on demand — producing results grounded in the world's most authoritative cataloging data.

Key Features

🔍

Three Search Tools

Left-anchored LCSH search, flexible keyword LCSH search, and LCNAF personal name search — each optimized for different query types.

🔄

Dual Operation Modes

stdio mode for direct Claude Desktop integration, or HTTP/SSE mode for network-based access on any port.

📡

Resource Endpoints

Programmatic access via lcsh://search/query and lcnaf://search/query resource URIs.

🛡️

Robust Error Handling

Gracefully handles network errors, API timeouts, and malformed responses. Supports both current and legacy LOC API formats.

Fast & Lightweight

Built on FastMCP with minimal dependencies. Python 3.12+, just requests and the MCP SDK.

🤖

Claude Desktop Ready

Register in Claude Desktop settings and Claude gains immediate access to LOC authorities during conversation.

API Reference

search_lcsh

Searches the Library of Congress Subject Headings using the public suggest2 API. Uses left-anchored matching (default, precise).

Parameters

query string The search term to look for in LCSH

Response

{
  "results": [
    {
      "label": "Subject Heading Label",
      "uri": "http://id.loc.gov/authorities/subjects/..."
    }
  ]
}

search_lcsh_keyword

Searches LCSH using keyword-based matching — more flexible than left-anchored search. Requests up to 50 results.

Parameters

query string The search term to look for in LCSH

Response

Same format as search_lcsh

search_name_authority

Searches the Library of Congress Name Authorities (LCNAF) for Personal Names.

Parameters

query string The search term to look for in LCNAF

Response

{
  "results": [
    {
      "label": "Name Authority Label",
      "uri": "http://id.loc.gov/authorities/names/..."
    }
  ]
}

Resource Endpoints

URI Description
lcsh://search/{query} Direct access to LCSH search results
lcnaf://search/{query} Direct access to Name Authority search results

Installation & Setup

Requirements

  • Python 3.12 or higher
  • mcp[cli]>=1.6.0 — Model Context Protocol Python SDK
  • requests>=2.32.3 — HTTP library

Install from Source

# Clone the repository
git clone <repository-url>
cd lcsh-mcp

# Set up a virtual environment
python -m venv .venv
source .venv/bin/activate

# Install dependencies
uv pip install -e .

Running in stdio Mode (Default)

Ideal for direct integration with Claude Desktop:

python server.py

Running in HTTP/SSE Mode

For network-based connections:

python server.py 6274

The server will be accessible at http://localhost:6274.

Claude Desktop Integration

Connect the MCP server to Claude Desktop in a few steps:

  1. Start the server in stdio mode: python server.py
  2. In Claude Desktop, go to Settings > MCP Servers
  3. Click "Add Server" with the following configuration:
    • Name: cataloger mcp Search
    • Command: python /path/to/cataloger-mcp/server.py
  4. Enable the server toggle
  5. Start using LOC search capabilities in your conversations

Example Prompts

  • "Find the LCSH term for climate change"
  • "Search LCSH for artificial intelligence policy using keyword search"
  • "Look up the name authority for Fitzgerald, F. Scott"
  • "What are the official LCSH headings related to machine learning?"

Testing with MCP Inspector

The MCP Inspector is a visual testing tool for MCP servers.

1. Install MCP Inspector

npm install -g @modelcontextprotocol/inspector
# or use directly with npx:
npx @modelcontextprotocol/inspector

2. Start the Server in HTTP Mode

python server.py 6274

3. Connect the Inspector

CLI mode:

npx @modelcontextprotocol/inspector --cli http://localhost:6274

Web interface:

npx @modelcontextprotocol/inspector

Access at http://localhost:3000, then add your server URL.

4. Test the Tools

# List tools
npx @modelcontextprotocol/inspector --cli http://localhost:6274 --method tools/list

# Test search_lcsh
npx @modelcontextprotocol/inspector --cli http://localhost:6274 \
  --method tools/call --tool-name search_lcsh --tool-arg query=history

# Test search_lcsh_keyword
npx @modelcontextprotocol/inspector --cli http://localhost:6274 \
  --method tools/call --tool-name search_lcsh_keyword \
  --tool-arg query="artificial intelligence policy"

# Test search_name_authority
npx @modelcontextprotocol/inspector --cli http://localhost:6274 \
  --method tools/call --tool-name search_name_authority \
  --tool-arg query="Smith, John"

# List resources
npx @modelcontextprotocol/inspector --cli http://localhost:6274 \
  --method resources/list

Troubleshooting

Server won't start

Ensure Python 3.12+ is installed. Check that all dependencies are installed with uv pip install -e .

No results returned

The LOC API may be temporarily unavailable. Try again in a few minutes. Check your internet connection.

Claude Desktop doesn't see the server

Verify the server path in Claude Desktop settings. Make sure the server is running and the toggle is enabled.

Technologies

Python 3.12+FastMCPMCP SDKrequestsclickuvicornpytest