Nlb
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"nikhil-grayscale-nlb-mcp": {
"command": "fastmcp",
"args": [
"run",
"nlb_mcp/server.py:create_server"
],
"env": {
"NLB_API_KEY": "YOUR_API_KEY",
"NLB_API_BASE": "https://openweb.nlb.gov.sg/api/v2/Catalogue",
"NLB_APP_CODE": "YOUR_APP_CODE",
"REQUEST_TIMEOUT_MS": "10000"
}
}
}
}This MCP server provides an interface to query the NLB Singapore Library Catalogue for availability and title search. It exposes health checks, title search capabilities, advanced, fielded searches, and per-title availability information, all through a FastMCP-based API. You can run it locally for development or deploy it to the FastMCP Cloud for managed hosting and OAuth2-based user flows.
How to use
You interact with this MCP server through a compatible MCP client. The server exposes tools to validate environment readiness, search by keywords across BRN/ISBN/Title/Author/Subject, perform fielded searches with pagination and sorting, and retrieve branch-level availability for a given title or identifier.
How to install
Prerequisites: Python 3.11 or later, and a shell environment to run commands.
- Create and activate a virtual environment.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
- Set up environment variables needed for the NLB API.
export NLB_API_KEY=your_api_key
export NLB_APP_CODE=your_app_code
export NLB_API_BASE=https://openweb.nlb.gov.sg/api/v2/Catalogue
export REQUEST_TIMEOUT_MS=10000
- Run the MCP server locally.
fastmcp run nlb_mcp/server.py:create_server
Additional notes
The server uses the FastMCP OAuth2 provider for user authentication, relying on the env-provided keys for NLB API access. No user-provided API keys are accepted or logged by the server. You can also deploy to FastMCP Cloud using the same start command for managed hosting.
Logging uses the standard Python logging framework with redacted secrets. You can extend logging or add metrics as needed for your environment.
Available tools
health_check
Validate environment and startup readiness to ensure the MCP server can start and operate correctly.
search_titles
Keyword search across BRN, ISBN, Title, Author, and Subject to return matching records.
search_titles_advanced
Advanced fielded search with support for pagination and sorting to refine results.
availability_by_title
Fetch branch-level availability for a given Title, ISBN, or BID to show holdings in libraries.