https://gmail.run.tools, and read their inbox from
trusted server code.
Prerequisites
- Node.js 20 or later
- pnpm
- A Google account with Gmail enabled
Create your broker and read Gmail
1
Scaffold a Node.js project
Install the latest Hookfish CLI, run the initializer, and enter the
generated directory.The initializer installs dependencies and creates a gitignored
.env with
unique OAUTH_ENCRYPTION_KEY and HOOKFISH_API_KEY values.2
Install the clients
Add the first-party Hookfish SDK and the MCP TypeScript client to the
generated Node.js project.
3
Add an inbox endpoint
Replace The
src/index.ts with this Hono API. The /gmail/inbox endpoint keeps
the broker access token and Gmail access token on the server./api/* route mounts Hookfish, including its API documentation at
/api/docs.4
Start the API
Start the generated backend and dashboard.
5
Request the inbox
Call the application endpoint from another terminal.The first request returns
401 Unauthorized with an authorize_url. Open
that URL, sign in with Google, and approve access. After Hookfish handles the
callback, run the same command again. The endpoint now returns the MCP tool
result for the user’s inbox.You now have one Hono endpoint that returns an authorization URL until Gmail
is connected, then returns the user’s inbox through MCP. Hookfish stores and
refreshes the provider token behind that endpoint.
Understand the generated project
The default development command runs two processes:hookfish.config.ts contains provider factories, database
configuration, callback settings, and documentation visibility. The backend
mounts HookfishServer.init(config).fetch below /api.
Next steps
- Read How Hookfish works to understand the callback and token-refresh lifecycle.
- Choose a deployment backend.
- Replace the root key with a scoped broker token.
- Add application authentication, then call Hookfish from your authorized server routes.