Skip to main content
Glama

mcp-ps-store

MCP-Server, der die eigene Spielhistorie eines PlayStation Network-Kontos offenlegt – Spielzeit, Trophäenfortschritt, gekaufte Bibliothek – damit ein KI-Assistent Spiele auf Basis echter Daten empfehlen kann, statt zu raten.

Русская версия: README.ru.md.

Über

PSN hat keine öffentliche API. Dieser Server kommuniziert mit derselben internen API, die auch die PlayStation-Mobil-App verwendet, und authentifiziert sich mit einem NPSSO-Cookie aus einer Browsersitzung. Jede Anfrage ist ein Lesezugriff; es wird nie etwas auf das Konto geschrieben.

Der Aufbau folgt einer geschichteten Architektur: eine API-Schicht (MCP-Tools), eine Kernschicht (Dienste, Repositories, DTOs), ein DI-Container und eine Infrastrukturschicht.

Kerntechnologien

  • Sprache: Python 3.11+

  • Protokoll: Model Context Protocol (mcp)

  • HTTP-Client: httpx (asynchron)

  • DI-Container: dependency-injector

  • Einstellungen: pydantic-settings

  • Abhängigkeitsverwaltung: Poetry

  • Tests: Pytest, pytest-asyncio

Related MCP server: WG-Console-MCP-server

Was es bereitstellt

Tool

Wofür es gedacht ist

psn_taste_profile

Das wichtigste: eine einzelne Zusammenfassung – Top-Spiele nach Stunden, Lieblings-Franchises, Spielverhalten (durchschnittliche Sitzung, Anteil an Tiefentauchgängen, Platinrate), Spiele nahe 100 %, nach einer Stunde abgebrochene Spiele und nie gestartete Käufe. Hier beginnen für jede Empfehlungsfrage.

psn_library

Filterbare Spieleliste: Suche nach Titel, sortieren nach Stunden / zuletzt gespielt / Trophäenfortschritt, filtern nach Plattform, Stunden, Daten und Fortschritt.

psn_game_trophies

Jede Trophäe eines Spiels: verdient oder nicht, Datum, Seltenheit, Anteil der Spieler, die sie haben.

psn_owned_games

Was bereits gekauft oder über PS Plus beansprucht wurde, mit Stunden, falls bekannt – damit nichts bereits Besessenes empfohlen wird.

psn_recently_played

Was zuletzt gestartet wurde.

psn_profile

Online-ID, PS Plus, Trophäenstufe, lebenslange Trophäenzahlen.

psn_refresh

Löscht den Antwort-Cache (PSN-Antworten werden 10 Minuten lang zwischengespeichert).

Plus ein recommend_games-Prompt – ein fertiges Szenario „Erstelle mein Profil und empfehle Spiele“, das eine optionale Vorgabe wie „etwas Kurzes“ oder „Ko-op für zwei“ akzeptiert.

Schnellstart

Python 3.11+ ist erforderlich.

1. Installieren

Mit Poetry:

poetry install

Oder mit einer einfachen virtuellen Umgebung:

python3.11 -m venv .venv && .venv/bin/pip install -e .

2. Bei PSN anmelden

  1. Melden Sie sich in einem Browser unter https://www.playstation.com an.

  2. Öffnen Sie https://ca.account.sony.com/api/v1/ssocookie – es gibt {"npsso":"..."} zurück.

  3. Kopieren Sie den 64-stelligen npsso-Wert und führen Sie aus:

poetry run psn-login PASTE_NPSSO_HERE

Tokens werden in ~/.mcp-ps-store/tokens.json mit Berechtigungen 0600 gespeichert.

Zur Sitzungsdauer. Das Zugriffstoken lebt eine Stunde und das Aktualisierungstoken nur zehn Tage, aber das NPSSO selbst lebt etwa zwei Monate. Das NPSSO wird daher neben den Tokens gespeichert, und der Server authentifiziert sich selbstständig neu, wenn das Aktualisierungstoken abläuft. In der Praxis hält ein psn-login etwa 60 Tage.

3. Prüfen, ob es funktioniert

poetry run psn-doctor

Es gibt den Kontonamen aus, wie viele Spiele sichtbar sind und die Top fünf nach Stunden.

Einen Client verbinden

Claude Code

claude mcp add ps-store -- /path/to/mcp-ps-store/.venv/bin/python -m app.main

Claude Desktop

In claude_desktop_config.json:

{
  "mcpServers": {
    "ps-store": {
      "command": "/path/to/mcp-ps-store/.venv/bin/python",
      "args": ["-m", "app.main"],
      "cwd": "/path/to/mcp-ps-store"
    }
  }
}

Codex CLI

Codex spricht stdio mit lokalen MCP-Servern, daher funktioniert es genauso. Führen Sie entweder codex mcp add aus oder fügen Sie dies zu ~/.codex/config.toml hinzu:

[mcp_servers.ps-store]
command = "/path/to/mcp-ps-store/.venv/bin/python"
args = ["-m", "app.main"]
cwd = "/path/to/mcp-ps-store"

Überprüfen Sie es mit /mcp in einer Codex-Sitzung.

ChatGPT

ChatGPT kann keinen lokalen Prozess starten. Benutzerdefinierte Verbindungen werden im Entwicklermodus hinzugefügt (Einstellungen → Apps → Erweitert) und müssen ein öffentlicher HTTPS-Endpunkt sein, der SSE oder Streamable HTTP spricht. Daher muss der Server auf HTTP-Transport umgestellt und veröffentlicht werden:

PSN_MCP_TRANSPORT=streamable-http PSN_MCP_PORT=8000 poetry run mcp-ps-store

Dann http://127.0.0.1:8000/mcp über HTTPS bereitstellen – mit OpenAIs Secure MCP Tunnel oder einem Tunnel wie cloudflared / ngrok – und die resultierende URL als benutzerdefinierte Verbindung hinzufügen.

Dies veröffentlicht Ihre PSN-Historie an jeden, der die URL findet. Der Server hat keine eigene Authentifizierung, also schützen Sie den Tunnel mit einer Authentifizierung, lassen Sie ihn nur so lange laufen, wie Sie ihn brauchen, und bevorzugen Sie Codex CLI, wenn ein lokaler Client ausreicht.

Konfiguration

Alle Einstellungen werden aus der Umgebung oder einer .env-Datei gelesen (siehe .env.example).

Variable

Standard

Bedeutung

PSN_NPSSO

—

NPSSO-Cookie. Eine Alternative zu psn-login: wenn gesetzt, meldet sich der Server selbst an.

PSN_TOKENS_PATH

~/.mcp-ps-store/tokens.json

Wo Tokens zwischengespeichert werden.

PSN_CACHE_TTL

600

Wie lange PSN-Antworten wiederverwendet werden, in Sekunden.

PSN_STORE_LOCALE

en-us

Gebietsschema für Links zu store.playstation.com.

PSN_REQUEST_TIMEOUT

30

HTTP-Timeout für PSN-Anfragen, in Sekunden.

PSN_MCP_TRANSPORT

stdio

stdio, streamable-http oder sse.

PSN_MCP_HOST

127.0.0.1

Bindeadresse für die HTTP-Transports.

PSN_MCP_PORT

8000

Port für die HTTP-Transports.

Einschränkungen

  • Spielzeit existiert nur für PS4-/PS5-/PC-Versionen. PSN meldet PS3- und Vita-Spiele nur mit Trophäen, daher erscheinen sie mit hours: null.

  • Es gibt hier keinen PS Store-Katalog. Der Store ist vollständig clientseitig, und seine GraphQL-API akzeptiert nur persistierte Abfragen, deren Hashes Sony bei jedem Deployment rotiert – das funktionsfähig zu halten ist nicht realistisch. Empfehlungskandidaten stammen aus dem eigenen Wissen des Modells über Spiele, während psn_owned_games verhindert, dass bereits Gekauftes vorgeschlagen wird.

  • Die gekaufte Bibliothek wird über PSNs private GraphQL-API abgerufen. Wenn Sony die Abfrage ändert, funktioniert dieses eine Tool nicht mehr; alles andere läuft weiter und die Zusammenfassung erhält einen backlog_unavailable-Hinweis.

  • Spielzeit und Trophäen werden nach Titel zusammengeführt, sodass eine Neuveröffentlichung mit dem Original verschmelzen kann, wenn sie denselben Trophäensatz teilen. Editionen, Plattformsuffixe und römische Zahlen werden absichtlich normalisiert – Alan Wake II und Alan Wake 2 sind ein Spiel.

  • Die API ist inoffiziell: Sony kann sie jederzeit ändern.

Projektstruktur

.
├── app/
│   ├── api/              # MCP layer: tools, prompts, serialisers, tool errors
│   │   ├── games/
│   │   ├── profile/
│   │   └── taste/
│   ├── core/             # Business logic: services, repositories, DTOs
│   │   ├── auth/         # NPSSO -> tokens, refresh, re-login
│   │   ├── games/        # Library, playtime/trophy merge, name normalisation
│   │   ├── profile/      # Account profile and trophy summary
│   │   └── taste/        # Taste digest aggregation
│   ├── di/               # DI containers and providers
│   ├── infra/adapters/   # HTTP client, token storage, TTL cache
│   ├── cli.py            # psn-login, psn-doctor
│   └── main.py           # MCP server entry point
├── settings/             # pydantic-settings configuration
├── tests/
│   ├── core/             # Merge and aggregation tests
│   └── factories/        # Builders for test data
└── pyproject.toml

Entwicklung

poetry run pytest        # unit tests; no network and no account needed
poetry run psn-doctor    # live check against the signed-in account

Available Tools

7 tools
psn_game_trophiesTrophy detail for one gameA
Read-only

Full trophy list for a single game with earned status, earn dates and rarity. Pass a title (fuzzy match against the account's games) or an exact np_communication_id. Useful for 'what's left to platinum' and for judging how deeply the user engaged with a game.

Inputs: game, limit, status, include_hidden, +2 more. Returns: object

psn_libraryPSN game libraryA
Read-only

Filtered, sorted list of games on the account, joining playtime with trophy progress. Use it to answer questions like 'what did I play most in 2024', 'what have I nearly finished', 'what did I drop quickly'. Store page: https://store.playstation.com//concept/<concept_id>.

Inputs: sort, limit, offset, search, +9 more. Returns: object

psn_owned_gamesPurchased PSN libraryA
Read-only

Games the account has bought or claimed (including PS Plus monthly claims), with hours played where known. Check this before recommending anything so you do not suggest a game the user already owns, and to surface unplayed purchases.

Inputs: limit, offset, search, platform, +1 more. Returns: object

psn_profilePSN account profileB
Read-only

Online ID, PS Plus status, trophy level and lifetime trophy counts.

Inputs: no named parameters. Returns: object

psn_recently_playedRecently playedB
Read-only

The account's most recently launched games, newest first.

Inputs: limit. Returns: object

psn_refreshRefresh PSN cacheA
Idempotent

Drops the cached PSN responses so the next call re-reads live data. Use after the user has just played something.

Inputs: no named parameters. Returns: object

psn_taste_profilePSN taste profileA
Read-only

One-shot digest of the account's gaming taste: totals, playtime habits, top games by hours, favourite franchises, platinums, games close to completion, games bounced off after a short try, and unplayed purchases. Start here for any recommendation request.

Inputs: top, include_backlog. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 7 tools

    Disambiguation3/5

    Most tools are distinct, but psn_taste_profile, psn_library, and psn_owned_games overlap in what they surface: playtime habits, nearly-finished games, dropped games, and unplayed purchases are all claimed by more than one tool. The descriptions somewhat clarify their intents (digest vs. queryable list vs. ownership check), but an agent could easily pick the wrong one for a given user question.

    Naming Consistency4/5

    All tools share a consistent psn_ prefix and snake_case convention, which makes them recognizable as a family. The primary deviation is that psn_refresh is verb-first while the rest are noun phrases (psn_library, psn_profile, psn_owned_games), but the overall pattern is still predictable.

    Tool Count5/5

    Seven tools is a well-scoped set for a PSN account insights server. Each tool covers a meaningful slice of the domain—profile, library, owned games, recent activity, trophies, taste digest, and cache refresh—without feeling padded or redundant at the count level.

    Completeness4/5

    The core domain of account-level PSN data is well covered: profile, catalog, ownership, recency, trophies, and an aggregate taste digest are all present. Minor gaps exist, such as no direct store/game-details lookup or cross-game trophy comparison, but the set supports the stated recommendation and account-insight workflows without major dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers