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
Create a Claude Code cron job for an HTTP endpoint: add Crontap MCP with the CLI, schedule a nightly import, inspect run history, and compare /loop, Desktop and cloud scheduled tasks.

A native Claude Code cron job schedules a prompt, not a request. As of 2026-11-11, /loop repeats a prompt inside a running session, Desktop scheduled tasks run prompts on your machine, and cloud scheduled tasks (formerly routines) run prompts in Anthropic's cloud no more than once an hour. None of them gives your own endpoint a recurring HTTP request with retries, per-run history and failure alerts. Crontap's MCP server fills that gap: Claude Code calls its tools to create and inspect a hosted HTTP schedule, and Crontap sends each request on its own clock, whether or not Claude Code is open.

This walkthrough adds Crontap with the CLI, schedules https://example.com/nightly-import for 2:15 AM, and uses retained history to debug a failed run. Allow about five minutes for setup. Crontap calls the route outside the Claude Code session. It never keeps the terminal open or runs a Claude prompt on a timer.

Before you create a Claude Code cron job

  • 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 cloud scheduled tasks docs on 2026-11-11.

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 an alias for http in JSON. Expected result: the CLI prints an Added message, which only means 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, or run claude mcp login crontap. A project-scoped .mcp.json server first shows 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.

Create the Claude Code cron job 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.

Claude Code scheduled tasks or a Crontap cron job?

Claude Code documents three scheduling surfaces, and all three run a Claude prompt. Last verified 2026-11-11 against Anthropic's Claude Code docs.

QuestionClaude Code nativeCrontap schedule
What firesA Claude promptAn HTTP request to your URL
Where it runsYour session, your machine, or cloudCrontap's servers
Needs your computer on/loop and Desktop: yes. Cloud: noNo
Shortest interval1 minute (/loop), 1 hour (cloud)1 minute paid, 1 hour on Starter
Retries and failure alertsNot documented for an HTTP callRetries 5xx and timeouts, then alerts
Run recordThe Claude sessionStatus, status code, duration, error
  • /loop and the CronCreate tools schedule prompts inside one session. The session must be running and idle, recurring tasks expire seven days after creation, missed fires are not caught up, and the minimum interval is one minute. A session holds at most 50 tasks, and --resume restores them.
  • Desktop scheduled tasks run on your machine and can use local files. They only fire while the app is open and the computer is awake, with one catch-up run for misses within the last seven days. The form's minimum is one hour; Claude can set one minute.
  • A cloud scheduled task, formerly a routine, runs in Anthropic's cloud. It is a research preview on Pro, Max, Ultra, Team, and Enterprise. You create one at claude.ai/code/routines, from the Desktop app, or with /schedule (alias /routines). Runs more often than once an hour are rejected, and on-the-hour runs can start several minutes late.
  • Crontap schedules HTTP requests. It does not run Claude Code prompts or access your local repository. Email failure alerts work on every plan, with Slack, Discord, and Telegram on paid plans.

For a morning PR review prompt, choose a cloud or Desktop scheduled 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.

Troubleshoot a Claude Code cron job

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. Claude Code reads an entry with no type as a stdio server and skips it with an error.

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 cloud scheduled task for a long-lived Claude prompt or Crontap for a long-lived endpoint schedule.

Next steps

If /nightly-import already answers a manual POST, create the schedule from Claude Code with the prompts above, run a test, and let the first failure land in history instead of a terminal you have since closed. Schedule your first job →

Verified against current Claude Code MCP and scheduling documentation on 2026-11-11. Sources: Claude Code MCP, Claude Code scheduled tasks, and Claude Code cloud scheduled tasks.

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. Then open /mcp in Claude Code, or run claude mcp login crontap, to complete OAuth.
Is a Claude Code scheduled task a durable cron job?
Not the /loop kind. /loop and CronCreate tasks fire only while the session is running and idle, recurring tasks expire seven days after creation, and missed fires are not caught up. Use a cloud scheduled task (formerly a routine) for a persistent Claude prompt, or Crontap for a persistent HTTP schedule.
What is the shortest interval for a Claude Code cron job?
/loop goes down to one minute while the session stays open. Cloud scheduled tasks reject runs more often than once an hour. A Crontap schedule can call an HTTP endpoint every minute on paid plans, or hourly on the free Starter plan.
How do I see whether the MCP server connected?
Run claude mcp list. Claude Code reports Connected, Needs authentication, Failed to connect, or Pending approval for a project-scoped server.
Can Claude Code inspect failed HTTP runs?
Yes. Ask it to list schedules, select the correct ID, and call the schedule history tool. Each entry includes the status, status code, duration, and error for that run.

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

Introducing Crontap status pages

Publish uptime monitors and heartbeats on a public page at crontap.page, pick a template from Clean to a split-flap departures board, and add incidents, maintenance and a badge.

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.