by johnpapa
MCP Server for the SWAPI Star Wars API, demonstrating how an MCP server interacts with APIs.
mcp-starwars is an MCP (Model Context Protocol) server designed to interact with the SWAPI Star Wars API. Its primary goal is to showcase how an MCP server can be effectively used to communicate with and retrieve data from external APIs. All data utilized by this MCP server is sourced directly from the SWAPI documentation.
mcp-starwars can be installed and used in several ways:
settings.json
file.npx @smithery/cli install @johnpapa/mcp-starwars --client claude
command.npx @modelcontextprotocol/inspector node build/index.js
..vscode/mcp.json
for a specific repository or add settings to your VS Code User Settings JSON for all repositories. After setup, refresh the server list in GitHub Copilot and use the "🛠️" button to see available tools. You can then ask questions that invoke these tools.Q: What is the main goal of this project? A: The main goal is to demonstrate how an MCP server can be used to interact with APIs, specifically the SWAPI Star Wars API.
Q: Where does the data for this MCP server come from? A: All data used by this MCP server is fetched directly from the SWAPI documentation (https://swapi.dev).
Q: How can I clear the cache?
A: You can use the clear_cache
tool, optionally specifying an endpoint to clear or leaving it empty to clear all.
Q: How can I see cache statistics?
A: Use the get_cache_stats
tool to view cache hit/miss statistics, size, and performance metrics.
Q: Can I use this with GitHub Copilot? A: Yes, you can configure the MCP server to be discoverable by GitHub Copilot in VS Code Insiders and then use its tools within Copilot Agent mode.
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.
Discover more MCP servers with similar functionality and use cases
by zed-industries
Provides real-time collaborative editing powered by Rust, enabling developers to edit code instantly across machines with a responsive, GPU-accelerated UI.
by cline
Provides autonomous coding assistance directly in the IDE, enabling file creation, editing, terminal command execution, browser interactions, and tool extension with user approval at each step.
by continuedev
Provides continuous AI assistance across IDEs, terminals, and CI pipelines, offering agents, chat, inline editing, and autocomplete to accelerate software development.
by github
Enables AI agents, assistants, and chatbots to interact with GitHub via natural‑language commands, providing read‑write access to repositories, issues, pull requests, workflows, security data and team activity.
by block
Automates engineering tasks by installing, executing, editing, and testing code using any large language model, providing end‑to‑end project building, debugging, workflow orchestration, and external API interaction.
by RooCodeInc
An autonomous coding agent that lives inside VS Code, capable of generating, refactoring, debugging code, managing files, running terminal commands, controlling a browser, and adapting its behavior through custom modes and instructions.
by lastmile-ai
A lightweight, composable framework for building AI agents using Model Context Protocol and simple workflow patterns.
by firebase
Provides a command‑line interface to manage, test, and deploy Firebase projects, covering hosting, databases, authentication, cloud functions, extensions, and CI/CD workflows.
by gptme
Empowers large language models to act as personal AI assistants directly inside the terminal, providing capabilities such as code execution, file manipulation, web browsing, vision, and interactive tool usage.