Back to MCP

MCP guides · Sep 15, 2026

Create a Gemini CLI cron job for a service endpoint

Authorize Crontap in Gemini CLI, then schedule and inspect a deployed search-index refresh endpoint from the terminal.
crontap.com / mcp guides
Add Crontap to Gemini CLI over Streamable HTTP, complete OAuth, and create and verify a recurring request for a CLI-built service endpoint.

You used Gemini CLI to build and deploy POST /internal/search/reindex. Now the service needs a routine refresh every six hours, with enough evidence to tell whether the scheduler or the endpoint failed. This walkthrough connects Gemini CLI to Crontap, authorizes it in the browser, and creates the HTTP schedule. You need a Crontap account, a current Gemini CLI installation, and a deployed HTTPS endpoint. Crontap schedules the request; it does not rerun a Gemini prompt.

Before you start

  • Run the endpoint manually and make it idempotent before scheduling it.
  • Decide whether Crontap belongs in project scope or user scope. Gemini CLI defaults gemini mcp add to project scope.
  • Leave the server untrusted so Gemini CLI shows confirmation for MCP tool calls.
  • Verified against the Gemini CLI MCP documentation and command reference on 2026-09-15.

Connect Gemini CLI to Crontap

Gemini CLI

gemini mcp add --transport http crontap https://mcp.crontap.com/mcp

Gemini CLI supports remote HTTP MCP servers with OAuth.

The command adds an HTTP transport entry for https://mcp.crontap.com/mcp. Add --scope user before crontap if you want it in ~/.gemini/settings.json; otherwise it is written to .gemini/settings.json for the current project.

Step 1

Add the remote HTTP server

Run the selected gemini mcp add --transport http command in your shell. Do not add --trust: Gemini CLI documents that trust bypasses all tool-call confirmations for the server. gemini mcp list should show the Crontap server definition.

Step 2

Complete OAuth in Gemini CLI

Start an interactive gemini session, then run /mcp auth crontap. Gemini CLI uses automatic OAuth discovery for remote HTTP servers and opens the authorization flow. After returning to the terminal, run /mcp list; the server should be connected. Use /mcp schema when you need to inspect the discovered tool schemas.

Gemini CLI MCP connection
Crontap
Connected
Authentication
OAuth 2.1

Step 3

Preview a six-hour cadence

Ask Gemini to preview every six hours in UTC without creating a resource. Check the three upcoming run times. A preview is useful here because “every six hours” is interval-shaped and does not depend on a local business timezone.

Step 4

Create the reindex schedule

Ask Gemini to create a POST request to https://search.example.com/internal/search/reindex. Review the confirmation and approve only the exact URL, method, cadence, and timezone. If the service expects X-Reindex-Key, leave the value out of the prompt, open the returned schedule in Crontap, and add the header there.

Step 5

Inspect the resource and first run

Retrieve the schedule by the returned ID and confirm its status and next run. In Crontap, perform a test request after adding any secret header. Then ask Gemini for the schedule history and compare it with the search service logs.

Copyable Gemini CLI prompts

Use Crontap MCP. Preview a schedule that runs every six hours in UTC. Show the three upcoming runs. Do not create or update anything.
Create a schedule named "search index refresh" that POSTs to https://search.example.com/internal/search/reindex on the cadence we previewed. Before the create call, show the final fields and ask for confirmation. Do not include authentication headers.
Retrieve the schedule by the exact ID from the create result, then inspect its latest history. Report the URL, method, active status, next run, latest HTTP status, and duration. Do not modify the schedule.

Verify the endpoint schedule

Use /mcp list inside Gemini CLI to confirm the server is connected. If tools changed after a reconnect, /mcp reload re-discovers them. The create call should produce one schedule ID. The read-back call should use that ID rather than guessing from a similar name.

In Crontap, open the same schedule. Confirm POST, the deployed production hostname, UTC, and the six-hour cadence. Add the endpoint secret in the schedule UI and perform a test. The resulting history entry records the HTTP status and duration received by Crontap.

Finally, inspect your service logs. Find the request and verify that the index generation or source timestamp advanced. An HTTP 200 can still hide application work that did nothing, so the service-level result is the final check.

Gemini CLI or Crontap as the clock?

Gemini CLI is an interactive MCP client in this guide. It can create and inspect the resource, but closing the terminal does not cancel a saved schedule. Crontap continues sending the recurring HTTP request.

If you need a command to run in a deployment environment, use that platform's native scheduled job. If you need to call an existing API route, Crontap is the direct fit. If another process already runs and you only need to know when it stops, use a heartbeat.

Troubleshooting

gemini mcp list shows a connection issue

Confirm the transport is http, not stdio or sse, and that the URL is https://mcp.crontap.com/mcp. Gemini CLI keeps startup errors quiet by default; /mcp list surfaces detailed diagnostics.

/mcp auth crontap does not open authorization

Make sure the server was added as remote HTTP and retry the command in an interactive session. Corporate browsers and security tools must allow the OAuth redirect to a random localhost port.

Tools are missing after authorization

Run /mcp reload, followed by /mcp schema. If enterprise controls define required or allowed servers, a local project entry can be filtered or overridden by policy.

Gemini executes without asking

Remove trust: true from the server entry or re-add the server without --trust. Trust bypasses confirmations for all tools from that server, which is too broad for resource writes.

The endpoint returns 401 or 403

The connection to Crontap worked, but your service rejected the scheduled request. Compare the header configured in the Crontap UI with the deployment secret. Never paste the secret into the CLI conversation.

Next steps

Ready to schedule the service endpoint? Free forever tier. No credit card. Create your Crontap account →

Verified against current official Gemini CLI MCP documentation on 2026-09-15. Sources: Gemini CLI MCP servers and Gemini CLI commands.

FAQ

Gemini CLI cron job questions

How do I add a Streamable HTTP MCP server to Gemini CLI?
Use gemini mcp add --transport http followed by the server name and URL. The default scope is project; add --scope user when you want the server in your user settings.
How does Gemini CLI authenticate with Crontap?
Gemini CLI can discover OAuth for remote HTTP servers. In an interactive Gemini session, run /mcp auth crontap and complete the browser flow.
Does Gemini CLI run the HTTP schedule?
No. Gemini CLI manages the Crontap resource through MCP. Crontap sends the recurring HTTP requests after the schedule is saved.
Should I mark the Crontap server as trusted?
Leave trust disabled so tool calls require confirmation. The --trust option bypasses all MCP tool confirmation prompts for that server.

From the blog

Read the blog

Guides, patterns and product updates.

Tutorials on scheduling API calls, webhooks and automations, plus deep dives into cron syntax, timezones and reliability.

Product Updates

Introducing AI Integrations

Transform a schedule's HTTP response with a plain-English prompt, return text or JSON, and forward it to Slack, Make, n8n, or your own endpoint. Test on any tier; saving is a Pro feature.

Alternatives

Vercel cron jobs: the Hobby once-per-day limit and how to beat it

Vercel Cron caps Hobby at one run per day, only guarantees timing within the hour, is UTC only, and ties every schedule change to a redeploy. Here is the external cron pattern teams use to ship per-minute, timezone-aware schedules and one dashboard across projects without paying $20/mo per user for Pro.