by johnpapa
Provides an MCP server that interfaces with the SWAPI Star Wars API, exposing tools to list and fetch characters, planets, films, species, vehicles, and starships with automatic pagination and built‑in caching.
The server acts as a bridge between Model Context Protocol clients and the public SWAPI Star Wars API. It wraps the REST endpoints into a set of well‑defined tools, allowing AI agents or code assistants to retrieve Star Wars data without handling HTTP requests directly.
code --add-mcp '{"name":"starwars","command":"npx","args":["-y","@johnpapa/mcp-starwars"],"env":{}}'
settings.json
if you prefer a persistent setup:
"mcp": {
"servers": {
"starwars": {
"command": "npx",
"args": ["-y", "@johnpapa/mcp-starwars"],
"env": {}
}
}
},
"chat.mcp.discovery.enabled": true
get_people
, get_planet_by_id
, or clear_cache
.fetchAllPages
flag.Q: Do I need an API key for SWAPI? A: No. SWAPI is a public, unauthenticated API.
Q: Can I limit pagination to a single page?
A: Yes. Set fetchAllPages
to false
and specify the page
number.
Q: How do I reset the cache?
A: Use the clear_cache
tool; specify an endpoint
to clear selectively or leave it empty to purge everything.
Q: Is there support for other languages or runtimes?
A: The server is written in TypeScript/Node.js and runs wherever an MCP client can execute npx
commands.
Q: How do I view cache metrics?
A: Call the get_cache_stats
tool which returns hit/miss counts, size, and performance data.
Features • Tools • Setup • Configuring an MCP Host
MCP Server for the SWAPI Star Wars API. The main goal of the project is to show how an MCP server can be used to interact with APIs.
Note: All data used by this MCP server is fetched from the SWAPI documentation](https://swapi.dev).
get_people
🧑🤝🧑page
(optional number): The page number to retrieve (defaults to 1)search
(optional string): Name or partial name to search forfetchAllPages
(optional boolean): Whether to automatically fetch all pages of results (defaults to true)get_person_by_id
👤id
(string or number): The unique identifier of the characterget_planets
🪐page
(optional number): The page number to retrieve (defaults to 1)search
(optional string): Planet name or partial name to search forfetchAllPages
(optional boolean): Whether to automatically fetch all pages of results (defaults to true)get_planet_by_id
🌍id
(string or number): The unique identifier of the planetget_films
🎬page
(optional number): The page number to retrieve (defaults to 1)search
(optional string): Film title or partial title to search forfetchAllPages
(optional boolean): Whether to automatically fetch all pages of results (defaults to true)get_film_by_id
📽️id
(string or number): The unique identifier of the filmget_species_list
👽page
(optional number): The page number to retrieve (defaults to 1)search
(optional string): Species name or partial name to search forfetchAllPages
(optional boolean): Whether to automatically fetch all pages of results (defaults to true)get_species_by_id
🧬id
(string or number): The unique identifier of the speciesget_vehicles
🚗page
(optional number): The page number to retrieve (defaults to 1)search
(optional string): Vehicle name or partial name to search forfetchAllPages
(optional boolean): Whether to automatically fetch all pages of results (defaults to true)get_vehicle_by_id
🚙id
(string or number): The unique identifier of the vehicleget_starships
🚀page
(optional number): The page number to retrieve (defaults to 1)search
(optional string): Starship name or partial name to search forfetchAllPages
(optional boolean): Whether to automatically fetch all pages of results (defaults to true)get_starship_by_id
🛸id
(string or number): The unique identifier of the starshipclear_cache
🧹endpoint
(optional string): Specific endpoint to clear from cache. Leave empty to clear all.get_cache_stats
📊For the quickest installation, click on one of the VS Code installation buttons at the top of this README.
You can install the Star Wars MCP server manually using the following commands:
For VS Code Stable:
code --add-mcp '{"name":"starwars","command":"npx","args":["-y","@johnpapa/mcp-starwars"],"env":{}}'
For VS Code Insiders:
code-insiders --add-mcp '{"name":"starwars","command":"npx","args":["-y","@johnpapa/mcp-starwars"],"env":{}}'
"mcp": {
"servers": {
"starwars": {
"command": "npx",
"args": ["-y", "@johnpapa/mcp-starwars"],
"env": {}
}
}
},
"chat.mcp.discovery.enabled": true
To install Star Wars MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @johnpapa/mcp-starwars --client claude
If you'd like to run MCP Inspector locally to test the server, follow these steps:
Clone this repository:
git clone https://github.com/johnpapa/-mcp-starwars
Install the required dependencies and build the project.
npm install
npm run build
(Optional) To try out the server using MCP Inspector run the following command:
# Start the MCP Inspector
npx @modelcontextprotocol/inspector node build/index.js
Visit the MCP Inspector URL shown in the console in your browser. Change Arguments
to dist/index.js
and select Connect
. Select List Tools
to see the available tools.
Note: If you already have the MCP server enabled with Claude Desktop, add
chat.mcp.discovery.enabled: true
in your VS Code settings and it will discover existing MCP server lists.
If you want to associate the MCP server with a specific repo, create a .vscode/mcp.json
file with this content:
{
"inputs": [],
"servers": {
"mcp-starwars": {
"command": "npx",
// "command": "node",
"args": [
"-y",
"@johnpapa/mcp-starwars"
// "_git/mcp-starwars/dist/index.js"
],
"env": {}
}
}
}
If you want to associate the MCP server with all repos, add the following to your VS Code User Settings JSON:
"mcp": {
"servers": {
"mcp-starwars": {
"command": "npx",
// "command": "node",
"args": [
"-y",
"@johnpapa/mcp-starwars"
// "/Users/papa/_git/mcp-starwars/dist/index.js"
// "_git/mcp-starwars/dist/index.js"
],
"env": {}
}
}
}
"chat.mcp.discovery.enabled": true,
Now that the mcp server is discoverable, open GitHub Copilot and select the Agent
mode (not Chat
or Edits
).
Select the "refresh" button in the Copilot chat text field to refresh the server list.
Select the "🛠️" button to see all the possible tools, including the ones from this repo.
Put a question in the chat that would naturally invoke one of the tools, for example:
How do I set my VS Code accent colors?
Note: If you see "Sorry, the response was filtered by the Responsible AI Service. Please rephrase your prompt and try again.", try running it again or rephrasing the prompt.
Please log in to share your review and rating for this MCP.
{ "mcpServers": { "starwars": { "command": "npx", "args": [ "-y", "@johnpapa/mcp-starwars" ], "env": {} } } }
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.