Labsco
danwahlin logo

Marvel MCP Server

β˜… 15

from danwahlin

Interact with the Marvel Developer API to access data on characters and comics.

πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredNeeds API keys

Marvel MCP Server

Open project in GitHub Codespaces Node version smithery badge License

Features β€’ Tools β€’ Setup β€’ Configuring an MCP Host

NOTE: Marvel recently retired their API so it is no longer available unfortunately. I'm leaving this repo up for historical purposes since the approach is still relevant for MCP servers. If you'd like to see a similar example, check out my DC Comics MCP server.

MCP Server for the Marvel Developer API, enabling interaction with characters and comics data. 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 official Marvel API and owned by Marvel. This project is not affiliated with Marvel in any way.

πŸ”§ Features

  • List Marvel Characters: Supports filters like nameStartsWith, limit, comics, series, etc.
  • Fetch a Marvel Character by ID: Get detailed info on any character using their characterId.
  • Fetch Comics for a Character: Get a list of comics featuring a specific character, with various filters like format, dateRange, etc.
  • Rich Content Display: When you ask about characters or comics, the server will:
    • Display detailed information about characters and comics including images, names, descriptions, and more.
    • Create an HTML page (marvel-content.html) with all the content in it.
    • Attempt to open the newly created HTML page in your default browser for an enhanced viewing experience.
  • Tool-based MCP integration: Register this server with Model Context Protocol (MCP) tools (VS Code, Claude, etc.).
  • Environment Configuration: Use .env file to manage environment variables like MARVEL_PUBLIC_KEY, MARVEL_PRIVATE_KEY and MARVEL_API_BASE.

🧰 Tools

1. get_characters πŸ”πŸ¦Έβ€β™‚οΈ

  • Description: Fetch Marvel characters with optional filters.
  • Inputs:
    • name (optional string): Full character name.
    • nameStartsWith (optional string): Characters whose names start with the specified string.
    • modifiedSince (optional string): ISO 8601 date string to filter characters modified since this date.
    • comics, series, events, stories (optional string): Comma-separated list of IDs to filter by related entities.
    • orderBy (optional string): Fields to order the results by, such as name or -modified.
    • limit (optional number): Maximum number of results to return (1–100).
    • offset (optional number): Number of results to skip for pagination.
  • Returns: JSON response with matching characters. See CharacterDataWrapperSchema in src/schemas.ts for details.

2. get_character_by_id πŸ†”πŸ§‘β€πŸŽ€

  • Description: Fetch a Marvel character by their unique ID.
  • Input:
    • characterId (number): The unique ID of the character.
  • Returns: JSON response with the character's details. See CharacterDataWrapperSchema in src/schemas.ts for details.

3. get_comics_for_character πŸ“šπŸŽ­

  • Description: Fetch comics featuring a specific character, with optional filters.
  • Inputs:
    • characterId (number): The unique ID of the character.
    • Optional filters:
      • format, formatType (string): Filter by comic format (e.g., comic, hardcover).
      • noVariants, hasDigitalIssue (boolean): Flags to exclude variants or include only digital issues.
      • dateDescriptor (string): Predefined date ranges like thisWeek, nextWeek.
      • dateRange (string): Custom date range in the format YYYY-MM-DD,YYYY-MM-DD.
      • title, titleStartsWith (string): Filter by title or title prefix.
      • startYear, issueNumber, digitalId (number): Numeric filters.
      • diamondCode, upc, isbn, ean, issn (string): Identifier filters.
      • creators, series, events, stories, sharedAppearances, collaborators (string): Comma-separated list of related entity IDs.
      • orderBy (string): Fields to order the results by, such as title or -modified.
      • limit, offset (number): Pagination options.
  • Returns: JSON response with comics featuring the specified character. See ComicDataWrapperSchema in src/schemas.ts for details.

4. get_comics πŸ“–πŸ•΅οΈβ€β™‚οΈ

  • Description: Fetch lists of Marvel comics with optional filters.
  • Inputs:
    • format (optional string): Filter by the issue format (e.g., comic, digital comic, hardcover).
    • formatType (optional string): Filter by the issue format type (comic or collection).
    • noVariants (optional boolean): Exclude variants (alternate covers, secondary printings, director's cuts, etc.) from the result set.
    • dateDescriptor (optional string): Return comics within a predefined date range (lastWeek, thisWeek, nextWeek, thisMonth).
    • dateRange (optional string): Return comics within a custom date range. Dates must be specified as YYYY-MM-DD,YYYY-MM-DD.
    • title (optional string): Return only issues in series whose title matches the input.
    • titleStartsWith (optional string): Return only issues in series whose title starts with the input.
    • startYear (optional number): Return only issues in series whose start year matches the input.
    • issueNumber (optional number): Return only issues in series whose issue number matches the input.
    • diamondCode, digitalId, upc, isbn, ean, issn (optional string): Filter by various identifiers.
    • hasDigitalIssue (optional boolean): Include only results which are available digitally.
    • modifiedSince (optional string): Return only comics which have been modified since the specified date (ISO 8601 format).
    • creators, characters, series, events, stories, sharedAppearances, collaborators (optional string): Comma-separated list of IDs to filter by related entities.
    • orderBy (optional string): Order the result set by a field or fields. Add a "-" to the value to sort in descending order (e.g., title, -modified).
    • limit (optional number): Limit the result set to the specified number of resources (default: 20, max: 100).
    • offset (optional number): Skip the specified number of resources in the result set.
  • Returns: JSON response with matching comics. See ComicDataWrapperSchema in src/schemas.ts for details.

5. get_comic_by_id πŸ†”πŸ“˜

  • Description: Fetch a single Marvel comic by its unique ID.
  • Input:
    • comicId (number): The unique ID of the comic.
  • Returns: JSON response with the comic details. See ComicDataWrapperSchema in src/schemas.ts for details.

6. get_characters_for_comic πŸ¦Έβ€β™€οΈπŸ“–

  • Description: Fetch Marvel characters appearing in a specific comic.
  • Inputs:
    • comicId (number): The unique ID of the comic.
    • Optional filters:
      • name (optional string): Filter characters by full name.
      • nameStartsWith (optional string): Filter characters whose names start with the specified string.
      • modifiedSince (optional string): ISO 8601 date string to filter characters modified since this date.
      • series, events, stories (optional string): Comma-separated list of related entity IDs to filter by.
      • orderBy (optional string): Fields to order the results by, such as name or -modified.
      • limit (optional number): Maximum number of results to return (1–100).
      • offset (optional number): Number of results to skip for pagination.
  • Returns: JSON response with characters appearing in the specified comic. See CharacterDataWrapperSchema in src/schemas.ts for details.