Book4Time MCP Server
by Vikaskkg
README.md
# Book4Time MCP Server — Azure Function App
## File structure
```
mcp_azure/
├── function_app.py # Azure Function entry point + HTTP trigger
├── mcp_server.py # FastMCP server + product tool
├── requirements.txt # Python dependencies
├── host.json # Azure Functions host config
├── local.settings.json.template # Copy → local.settings.json for local dev
└── README.md
```
## How it works
1. **MCP client** (e.g. Claude Desktop) sends a JSON-RPC `POST` to your Azure Function URL.
2. **`function_app.py`** catches the request via the `mcp/{*path}` HTTP trigger.
3. The request is forwarded into **FastMCP's Streamable HTTP ASGI app**.
4. FastMCP routes it to the **`product` tool** in `mcp_server.py`.
5. The tool calls the **Book4Time API** with your credentials from App Settings.
6. The JSON response travels back up the chain to the MCP client.
## Local development
```bash
# 1. Install dependencies
pip install -r requirements.txt
# 2. Configure secrets
cp local.settings.json.template local.settings.json
# Edit local.settings.json — fill in BOOK4TIME_API_TOKEN and BOOK4TIME_ACCOUNT_TOKEN
# 3. Start the Functions runtime
func start
```
The MCP endpoint will be at:
```
http://localhost:7071/api/mcp
```
## Deploy to Azure
```bash
# 1. Create resource group and Function App (one-time)
az group create --name rg-book4time-mcp --location uksouth
az functionapp create \
--resource-group rg-book4time-mcp \
--consumption-plan-location uksouth \
--runtime python \
--runtime-version 3.11 \
--functions-version 4 \
--name <YOUR_APP_NAME> \
--storage-account <YOUR_STORAGE_ACCOUNT>
# 2. Set the API tokens as App Settings (not in code)
az functionapp config appsettings set \
--name <YOUR_APP_NAME> \
--resource-group rg-book4time-mcp \
--settings \
BOOK4TIME_API_TOKEN="your_real_api_token" \
BOOK4TIME_ACCOUNT_TOKEN="your_real_account_token"
# 3. Deploy the code
func azure functionapp publish <YOUR_APP_NAME>
```
The live MCP endpoint will be:
```
https://<YOUR_APP_NAME>.azurewebsites.net/api/mcp
```
## Connect from Claude Desktop
In `claude_desktop_config.json`:
```json
{
"mcpServers": {
"book4time": {
"url": "https://<YOUR_APP_NAME>.azurewebsites.net/api/mcp?code=<FUNCTION_KEY>"
}
}
}
```
Get your function key from the Azure Portal → Function App → App keys.
## Adding more tools
Add new `@mcp.tool()` functions to `mcp_server.py` — they are automatically
discovered and registered. No changes needed in `function_app.py`.
```python
@mcp.tool()
async def bookings(location_id: str = "11506000") -> dict:
"""Fetch bookings from Book4Time."""
...
```
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues