Back to MCP

MCP guides · Sep 15, 2026

Create and debug an HTTP cron job from Claude Code

Install the remote server with one command, create a recurring HTTP job, and inspect retained history when the endpoint fails.
crontap.com / mcp guides
Add Crontap MCP with the Claude Code CLI, create a nightly HTTP schedule, inspect run history, and separate durable jobs from session tasks.

This walkthrough gives Claude Code a durable HTTP schedule to manage. You will add Crontap with the CLI, schedule https://example.com/nightly-import for 2:15 AM, and use retained history to debug a failed run. Allow about five minutes for setup. Crontap calls the route outside the Claude Code session. It does not keep the terminal open or run a Claude prompt on a timer.

Before you start

  • Install a current Claude Code release and authenticate it normally.
  • Have a Crontap account and a public HTTPS endpoint that can safely receive retries.
  • Decide scope before installing. The CLI defaults to local scope; add --scope project when the configuration belongs in the repository's .mcp.json.
  • Verified against the Claude Code MCP docs, scheduled tasks docs, and Routines docs on 2026-09-15.

Connect Claude Code to Crontap MCP

Claude Code

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

Runs through the Claude Code CLI and opens OAuth when first used.

Step 1

Add the remote HTTP server

Run the command in your terminal. Claude Code recommends HTTP for remote servers and accepts streamable-http as the equivalent JSON type. Expected result: the CLI prints an Added message, meaning it wrote the configuration.

Step 2

Check status and authenticate

Run claude mcp list, then start Claude Code. If Crontap reports Needs authentication, open /mcp, select the server, and complete OAuth. A project-scoped .mcp.json server may first show Pending approval. Expected result: claude mcp list reports Connected.

Claude Code MCP servers
Crontap
Connected
Authentication
OAuth 2.1

Step 3

Preview the nightly import

Ask Claude Code to preview “every day at 2:15am” in Europe/Berlin, without writing yet. preview_schedule should return an exact cron expression, the IANA timezone, and upcoming runs. Check dates around any daylight-saving transition.

Step 4

Create and read back the schedule

Ask for a POST schedule named nightly data import targeting https://example.com/nightly-import. Review the URL, method, cadence, and timezone before approval. Then ask Claude Code to retrieve the returned ID. You should have one active schedule with the expected next run.

Step 5

Diagnose the first failed run

Once the schedule fires, ask Claude Code for retained run history and the newest failed entry. get_schedule_history returns the HTTP outcome and timing. A 401 points to endpoint credentials; a 500 points to application code; no entry after the next-run time points back to schedule state or timezone.

Ask Claude Code with copyable prompts

Use only Crontap MCP. Preview "every day at 2:15am" in Europe/Berlin without changing anything. Return the resolved cron, timezone, and three upcoming runs.
Create a POST schedule named "nightly data import" for https://example.com/nightly-import using the previewed cadence. Before calling create_schedule, show me the complete non-secret input and wait for approval.
List schedules, select "nightly data import", retrieve it by ID, then read its latest failed history entry. Classify the evidence as a schedule-state, endpoint-authentication, timeout, or application-response problem. Keep the schedule unchanged.

Verify the Claude Code cron job worked

Start with claude mcp list. Connected means the client can load the server, not that a schedule exists. In the session, make Claude Code list schedules and retrieve the returned ID. Confirm the exact endpoint, method, timezone, cadence, status, and next run.

After the first run, compare three pieces of evidence:

  1. Crontap history records when it sent the request and what HTTP result came back.
  2. Your endpoint logs record whether the route received and processed the request.
  3. Your business data records whether the intended digest, sync, or cleanup completed.

If history reports 200 but no digest exists, the scheduler and HTTP route succeeded while the application logic did not. If history reports 401, fix endpoint credentials. If there is no history entry after the expected time, verify the schedule is active and inspect its timezone.

Use get_schedule before any pause, update, or delete. Similar names are easy to mix up; confirm the ID first.

Choose the right Claude Code clock

Claude Code now documents several scheduling surfaces, and they solve different problems.

  • /loop and the CronCreate tools schedule prompts inside a Claude Code session. They require Claude Code to be running and idle, recurring tasks expire after seven days, and there is no catch-up for missed fires. The minimum interval is one minute.
  • Claude Routines are persistent cloud sessions in research preview. They are documented for Pro, Max, Team, and Enterprise, and have a minimum custom interval of one hour.
  • Desktop scheduled tasks run on your machine and can use local files. The machine must remain on.
  • Crontap schedules durable HTTP requests. It does not run Claude Code prompts or access your local repository.

For a morning PR review prompt, choose a Routine or Desktop task. For a morning call to /daily-digest, choose a Crontap schedule. For quick deployment polling while this terminal stays open, /loop is a good fit.

Troubleshooting

The add command succeeds but status is not Connected

Added only means the configuration was written. Run claude mcp list, start an interactive session, open /mcp, and complete OAuth. For project scope, approve the checked-in server definition.

Claude Code reads the URL as a local server

In JSON configuration, a remote entry needs "type": "http" or "type": "streamable-http" plus its URL. A URL without a type is treated as a malformed stdio definition.

Authentication completes but tools stay unavailable

Restart the session and inspect /mcp. Remove duplicate server names across local, project, and user scopes because a different endpoint can win in another project.

History shows a timeout

Crontap reached the route but did not receive a response in time. Move slow work behind a queue and return a quick accepted response, or reduce the endpoint's synchronous workload.

A session task stopped after a week

That is the documented seven-day expiry for recurring Claude Code session tasks. It is not a Crontap schedule failure. Use a Routine for a durable Claude prompt or Crontap for a durable endpoint call.

Next steps

Ready to debug schedules from Claude Code? Free forever tier. No credit card. Create your Crontap account →

Verified with current Claude Code MCP and scheduling documentation on 2026-09-15. Sources: Claude Code MCP, Claude Code scheduled tasks, and Claude Routines.

FAQ

Claude Code cron job questions

What command adds Crontap MCP to Claude Code?
Run claude mcp add --transport http crontap https://mcp.crontap.com/mcp. Start Claude Code and complete OAuth when the server is first used.
Is a Claude Code scheduled task a durable cron job?
The /loop and CronCreate tasks are session-scoped, expire after seven days, and only fire while Claude Code is running and idle. Use Crontap for durable HTTP calls or Routines for persistent cloud prompts.
How do I see whether the MCP server connected?
Run claude mcp list. Claude Code reports Connected, Needs authentication, Failed to connect, or a project approval status.
Can Claude Code inspect failed HTTP runs?
Yes. Ask it to list schedules, select the correct ID, and call the schedule history tool. The retained result includes HTTP outcomes useful for diagnosis.

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.