mcp-ps-store
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-injectorEinstellungen:
pydantic-settingsAbhängigkeitsverwaltung: Poetry
Tests: Pytest,
pytest-asyncio
Related MCP server: WG-Console-MCP-server
Was es bereitstellt
Tool | Wofür es gedacht ist |
| 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. |
| Filterbare Spieleliste: Suche nach Titel, sortieren nach Stunden / zuletzt gespielt / Trophäenfortschritt, filtern nach Plattform, Stunden, Daten und Fortschritt. |
| Jede Trophäe eines Spiels: verdient oder nicht, Datum, Seltenheit, Anteil der Spieler, die sie haben. |
| Was bereits gekauft oder über PS Plus beansprucht wurde, mit Stunden, falls bekannt – damit nichts bereits Besessenes empfohlen wird. |
| Was zuletzt gestartet wurde. |
| Online-ID, PS Plus, Trophäenstufe, lebenslange Trophäenzahlen. |
| 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 installOder mit einer einfachen virtuellen Umgebung:
python3.11 -m venv .venv && .venv/bin/pip install -e .2. Bei PSN anmelden
Melden Sie sich in einem Browser unter https://www.playstation.com an.
Öffnen Sie https://ca.account.sony.com/api/v1/ssocookie – es gibt
{"npsso":"..."}zurück.Kopieren Sie den 64-stelligen
npsso-Wert und führen Sie aus:
poetry run psn-login PASTE_NPSSO_HERETokens 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-doctorEs 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.mainClaude 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-storeDann 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 |
| — | NPSSO-Cookie. Eine Alternative zu |
|
| Wo Tokens zwischengespeichert werden. |
|
| Wie lange PSN-Antworten wiederverwendet werden, in Sekunden. |
|
| Gebietsschema für Links zu store.playstation.com. |
|
| HTTP-Timeout für PSN-Anfragen, in Sekunden. |
|
|
|
|
| Bindeadresse für die HTTP-Transports. |
|
| 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_gamesverhindert, 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 IIundAlan Wake 2sind 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.tomlEntwicklung
poetry run pytest # unit tests; no network and no account needed
poetry run psn-doctor # live check against the signed-in accountAvailable Tools
7 toolspsn_game_trophiesTrophy detail for one gameARead-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 libraryARead-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 libraryARead-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 profileBRead-only
Online ID, PS Plus status, trophy level and lifetime trophy counts.
Inputs: no named parameters. Returns: object
psn_recently_playedRecently playedBRead-only
The account's most recently launched games, newest first.
Inputs: limit. Returns: object
psn_refreshRefresh PSN cacheAIdempotent
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 profileARead-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
Scored across 7 tools
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.
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.
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.
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
Related MCP Connectors
Give any AI assistant real-time access to your phone's GPS and location history.
Personal context and preferences for AI via OAuth-approved profile sections and taste data.
Persistent memory and shared context across compatible AI assistants, with account-scoped OAuth.
Savecraft serves real save game data and expert game knowledge to AI assistants.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables AI assistants to access and interact with personal data from platforms like Steam, YouTube, Bilibili, Spotify, and Reddit for personalized, context-aware interactions.8864MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to access live Wargaming API data for World of Tanks Console, allowing queries about players, clans, vehicles, and tank comparisons.10 npmISC
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to access Garmin Connect fitness and health data, including activities, heart rate, sleep, and device information.MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to access Sapphire Wellness user data, including health alerts, personalized recommendations, and partner service subscriptions.-