wmo4buva/loc-mcp-server
If you are the rightful owner of loc-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server providing access to the U.S. Library of Congress digital collections API.
Library of Congress MCP Server
A Model Context Protocol (MCP) server providing access to the U.S. Library of Congress digital collections API. This server enables Claude and other MCP clients to search, browse, and retrieve information from the Library of Congress's vast digital archives.
Features
- 🔍 Universal Search: Search across all Library of Congress digital collections
- 📚 Format-Specific Search: Search within specific material types (books, audio, photos, maps, etc.)
- 🏛️ Collection Browsing: Browse and explore digital collections
- 📄 Item Details: Get detailed information about specific items
- 🔗 Resource Access: Access individual pages and segments of items
- 📊 Advanced Filtering: Filter results by location, subject, contributor, and more
Available Tools
loc_search
Search across all Library of Congress digital collections.
Parameters:
query(optional): Search query stringfacets(optional): Array of facet filters (e.g., ["location:ohio", "subject:baseball"])count(optional): Results per page (1-100, default 25)page(optional): Page number for paginationsort(optional): Sort by date, title, or shelf ID (with _asc/_desc)attributes(optional): Specific attributes to return
loc_search_format
Search within a specific material format.
Parameters:
format(required): One of: audio, books, film-and-videos, journals, maps, manuscripts, music, newspapers, notated-music, photos, prints, software, web-pagesquery(optional): Search query string- Other parameters same as
loc_search
loc_get_collections
Get a list of all available digital collections.
Parameters:
count(optional): Collections per pagepage(optional): Page number
loc_get_collection
Get information about a specific collection and browse its contents.
Parameters:
collectionName(required): Collection identifierquery(optional): Search within the collectioncount(optional): Items per pagepage(optional): Page number
loc_get_item
Get detailed information about a specific item.
Parameters:
itemId(required): Item identifierattributes(optional): Specific attributes to return
loc_get_resource
Get information about a specific resource (page/segment of an item).
Parameters:
resourceId(required): Resource identifierattributes(optional): Specific attributes to return
Installation
npm install
npm run build
Integration with AI Desktop Applications
This MCP server works with any application that supports the Model Context Protocol (MCP).
Claude Desktop
Add to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"loc": {
"command": "node",
"args": ["/path/to/loc-mcp-server/dist/index.js"],
"env": {
"NODE_ENV": "production"
}
}
}
}
Or use npx (after publishing to npm):
{
"mcpServers": {
"loc": {
"command": "npx",
"args": ["loc-mcp-server"]
}
}
}
OpenAI ChatGPT Desktop
Add to your ChatGPT Desktop configuration file:
macOS: ~/Library/Application Support/ChatGPT/config.json
Windows: %APPDATA%/ChatGPT/config.json
Linux: ~/.config/ChatGPT/config.json
{
"mcpServers": {
"loc": {
"command": "node",
"args": ["/absolute/path/to/loc-mcp-server/dist/index.js"],
"env": {
"NODE_ENV": "production"
}
}
}
}
Note: Replace /absolute/path/to/loc-mcp-server with the actual path where you cloned this repository.
Other MCP-Compatible Applications
This server follows the standard MCP protocol and should work with any MCP-compatible application. Refer to your application's documentation for MCP server configuration instructions.
Example Queries
Search for Abraham Lincoln materials:
Use the loc_search tool to find materials related to Abraham Lincoln
Find historical photographs:
Use the loc_search_format tool to search for "civil war" in the "photos" format
Browse a specific collection:
Use the loc_get_collection tool to explore the "american-folklife-center" collection
Get item details:
Use the loc_get_item tool to get detailed information about a specific item ID
API Information
This server uses the Library of Congress JSON/YAML API:
- Base URL: https://www.loc.gov/
- Documentation: https://www.loc.gov/apis/json-and-yaml/requests/
- No authentication required
Rate Limiting
Important: The Library of Congress API has strict rate limits:
- 20 requests per minute maximum
- 1 hour blocking if rate limit is exceeded
- 429 status codes trigger automatic retry with exponential backoff
This MCP server implements:
- ✅ Automatic rate limiting (20 requests/minute)
- ✅ Request queuing and spacing
- ✅ 429 status code handling with retry logic
- ✅ Exponential backoff for failed requests
- ✅ Automatic window reset every minute
Available Material Formats
- audio: Audio recordings and spoken word
- books: Books and texts
- film-and-videos: Motion pictures and videos
- journals: Periodicals and serials
- maps: Maps and cartographic materials
- manuscripts: Handwritten and typescript materials
- music: Musical recordings and scores
- newspapers: Newspaper collections
- notated-music: Sheet music and scores
- photos: Photographs and images
- prints: Prints and graphic arts
- software: Digital software and programs
- web-pages: Archived web content
Common Facet Filters
Use these in the facets parameter to filter results:
location:state_name(e.g., "location:virginia")subject:topic(e.g., "subject:baseball")contributor:name(e.g., "contributor:lincoln")language:code(e.g., "language:english")date:year(e.g., "date:1865")
Development
# Install dependencies
npm install
# Build
npm run build
# Run in development mode
npm run dev
# Start the server
npm start
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.