# Connect Claude to Public APIs: Full Guide

> Learn three ways to connect Claude to free Public APIs, build agents for travel and markets, test each API first, and build your own MCP server.

By Jonathan Ben Haim. Updated 2026-11-29. Source: https://jonathanai.io/blog/connect-claude-to-public-apis

A lot of people use Claude or ChatGPT only to ask questions. That means they miss the most useful part. In my experience, the real change happens when the model can fetch live data and act on it.

**In short:** You can connect Claude to free APIs from the public-apis/public-apis list on GitHub. The simplest method needs no setup. For repeat work, save a script or Skill, and for team-wide or authenticated use, [build an MCP server](/blog/turn-any-api-into-mcp-server). Always have the agent test each API before it builds anything, because some entries in the list no longer work.

## Key takeaways

- The [public-apis/public-apis](https://github.com/public-apis/public-apis) repo has more than 467 thousand stars and more than 51 thousand forks.
- The list includes more than 1,400 free APIs organized in more than 50 categories.
- Each entry shows the auth type (apiKey, OAuth, or none), HTTPS support, and CORS support.
- The repo uses the MIT license and has been community-maintained since 2016.
- APIs marked Auth: No work right away in Claude Cowork and Claude Code, with no signup.
- Some APIs in the list are dead, so the agent should test each one before you build on it.

## What are Public APIs?

Public APIs is a GitHub repo, [public-apis/public-apis](https://github.com/public-apis/public-apis), that lists free APIs in one place. It is one of the most starred repos on GitHub.

- More than 467 thousand stars, and more than 51 thousand forks.
- More than 1,400 free APIs in more than 50 categories.
- Each entry includes the name, a short description, the auth type (apiKey, OAuth, or none), HTTPS support, and CORS support.
- The license is MIT. The community has maintained it since 2016.

The categories cover almost everything. You will find weather, finance and crypto, news, government and open data, transportation, geocoding, sports, music, health, games, science, anime, and even APIs for jokes and cats.

## Why does this list matter for AI agents?

The list matters because Claude can now write and run code on its own. Until recently, an API list was a tool for developers. Now it is useful for anyone who works with AI.

Tools like Claude Cowork, Claude Code, and Codex can write and run code themselves. You do not need to know how to program to connect an API. You need to know how to ask for what you want. The agent writes the code, calls the API, processes the response, and returns a finished result.

In a sense, the list is a catalog of 1,400 "hands" you can give your agent.

## How do you connect an API to Claude?

There are three ways, from easiest to most involved: a direct chat, a [saved script or Skill](/blog/turn-technical-book-into-claude-skill), and an MCP server. Each one fits a different kind of job.

### Method 1: Direct chat (easiest, no setup)

In Claude Cowork and Claude Code, the agent has a code environment. Open APIs that do not require a key (Auth = "No") work right away.

```
Get me the current exchange rates from the Frankfurter API
and calculate how much 2,000 euros is in dollars.
```

The agent writes a small script, calls the API, and returns the answer. No MCP and no configuration are needed.

### Method 2: Saved script or Skill (for repeat use)

If you use the same API again and again, ask the agent to turn it into a saved script or a Skill.

```
Write me a Python script that pulls the weather from Open-Meteo by city,
save it in the working folder, and from now on, when I ask about the weather, use it.
```

In Claude Code, you can take this one step further and make it a Skill. A Skill is a file of instructions that the agent loads automatically when the task is relevant.

### Method 3: MCP server (the professional setup)

MCP ([Model Context Protocol](/blog/composio-connect-claude-500-apps)) is a standard that Anthropic released as open source. It is now the standard way to connect tools to any agent, including Claude, Cursor, Codex, and others. MCP turns an API into a tool that Claude sees in its tool list. Permissions are organized, and you do not need to write new code in every chat.

Use MCP when the API requires authentication, when you want the tool available in every chat, or when you are building a system for a full team.

| Method | Best for | Setup needed |
|---|---|---|
| Direct chat | One-time questions with open APIs | None |
| Saved script or Skill | An API you use repeatedly | A script or Skill file |
| MCP server | APIs that need auth, frequent use, or a team | A deployed MCP server |

## What can you build with APIs and Claude?

Here are five examples. Each one combines several APIs, and the agent does the work.

### 1. A smart travel agent

Connect the Open-Meteo weather API, the Frankfurter currency API, the Nager.Date public holidays API, and location data. Then ask:

```
I'm flying to Vienna September 3 to 10 with two kids.
Check the weather forecast, local holidays that close attractions,
and the euro to dollar rate. Then build me a daily plan that takes all of this into account.
```

The plan you get is not based on general knowledge. It is based on real data for the [week of your trip](/blog/claude-travel-planning-flights-hotels-cars).

### 2. Investment tracking and market reports

Connect [stock, crypto, and financial news data](/blog/connect-claude-financial-apis), and ask for a recurring report:

```
Every morning: pull the prices of my portfolio, compare them to yesterday,
check for material news on any of the companies,
and prepare a 5-line summary: what changed and why.
```

In Claude Cowork, you can set this up as a recurring task, and the report will be ready for you.

### 3. An automatic research system

News, Wikipedia, GitHub, and arXiv together can work like a one-person research team:

```
I am researching the [topic] market. Collect from 3 news sources,
cross-check with data from Wikipedia, find relevant repos on GitHub,
and organize everything into a document with sources.
```

### 4. A home or business dashboard

Combine weather, public transportation, currency rates, and a calendar. Then ask Claude to build one HTML page that brings everything together and refreshes with one click.

### 5. Data-based content

For content creators, APIs with trends, statistics, and open data are a good source of post ideas. A sentence like "The API data shows that..." usually does more than "In my opinion...".

## Can Claude choose the right API for me?

Yes. You do not need to know in advance which API you need. Describe the goal, and let the agent search the list, test candidates, and build.

```
I want to build [a travel agent / an investment tracker / a research tool].
Go through the public-apis/public-apis repo on GitHub,
review the relevant categories,
choose 3 to 4 APIs that fit. Prefer ones with no key (Auth: No).
Test that they actually work by running a test call on each one,
and only then build the system for me.
```

Pay attention to the testing step. I explain why it matters in the next section.

## How do you search the Public APIs repo?

You can search the repo in three ways. The README is one very long file.

- **Table of contents:** The top of the file has an index by category. Use Ctrl+F to search for a category name.
- **By the Auth column:** If you want something that works right away, look for entries with "No" in the Auth column. These APIs work without any signup.
- **Let Claude search for you:** Paste the link to the repo and ask: "Find me an API for X from this list, and prefer one without a key."

Tip: The CORS column matters only if you are building a browser app. For agents that run on a server, such as Claude Code, it does not matter.

## What do you do when an API stops working?

Test every API before you build on it. The agent can run the test, handle the errors, and find a replacement.

The repo has existed since 2016, and some APIs in it are dead. Addresses have changed, services have closed, and some free keys have become paid. The community has raised fair criticism about this.

That does not make the repo worthless. It makes the testing step required. This is where an AI agent does better than a static list. Use this rule:

```
Before you use this API, run a test call.
If it returns an error or does not respond within 10 seconds,
find an alternative in the same category on the list and test that one too.
Only continue with APIs that pass the test.
```

Common errors and what to ask the agent:

| Error | What it means | What to ask the agent |
|---|---|---|
| 404 / DNS error | The API moved its address or is gone | "Look up the current documentation for this service. If there is none, find an alternative." |
| 401 / 403 | A key is required, or the key is wrong | "Show me how to get a free key and where to put it." |
| 429 | You went over the free request limit | "Add a pause between calls and cache the results." |
| JSON changed | The service changed the response structure | "Print the raw response and fix the code to match the new structure." |

The agent can do all of this debugging on its own. You only need to give it permission to fix things.

## Which tool should you use: Claude, Claude Code, Cowork, or Codex?

Each tool fits a different kind of work. The API logic is the same in all of them, because an API is an API.

| Tool | Where it runs | Best use |
|---|---|---|
| Claude (app or web) | Browser or app | Ready-made connectors and first exploration of the list. Paste the repo link and ask for recommendations. |
| Claude Code | Terminal | The best setup for building scripts, Skills, and MCP servers. |
| Claude Cowork | Desktop app | For people who do not want to use a terminal. It works with files, runs code as part of a task, and handles recurring tasks, such as a daily investment report or a travel agent. |
| Codex | OpenAI's tool | Everything in this guide also applies to Codex from OpenAI. It runs code and supports MCP. |

An existing MCP connection takes one command in Claude Code:

```
claude mcp add weather -- npx -y @h1deya/mcp-server-weather
```

After that, the tool is available in every session.

## How do you build an MCP server for an API that does not have one?

You can build one with the help of Claude Code. If you find a strong API in the list but no MCP server exists for it, that is an opportunity. There are three levels.

### Level 1: Ask Claude Code to build it

Use a prompt like this:

```
Build me an MCP server in Python with fastmcp (the latest version, 3.x)
that wraps the API for [name]. Documentation: [link].
Expose 3 tools: [search / fetch / compare].
Test it with MCP Inspector, then add it to your setup with claude mcp add.
```

A basic MCP server is just Python functions with a decorator. Claude Code can build one in minutes.

### Level 2: Automatic conversion from OpenAPI

This saves the most time. If the API has an OpenAPI file (most serious APIs do), the FastMCP library can convert it to MCP automatically. Every endpoint becomes a tool, and you do not write them by hand.

```
from fastmcp import FastMCP
mcp = FastMCP.from_openapi(openapi_spec, client=api_client)
```

### Level 3: What to know before you build

- **The most common trap:** There are two versions of FastMCP. `from mcp.server.fastmcp import FastMCP` is the old version (1.0) that is frozen inside the official SDK. The live version is the standalone package. Install it with `pip install fastmcp`, then import with `from fastmcp import FastMCP`. Older guides mix the two, and then nothing works.
- **Less is more:** Do not expose 30 tools. Three to five focused tools with clear names and descriptions work much better, because the model has to understand when to use each one.
- **API keys:** Store keys in environment variables. Never put them in the code.
- **Testing:** MCP Inspector is the official debugging tool. It shows exactly which tools were exposed and what they return.
- **Where it runs:** Locally, you run the server over stdio. If you want your team to use it, deploy it over HTTP. [Cloudflare Workers](/blog/cloudflare-ai-agents-complete-guide) is a good default for that.

## Bottom line

The repo has existed for a decade, but it has never been more useful than it is today. You used to need a developer to connect these APIs, and now an agent can do it for you. Define what you want to build, give the agent the list and ask it to choose, test, and build, then save what works as a script, Skill, or MCP server.
