# Star Wars API & MCP server (swapi.build)

> Star Wars API & MCP server (swapi.build) is an open-source MCP server for developer tools. Free Star Wars data over MCP: people, films, planets, species, starships and vehicles. It runs as a hosted remote server, so there is nothing to install locally.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** API, self-hosted
- **Website:** https://swapi.build
- **Repository:** https://github.com/eldermoraes/swapi.build
- **MCP Registry name:** build.swapi/star-wars
- **Categories:** developer tools
- **Listing updated:** 2026-11-14

## About

Built for demos that must not break, this project exists because the author wanted a Star Wars API that stays up when an audience is watching. It is a fresh take on the classic SWAPI, inspired by the original by Paul Hallett and maintained by Juriy Bura, written with Quarkus and compiled with GraalVM for fast startup and low memory use.

The MCP side exposes four generic tools that take a resource name: sw_list returns all entities of a resource, sw_get returns one by id with optional expansion, sw_random returns a random entity, and sw_search searches by query. Resources cover Episodes I to VI. The same data is also served as REST JSON endpoints under /api, with search and random options per resource.

No API key is needed, and the code is open source. Running it yourself needs Java 25 and Maven.

## Features

- **Four generic tools:** List, get, random and search over any resource.
- **Six resources:** People, films, planets, species, starships and vehicles.
- **REST and MCP:** Same data over /api endpoints and a remote MCP server.
- **No API key:** Open and free to call.
- **Self-hostable:** Quarkus and GraalVM app you can run locally.

## Good for

- Give an agent safe sample data for a live demo
- Test MCP client behaviour against a stable public server
- Teach API or MCP basics with familiar data

## Install

### Claude Code (Terminal)

```sh
claude mcp add --transport http star-wars https://swapi.build/mcp
```

### Claude Desktop (Settings → Connectors → Add custom connector)

```sh
https://swapi.build/mcp
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "star-wars": {
      "url": "https://swapi.build/mcp"
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "star-wars": {
      "type": "http",
      "url": "https://swapi.build/mcp"
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "star-wars": {
      "serverUrl": "https://swapi.build/mcp"
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "star-wars": {
      "type": "http",
      "url": "https://swapi.build/mcp"
    }
  }
}
```

## Tools

- `sw_get`: Gets one Star Wars entity by numeric record id and returns it as a JSON object. Take the id from the end of an entity's url field (from sw_search, sw_list or a relation URL). Ids are record ids, not episode numbers: FILMS id 1 is A New Hope (Episode IV). An unknown id returns a tool error, e.g. 'No films found with id 99'. Pass expand to get related records in the same call, e.g. ["homeworld", "sp
- `sw_list`: Lists every entity of one Star Wars resource type as a JSON array (Episodes I-VI data). Responses are large (all 82 PEOPLE, about 38 KB); to find a single entity, prefer sw_search, then sw_get; for a compact index pass fields, e.g. ["name"] (about 5 KB).
- `sw_random`: Returns one random Star Wars entity of the given resource type as a JSON object. Each call can return a different entity, so it is not idempotent. Useful for demos and quizzes; to fetch a specific entity use sw_search or sw_get.
- `sw_search`: Start here. Finds Star Wars entities by name (title for FILMS) with a case-insensitive substring match: 'sky' finds Luke, Anakin and Shmi Skywalker. Returns a JSON array of full entities; an empty array [] means no match; pass fields to shorten each entity. The id to pass to sw_get is the last segment of each entity's url field. Data covers Episodes I-VI only.

## FAQ

### What do I need to run it myself?

Java 25 and Maven, or the included Maven Wrapper.

### Which films are covered?

The site says Episodes I to VI.

### Is Star Wars API & MCP server (swapi.build) free?

Yes. Star Wars API & MCP server (swapi.build) is open source, so you can use and self-host it for free.

### How do I add Star Wars API & MCP server (swapi.build) to Claude Code?

Run this command in your terminal: claude mcp add --transport http star-wars https://swapi.build/mcp

### What are the best alternatives to Star Wars API & MCP server (swapi.build)?

The closest alternatives to Star Wars API & MCP server (swapi.build) are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/star-wars-api-and-mcp-server-swapi-build
