Australian Pharmaceutical Benefits Scheme PBS API Server using Anthropic MCP with natural language LLM integration
A standalone Model Context Protocol (MCP) server for accessing the Australian Pharmaceutical Benefits Scheme (PBS) API.
This PBS MCP server was developed by [Matthew Cage], Founder of https://ai-advantage.au, specialist in Automation, AI Engineering and AI integration and healthcare data systems.
Collaborate with me: https://www.linkedin.com/in/digitalmarketingstrategyexpert/
This project provides a standalone MCP server that allows AI models to access the Australian Pharmaceutical Benefits Scheme (PBS) API, which contains information about medicines, pricing, and availability in Australia.
The project is built for the Public API, but can easily be adapted to the private API if you have been granted developer access.
The PBS API provides programmatic access to PBS data, including medicine listings, pricing, and availability. This MCP server makes it easy to integrate PBS data into AI workflows.
The MCP is available via HTTP and CLI.
Please be aware of the rate limits for the PBS and adjust your request frequency. I recommend a periodic call to store the information you require from the API and update it on a weekly basis.
This MCP server implements the following Model Context Protocol features:
The MCP Client :
This enables AI assistants to access up-to-date PBS information without needing to have this data in their training.
Clone this repository:
git clone <repository-url>
cd pbs-mcp-standalone
Install dependencies:
npm install
Build the project:
npm run build
The PBS MCP server can be run in different modes:
This mode is compatible with the MCP protocol and communicates via standard input/output streams:
npm start
Or use the provided start script:
./start.sh
This mode starts an HTTP server with Server-Sent Events (SSE) support:
npm run start:http
Or use the provided start script:
./start.sh http 3000
Where 3000
is the port number to listen on.
The PBS MCP server can also be used as a command-line tool:
npm run cli -- <command>
Or use the provided start script:
./start.sh cli <command>
For example:
./start.sh cli info
To use this MCP server as a command-line tool:
Build the project:
npm run build
Run the CLI with the desired command:
npm run cli -- <command>
Or use the start script:
./start.sh cli <command>
This server can be integrated with any MCP-compatible client, such as:
Here's an example of how to configure this server with an MCP client:
{
"mcpServers": {
"pbs-api": {
"command": "node",
"args": ["path/to/pbs-mcp-standalone/build/index.js"],
"env": {
"PBS_API_SUBSCRIPTION_KEY": "your-subscription-key-here"
}
}
}
}
To access this MCP server from a client:
For Claude Desktop or other MCP-compatible AI assistants:
For custom applications:
The server can interpret various prompts from LLMs, such as:
"Find information about metformin in the PBS"
"What is the PBS code for insulin?"
"List all prescribers who can prescribe antibiotics"
"Get the latest pricing for asthma medications"
These natural language prompts are translated into appropriate PBS API calls.
The PBS API tool can be used with the following parameters:
{
"endpoint": "prescribers",
"method": "GET",
"params": {
"get_latest_schedule_only": "true",
"limit": "20"
}
}
endpoint
(string, required): The specific PBS API endpoint to access (e.g., "prescribers", "item-overview")method
(string, optional): HTTP method to use (GET is recommended for most PBS API operations). Default: "GET"params
(object, optional): Query parameters to include in the requestsubscriptionKey
(string, optional): Custom subscription key. If not provided, the default public key will be usedtimeout
(number, optional): Request timeout in milliseconds. Default: 30000When running in HTTP mode, the following endpoints are available:
GET /health
Returns the status of the server.
GET /tools
Returns a list of available tools.
GET /sse
Establishes an SSE connection and sends tool events.
POST /sse/:toolName
Invokes a tool and sends the result via SSE.
POST /api/:toolName
Invokes a tool and returns the result as JSON.
The PBS MCP server can be used as a command-line tool with the following commands:
./start.sh cli list-endpoints
Lists all available PBS API endpoints.
./start.sh cli info
Returns information about the PBS API.
./start.sh cli prescribers [options]
Options:
-l, --limit <number>
: Number of results per page (default: 10)-p, --page <number>
: Page number (default: 1)-c, --pbs-code <code>
: Filter by PBS code-s, --schedule-code <code>
: Filter by schedule code-t, --prescriber-type <type>
: Filter by prescriber type-f, --fields <fields>
: Specific fields to return--latest
: Get only the latest schedule./start.sh cli item-overview [options]
Options:
-l, --limit <number>
: Number of results per page (default: 10)-p, --page <number>
: Page number (default: 1)-s, --schedule-code <code>
: Filter by schedule code-f, --fields <fields>
: Specific fields to return--latest
: Get only the latest schedule./start.sh cli query <endpoint> [options]
Options:
-m, --method <method>
: HTTP method (default: GET)-p, --params <json>
: Query parameters as JSON string-k, --subscription-key <key>
: Custom subscription key-t, --timeout <milliseconds>
: Request timeout in milliseconds./start.sh cli serve [options]
Options:
-p, --port <number>
: Port to listen on (default: 3000)The PBS API provides several endpoints for accessing different types of data:
/
- Root endpoint, provides API information and changelog/prescribers
- Information about prescribers/item-overview
- Detailed information about PBS items/items
- Basic information about PBS items/schedules
- Information about PBS schedules/atc-codes
- Anatomical Therapeutic Chemical (ATC) classification codes/organisations
- Information about organisations/restrictions
- Information about restrictions/parameters
- Information about parameters/criteria
- Information about criteria/copayments
- Information about copayments/fees
- Information about fees/markup-bands
- Information about markup bands/programs
- Information about programs/summary-of-changes
- Summary of changesFor a complete list of endpoints, see the PBS API documentation.
{
"endpoint": ""
}
{
"endpoint": "prescribers",
"params": {
"get_latest_schedule_only": "true",
"limit": "10"
}
}
{
"endpoint": "item-overview",
"params": {
"get_latest_schedule_only": "true",
"limit": "5"
}
}
{
"endpoint": "prescribers",
"params": {
"pbs_code": "10001J",
"get_latest_schedule_only": "true"
}
}
The tool uses a subscription key for accessing the PBS API. You can obtain your own key by registering on the PBS Developer Portal.
For development purposes, see the .env.example
file for configuration details.
To obtain your own PBS API subscription key, follow these steps:
Visit the PBS Data API Portal:
Create an Account:
Subscribe to the PBS API:
Retrieve Your Subscription Key:
Configure Your Environment:
.env
file based on the .env.example
templateyour-subscription-key-here
with your actual subscription key:
PBS_API_SUBSCRIPTION_KEY=your-actual-subscription-key
Note: The PBS Public API is rate-limited to one request per 20 seconds. This limit is shared among all users of the public API. For higher rate limits or access to embargo data (future schedules), you may need to apply for special access through the PBS Developer Program.
This project is licensed under the MIT License - see the LICENSE file for details.
❤️