freshbooks_authenticate
Initiate OAuth2 authentication for FreshBooks to securely access accounting features. Generates a browser URL for authorization and automatically saves tokens.
Instructions
Start FreshBooks OAuth2 authentication. Returns a URL to open in your browser. After authorizing, tokens are saved automatically.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_freshbooks/server.py:78-94 (handler)Implementation of the freshbooks_authenticate tool which starts the OAuth2 flow by getting an auth URL and launching a local callback server.
@mcp.tool() def freshbooks_authenticate() -> str: """Start FreshBooks OAuth2 authentication. Returns a URL to open in your browser. After authorizing, tokens are saved automatically.""" config = auth.get_config() url = auth.get_auth_url(config) port = int(config["redirect_uri"].split(":")[-1].split("/")[0]) def _run_server(): auth.start_callback_server(config, port) thread = threading.Thread(target=_run_server, daemon=True) thread.start() return ( f"Open this URL in your browser to authorize:\n\n{url}\n\n" f"Waiting for callback on localhost:{port}..." )