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.
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.