Skip to main content
Create a standalone Node.js broker, connect a user’s Gmail account through the remote MCP server at 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
You do not need to create a Google OAuth application. The MCP provider uses the server’s authorization metadata and dynamic client registration.

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 src/index.ts with this Hono API. The /gmail/inbox endpoint keeps the broker access token and Gmail access token on the server.
The /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.
This quickstart leaves /gmail/inbox unauthenticated for local testing. Authenticate the application user and use a scoped broker token before you deploy it.

Understand the generated project

The default development command runs two processes:
The generated hookfish.config.ts contains provider factories, database configuration, callback settings, and documentation visibility. The backend mounts HookfishServer.init(config).fetch below /api.

Next steps