MCP Server
To explore this site together with a browser agent, see WebMCP in the browser.
Use the Star Wars API from your AI agent.
Endpoint
https://swapi.build/mcp
initialize handshake, no session ids, nothing to keep alive between calls.
Clients on earlier revisions negotiate a session and work just as well, and keep working
after a server restart: a session id the server no longer knows is simply issued a fresh
session instead of failing. First-party, read-only, no authentication.
Tools
| Tool | Arguments | Returns |
|---|---|---|
sw_list | resource, optional fields | All entities of a resource |
sw_get | resource, id, optional expand | One entity by id |
sw_random | resource | A random entity |
sw_search | resource, query, optional fields | Name/title substring match |
resource is one of PEOPLE, FILMS, PLANETS,
SPECIES, STARSHIPS, VEHICLES. Ids are the record ids from each
entity's url field (for FILMS, 1 = A New Hope).
expand names the relations to embed in the same call, such as
["homeworld", "species"], or ["*"] for all of them (one level deep; up to 8
names). fields keeps only the named fields of each entity, such as ["name"] for a
compact index; url always stays (up to 24 names). Without them, the answers are the full records.
Resources
The same records are MCP resources, for clients that attach data instead of calling a tool:
swapi://people is an index of every person (id, name and URI), and
swapi://people/1 is Luke Skywalker, with the same text as sw_get. The pattern is
swapi://<type> and swapi://<type>/<id> for the six types, also as
resource templates.
In Claude Code, type @ and pick swapi-build:swapi://people/1 to attach a record
to your message.
Server prompt
character_profile takes a character's name and asks the agent to build a short profile with the
tools: sw_search, then sw_get with expand for homeworld, species and films.
In Claude Code it is the command /mcp__swapi-build__character_profile, e.g.
/mcp__swapi-build__character_profile Vader. Claude Code splits the arguments of a slash command on
spaces, so use one word there; a full name works in clients that send prompt arguments as JSON.
Connect your client
Claude Code
One command, from any terminal:
claude mcp add --transport http swapi-build https://swapi.build/mcp
Or share it with your team via a .mcp.json at the repo root:
{
"mcpServers": {
"swapi-build": {
"type": "http",
"url": "https://swapi.build/mcp"
}
}
}
Verify: claude mcp list shows swapi-build ✔ Connected, or type /mcp inside a session.
Claude Desktop & claude.ai
- Open Settings → Connectors and click Add custom connector.
- Name it
swapi-buildand paste the URL:https://swapi.build/mcp. - Save — no authentication is required.
Verify: in any chat, the + menu → Connectors lists swapi-build with its tools.
Available on all plans (Free allows one custom connector). On Team/Enterprise an Owner adds it under Organization settings → Connectors.
OpenAI Codex
Streamable HTTP is supported natively — no gateway needed:
codex mcp add swapi-build --url https://swapi.build/mcp
Or add it to ~/.codex/config.toml (shared by the CLI, IDE extension and ChatGPT desktop app):
[mcp_servers.swapi-build] url = "https://swapi.build/mcp"
Verify: codex mcp list, or /mcp inside the TUI.
GitHub Copilot
In VS Code, create .vscode/mcp.json in your workspace (note the top-level key is servers):
{
"servers": {
"swapi-build": {
"type": "http",
"url": "https://swapi.build/mcp"
}
}
}
Or use the Command Palette: MCP: Add Server → HTTP → paste the URL.
Verify: open Copilot Chat and click the Configure Tools button — the four swapi tools appear under swapi-build.
On Copilot Business/Enterprise, an admin must enable the "MCP servers in Copilot" policy. Visual Studio and JetBrains also support remote HTTP servers via their own mcp.json.
IBM Bob
Add to ~/.bob/settings/mcp_settings.json (global) or .bob/mcp.json in your project:
{
"mcpServers": {
"swapi-build": {
"type": "streamable-http",
"url": "https://swapi.build/mcp",
"disabled": false
}
}
}
Or from the Bob panel: MCP tab → Edit Global MCP (or Edit Project MCP).
Verify: Bob detects the tools automatically — expand swapi-build in the MCP tab to see them.
Try these prompts
Troubleshooting
Probing /mcp with raw curl? Stateless requests must include the
MCP-Protocol-Version, Mcp-Method and Mcp-Name headers —
MCP clients send these automatically.