# aimaginationlab/marvel-rivals-mcp architecture

> Architecture diagram of the GitHub repository aimaginationlab/marvel-rivals-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aimaginationlab/marvel-rivals-mcp
- Repository: https://github.com/aimaginationlab/marvel-rivals-mcp

## Overview

MCP Marvel Rivals exposes game data as tools to an MCP client. The client connects over stdio; the server advertises tools, dispatches calls to provider operations, and returns JSON results. The provider covers heroes, cosmetics, achievements, items, maps, and player profiles and match history, making HTTP requests through a retrying JSON-fetch layer to MarvelsAPI. Shared types and the provider interface form the internal contract. The README documents the client-facing capabilities; sampled source shows dispatch and request behavior, but not the external API implementation.

Main entry points: [`src/server/mcp-server.ts`](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/server/mcp-server.ts) (MCP server), [`src/utils/fetch.ts`](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/utils/fetch.ts) (Retrying fetch), [`src/providers/MarvelsApiProvider.ts`](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts) (Hero data), [`src/providers/IProvider.ts`](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/IProvider.ts) (Provider contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["MCP entry"]
  node_cli["CLI entry<br/>[cli.ts]"]
  node_server["MCP server<br/>[mcp-server.ts]"]
  node_config["Server config<br/>[config.ts]"]
end

subgraph group_domains["Game data"]
  node_heroes["Hero data"]
  node_cosmetics["Hero skins"]
  node_skins["Skin catalog"]
  node_achievements["Achievements"]
  node_items["Item catalog"]
  node_maps["Maps"]
  node_players["Player data"]
end

subgraph group_integration["API integration"]
  node_fetch["Retrying fetch<br/>[fetch.ts]"]
end

subgraph group_contracts["Shared contracts"]
  node_provider["Provider contract<br/>[IProvider.ts]"]
  node_types["Data types<br/>[index.ts]"]
end

node_client(("MCP client"))
node_api{{"MarvelsAPI"}}

node_client -->|"uses tools"| node_server
node_cli -->|"starts"| node_server
node_server -->|"reads settings"| node_config
node_server -->|"dispatches calls"| node_heroes
node_server -->|"dispatches calls"| node_cosmetics
node_server -->|"dispatches calls"| node_skins
node_server -->|"dispatches calls"| node_achievements
node_server -->|"dispatches calls"| node_items
node_server -->|"dispatches calls"| node_maps
node_server -->|"dispatches calls"| node_players
node_heroes -->|"implements"| node_provider
node_heroes -->|"requests JSON"| node_fetch
node_cosmetics -->|"requests JSON"| node_fetch
node_skins -->|"requests JSON"| node_fetch
node_achievements -->|"requests JSON"| node_fetch
node_items -->|"requests JSON"| node_fetch
node_maps -->|"requests JSON"| node_fetch
node_players -->|"requests JSON"| node_fetch
node_fetch -->|"fetches data"| node_api
node_provider -->|"uses contracts"| node_types
node_heroes -->|"uses types"| node_types

click node_cli "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/bin/cli.ts"
click node_server "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/server/mcp-server.ts"
click node_config "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/config.ts"
click node_heroes "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts"
click node_cosmetics "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts"
click node_skins "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts"
click node_achievements "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts"
click node_items "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts"
click node_maps "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts"
click node_players "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts"
click node_provider "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/IProvider.ts"
click node_types "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/types/index.ts"
click node_fetch "https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/utils/fetch.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_server,node_config,node_client toneBlue
class node_heroes,node_cosmetics,node_skins,node_achievements,node_items,node_maps,node_players toneAmber
class node_fetch,node_api toneMint
class node_provider,node_types toneRose
```

## Components

### MCP entry

- [CLI entry](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/bin/cli.ts): `bin/cli.ts`
- [MCP server](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/server/mcp-server.ts): `src/server/mcp-server.ts`
- [Server config](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/config.ts): `src/config.ts`

### Game data

- [Hero data](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts): `src/providers/MarvelsApiProvider.ts`
- [Hero skins](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts): `src/providers/MarvelsApiProvider.ts`
- [Skin catalog](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts): `src/providers/MarvelsApiProvider.ts`
- [Achievements](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts): `src/providers/MarvelsApiProvider.ts`
- [Item catalog](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts): `src/providers/MarvelsApiProvider.ts`
- [Maps](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts): `src/providers/MarvelsApiProvider.ts`
- [Player data](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/MarvelsApiProvider.ts): `src/providers/MarvelsApiProvider.ts`

### API integration

- [Retrying fetch](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/utils/fetch.ts): `src/utils/fetch.ts`

### Shared contracts

- [Provider contract](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/providers/IProvider.ts): `src/providers/IProvider.ts`
- [Data types](https://github.com/aimaginationlab/marvel-rivals-mcp/blob/main/src/types/index.ts): `src/types/index.ts`

### Other components

- **MCP client**
- **MarvelsAPI**

## Connections

- MCP client → MCP server: uses tools (evidence: `README.md`)
- CLI entry → MCP server: starts (evidence: `bin/cli.ts`)
- MCP server → Server config: reads settings (evidence: `src/server/mcp-server.ts`)
- MCP server → Hero data: dispatches calls (evidence: `src/server/mcp-server.ts`)
- MCP server → Hero skins: dispatches calls (evidence: `src/server/mcp-server.ts`)
- MCP server → Skin catalog: dispatches calls (evidence: `src/server/mcp-server.ts`)
- MCP server → Achievements: dispatches calls (evidence: `src/server/mcp-server.ts`)
- MCP server → Item catalog: dispatches calls (evidence: `src/server/mcp-server.ts`)
- MCP server → Maps: dispatches calls (evidence: `src/server/mcp-server.ts`)
- MCP server → Player data: dispatches calls (evidence: `src/server/mcp-server.ts`)
- Hero data → Provider contract: implements (evidence: `src/providers/MarvelsApiProvider.ts`)
- Hero data → Retrying fetch: requests JSON (evidence: `src/providers/MarvelsApiProvider.ts`)
- Hero skins → Retrying fetch: requests JSON (evidence: `src/providers/MarvelsApiProvider.ts`)
- Skin catalog → Retrying fetch: requests JSON (evidence: `src/providers/MarvelsApiProvider.ts`)
- Achievements → Retrying fetch: requests JSON (evidence: `src/providers/MarvelsApiProvider.ts`)
- Item catalog → Retrying fetch: requests JSON (evidence: `src/providers/MarvelsApiProvider.ts`)
- Maps → Retrying fetch: requests JSON (evidence: `src/providers/MarvelsApiProvider.ts`)
- Player data → Retrying fetch: requests JSON (evidence: `src/providers/MarvelsApiProvider.ts`)
- Retrying fetch → MarvelsAPI: fetches data (evidence: `src/utils/fetch.ts`)
- Provider contract → Data types: uses contracts (evidence: `src/providers/IProvider.ts`)
- Hero data → Data types: uses types (evidence: `src/providers/MarvelsApiProvider.ts`)
