MCP Server for the
Note: All data used by this MCP server is fetched from the SWAPI documentation](
https://swapi.dev).
- List Star Wars Characters: Get character data with optional search filters and automatic pagination
- List Planets, Films, Species, Vehicles, and Starships: Access all Star Wars entity collections with search capabilities
- Fetch Entity Details by ID: Get detailed information about specific characters, planets, films, species, vehicles, or starships
- Automatic Pagination: Seamlessly retrieve all pages of data with a single API call
- Built-in Caching: Optimize performance with intelligent API response caching
- Cache Management: Clear cache and view cache statistics to monitor performance
- Tool-based MCP Integration: Register this server with Model Context Protocol (MCP) tools (VS Code, Claude, etc.)
- Description: List Star Wars characters with automatic pagination and optional search
- Inputs:
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)
- Returns: Collection of Star Wars character data including name, physical attributes, homeworld, and related entities
- Description: Get details about a specific Star Wars character by ID
- Input:
id
(string or number): The unique identifier of the character
- Returns: Complete data for the requested character including name, physical attributes, homeworld, and related entities
- Description: List Star Wars planets with automatic pagination and optional search
- Inputs:
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)
- Returns: Collection of Star Wars planet data including climate, terrain, population, and related entities
- Description: Get details about a specific Star Wars planet by ID
- Input:
id
(string or number): The unique identifier of the planet
- Returns: Complete data for the requested planet including climate, terrain, population, and related entities
- Description: List Star Wars films with automatic pagination and optional search
- Inputs:
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)
- Returns: Collection of Star Wars film data including title, episode ID, director, and related entities
- Description: Get details about a specific Star Wars film by ID
- Input:
id
(string or number): The unique identifier of the film
- Returns: Complete data for the requested film including title, episode ID, director, and related entities
- Description: List Star Wars species with automatic pagination and optional search
- Inputs:
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)
- Returns: Collection of Star Wars species data including classification, physical attributes, and related entities
- Description: Get details about a specific Star Wars species by ID
- Input:
id
(string or number): The unique identifier of the species
- Returns: Complete data for the requested species including classification, physical attributes, and related entities
- Description: List Star Wars vehicles with automatic pagination and optional search
- Inputs:
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)
- Returns: Collection of Star Wars vehicle data including model, manufacturer, and specifications
- Description: Get details about a specific Star Wars vehicle by ID
- Input:
id
(string or number): The unique identifier of the vehicle
- Returns: Complete data for the requested vehicle including model, manufacturer, and specifications
- Description: List Star Wars starships with automatic pagination and optional search
- Inputs:
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)
- Returns: Collection of Star Wars starship data including model, manufacturer, and specifications
- Description: Get details about a specific Star Wars starship by ID
- Input:
id
(string or number): The unique identifier of the starship
- Returns: Complete data for the requested starship including model, manufacturer, and specifications
- Description: Clear the Star Wars API cache (partially or completely)
- Input:
endpoint
(optional string): Specific endpoint to clear from cache. Leave empty to clear all.
- Returns: Confirmation message indicating which cache was cleared
- Description: Get statistics about the Star Wars API cache usage
- Inputs: None
- Returns: Cache hit/miss statistics, size, and performance metrics
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":{}}'
- Open VS Code Settings (File > Preferences > Settings)
- Click on the "Open Settings (JSON)" icon in the top right corner
- Add the following configuration to your settings.json file:
"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
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
todist/index.js
and selectConnect
. SelectList 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 (notChat
orEdits
). -
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.