logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

playfab-integration-gateway

A middleware layer facilitating secure, direct access for generative AI agents to PlayFab backend functionalities. It abstracts PlayFab APIs for streamlined inventory operations, player data querying, catalog exploration, and segment analysis via a unified interface.

Author

playfab-integration-gateway logo

akiojin

MIT License

Quick Info

GitHub GitHub Stars 1
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

playfabapisrequestsplayfab servicesplayfab datainteractions playfab

PlayFab Integration Gateway

smithery badge

Overview 🤔

This server acts as a crucial intermediary, bridging the gap between large language models (like those powering Claude or development environments like VS Code) and the comprehensive suite of PlayFab game backend services. It functions as a secure and optimized translator, enabling natural language commands to trigger complex PlayFab operations, including searching the item catalog, querying player segments, retrieving profile details, managing virtual inventories, and converting PlayFab identifiers.

Illustrative Scenario

text User Input: "Fetch the ten most recent additions to the item registry." AI Agent Output: Invokes the PlayFab search_items endpoint and formats the resulting data for readability.

Operational Mechanics 🛠️

This system utilizes the Model Context Protocol (MCP) specification to create a standardized communication channel between the AI inference engine and the required PlayFab APIs. While MCP is architected for broad compatibility across various AI frameworks, its current deployment is accessible in a developer preview state.

Getting Started Sequence:

  1. Initialize your development workspace.
  2. Inject your specific project credentials into your LLM client's configuration files.
  3. Commence intuitive interaction with your PlayFab data assets!

Capabilities Matrix 📊

  • Execute targeted item lookups via the search_items API.
  • Economy v2 Catalog Administration:
  • Provision new items in draft status using create_draft_item.
  • Modify existing draft item attributes via update_draft_item.
  • Retire items from the catalog using delete_item.
  • Promote draft items to live status with publish_draft_item.
  • Retrieve granular details for any item using get_item.

Player & Segment Intelligence

  • Fetch detailed membership data for defined player segments.
  • Analyze player profiles filtered by specific segment criteria.
  • Translate a generic PlayFab ID into a Title Player Account ID using get_title_player_account_id_from_playfab_id.
  • Obtain exhaustive user account metadata via get_user_account_info.

Virtual Goods & Inventory Handling

  • Data Retrieval:
  • Query the current contents of a player's inventory using get_inventory_items.
  • Fetch available inventory collection identifiers through get_inventory_collection_ids.
  • Mutation Operations (Addition/Removal):
  • Inject new items into inventory via add_inventory_items.
  • Purge items from inventory using delete_inventory_items.
  • Reduce the quantity of specific items via subtract_inventory_items.
  • Attribute Adjustments:
  • Modify metadata or configuration associated with inventory entries using update_inventory_items.

Economy v2 Backend Management

  • Perform complex, atomic sequences of inventory modifications via execute_inventory_operations.
  • Note: Within the Economy v2 paradigm, virtual currencies are treated fundamentally as inventory assets.

User Account Moderation

  • Enforce punitive actions (bans) against players based on ID, network address (IP), or device identifier (MAC) using ban_users.
  • Lift all active restrictions for a user with revoke_all_bans_for_user.

Persistent Player Data Access

  • Read custom, player-specific key-value data using get_user_data.
  • Persist updates to player custom data via update_user_data.

Global Title Configuration Control

  • Establish or overwrite system-wide title settings using set_title_data.
  • Retrieve current system-wide title configuration via get_title_data.
  • Set backend-only, non-public internal configurations with set_title_internal_data.
  • Fetch internal configuration values using get_title_internal_data.

Initial Deployment Guide 🚀

Automated Installation via Smithery

To set up the PlayFab Integration Gateway for automatic execution within Claude Desktop using Smithery:

bash npx -y @smithery/cli install @akiojin/playfab-mcp-server --client claude

Prerequisites

  • A runtime environment supporting Node.js version 18 or newer.
  • An active PlayFab developer account (you must secure your Title ID and Developer Secret Key from the PlayFab Game Manager console).
  • A compatible LLM host application (e.g., Claude Desktop).

Project Configuration Steps

  1. Secure your PlayFab Title ID and Developer Secret Key from the Game Manager.
  2. In the project's root directory, generate a .env file containing these secrets:

bash PLAYFAB_TITLE_ID=YOUR_TITLE_ID_HERE PLAYFAB_DEV_SECRET_KEY=YOUR_SECRET_KEY_HERE

Deployment and Activation

  1. Dependency Acquisition

Execute this command in the project root to fetch necessary libraries:

bash npm install

  1. Source Compilation

Transform the TypeScript source code into executable JavaScript:

bash npm run build

  1. Server Initialization

Launch the gateway service:

bash npm start

  1. Verification Message

Successful launch confirmation will display:

text PlayFab Server running on stdio

Development Tooling Configuration

Quality Assurance Frameworks

  • ESLint: Enforcing code style uniformity using recommended TypeScript rules.
  • Prettier: Automated code formatting adhering to project standards.
  • TypeScript: Strict compilation mode enabled for maximal type integrity.
  • Jest: Testing harness integrated for TypeScript projects.

Utility Scripts Reference

bash

Compile source code

npm run build

Enable file-watching for rapid development

npm run watch

Validate TypeScript definitions only

npm run typecheck

Execute static code analysis (Lint)

npm run lint

Automatically correct linting violations

npm run lint:fix

Apply standard code formatting

npm run format

Verify current code formatting status

npm run format:check

Execute the full test suite

npm test

Run tests continuously upon file changes

npm run test:watch

Generate detailed test coverage metrics

npm run test:coverage

TypeScript Strictness Profile

This project mandates TypeScript's strictest settings, which guarantees: - Nullability is explicitly handled. - Implicit any types are forbidden. - Function signatures require full type specification. - Overall, the compiler operates in its most rigorous mode.

Testing Protocol

Tests are implemented using Jest and reside in directories named __tests__ or files ending in .test.ts. Comprehensive testing prior to code commits is mandatory to maintain quality standards.

Integration with Cursor IDE

To integrate this PlayFab gateway with the Cursor IDE:

  1. Ensure Cursor Desktop is installed.
  2. Launch Cursor in a fresh, empty workspace directory.
  3. Copy the repository's mcp.json configuration file into your workspace folder, ensuring environmental placeholders are correctly substituted.
  4. Launch Cursor; the PlayFab tool should appear in the available tools list.
  5. Test functionality with a prompt like, "What items are available for purchase?"

Configuring Claude Desktop Client

Adjust the Claude Desktop configuration by navigating to File → Settings → Developer → Edit Config. Substitute the existing content of your claude_desktop_config file with the following structure, populating the environment variables with your actual credentials:

{ "mcpServers": { "playfab": { "command": "npx", "args": [ "-y", "@akiojin/playfab-mcp-server" ], "env": { "PLAYFAB_TITLE_ID": "Your PlayFab Title ID", "PLAYFAB_DEV_SECRET_KEY": "Your PlayFab Developer Secret Key" } } } }

Following these procedures establishes a seamless operational link between your chosen LLM environment and the PlayFab backend services.

Collaboration Guidelines

Commit Standardization

This project enforces adherence to the Conventional Commits specification to streamline automated release management.

Message Structure

text ():

#### Commit Classifications - **feat**: Introduction of new functionality (triggers MINOR version increment). - **fix**: Rectification of a software defect (triggers PATCH version increment). - **docs**: Documentation material modifications only. - **style**: Formatting or whitespace adjustments that do not alter code logic. - **refactor**: Restructuring code without changing external behavior. - **perf**: Optimizations targeted at execution speed or resource usage. - **test**: Additions or corrections to testing apparatus. - **chore**: Maintenance tasks related to build systems or auxiliary scripts. #### Version Escalation Rules - **MAJOR** Increment: Mandated if the footer contains `BREAKING CHANGE` or if the type/scope is immediately followed by an exclamation mark (`!`). - Example: `feat!: deprecated legacy endpoint removed` - Example: `fix: critical bug fix BREAKING CHANGE: Required configuration changes for initialization.` - **MINOR** Increment: Triggered solely by commits classified as `feat`. - Example: `feat: integrate new PlayFab segment filtering capability` - **PATCH** Increment: Triggered solely by commits classified as `fix`. - Example: `fix: resolved race condition in inventory subtraction` ### Release Lifecycle #### Phase 1: Versioning & Documentation Update bash # Analyze recent commits to update the CHANGELOG.md # Then, increment the version number accordingly: npm version patch # or minor/major as dictated by commit history #### Phase 2: Synchronization and Tagging bash # Commit the version bump artifact git push origin main # Propagate the new version tag to the remote repository git push origin --tags #### Phase 3: Automated Deployment Tagging a new version (e.g., `v1.2.3`) initiates the `release-and-publish.yml` GitHub Action, which autonomously executes the following: - Generates a formal GitHub Release noting the changelog content. - Publishes the updated package artifact to the npm registry. - Attaches relevant build outputs as release files. #### Repository Setup Requirements For full automation, the following repository secrets must be configured: - `NPM_TOKEN`: Required for publishing to npm. - `DEPENDABOT_PAT`: A Personal Access Token (PAT) with `repo` and `workflow` scopes is needed for Dependabot to auto-approve maintenance PRs. 1. Generate a PAT with `repo` and `workflow` permissions. 2. In repository Settings → Secrets and variables → Actions, create a new secret named `DEPENDABOT_PAT`. - **Branch Protection for `main`:** Branch protection rules must be active to enforce quality gates: 1. Navigate to Settings → Branches and establish a rule for `main`. 2. Enable "Require a pull request before merging". 3. Enable "Require status checks to pass before merging". 4. Specify required status checks: `build (18.x)`, `build (20.x)`, `build (22.x)`. ### Script Catalog | Command | Purpose | |--------|-------------| | `npm start` | Initiates the MCP communication server. | | `npm run build` | Compiles TypeScript source files to JavaScript. | | `npm run watch` | Runs the build process under continuous file monitoring for development. | | `npm run typecheck` | Executes the TypeScript compiler strictly for type validation. | | `npm run lint` | Runs the configured ESLint static analysis tools. | | `npm run lint:fix` | Automatically resolves fixable ESLint violations. | | `npm run format` | Applies consistent code formatting via Prettier. | | `npm run format:check` | Verifies if the codebase adheres to the established format rules. | | `npm test` | Executes the comprehensive unit and integration test suite. | | `npm run test:watch` | Runs tests interactively, restarting upon source file changes. | | `npm run test:coverage` | Generates a detailed report on code coverage metrics. | ## Security Posture Security is paramount. If you discover any vulnerability in this codebase, please adhere strictly to the following reporting procedure: ### Vulnerability Disclosure Protocol 1. **ABSOLUTELY NO** public disclosure via GitHub Issues. 2. All security concerns must be reported privately through GitHub's built-in vulnerability reporting mechanism: - Navigate to the repository's **Security** tab. - Click **Report a vulnerability**. - Furnish a comprehensive report detailing the flaw. ### Required Disclosure Elements - A precise description of the identified security weakness. - Exact, step-by-step instructions to reliably reproduce the exploit. - An assessment of the potential negative impact. - Optional: Proposed code modifications or mitigations. ### Our Security Commitment - We commit to acknowledging your report within 48 hours of receipt. - You will receive periodic progress updates on the remediation effort. - We will provide appropriate recognition for the discovery, unless anonymity is explicitly requested. ### Operational Security Guidelines Users of this server must uphold these standards: 1. **Credential Segregation**: Never commit sensitive credentials (keys, tokens) directly to source control; rely exclusively on environment variables. 2. **Dependency Hygiene**: Maintain up-to-date packages by routinely executing `npm audit` and applying necessary updates. 3. **Principle of Least Privilege**: Ensure the service account or keys used possess only the minimum permissions necessary to perform their designated tasks. 4. **Key Rotation**: Regularly cycle PlayFab Developer Secret Keys to mitigate exposure risk. ## Support Channels Should you require assistance or wish to propose enhancements for the PlayFab Integration Gateway, the following conduits are available: 1. **Bug Reports & Feature Suggestions**: Please utilize the [GitHub Issues tracker](https://github.com/akiojin/playfab-mcp-server/issues). 2. **General Queries & Community Help**: Engage in [GitHub Discussions](https://github.com/akiojin/playfab-mcp-server/discussions). 3. **Reference Material**: Consult the README and inline code documentation for operational examples. ### Pre-Submission Checklist Before submitting a new ticket, conduct a thorough search of existing issues to confirm the problem hasn't already been logged. If you find a relevant entry, feel free to append your specific context or findings. ### Supported Inquiry Types - Guidance on installation and initial setup procedures. - Reports of bugs accompanied by reproducible failure scenarios. - Proposals for new features or substantial improvements. - Suggestions for enhancing documentation clarity. ### Out-of-Scope Support - Troubleshooting general PlayFab API usage (Consult official [PlayFab Documentation](https://docs.microsoft.com/gaming/playfab/)). - Issues stemming from external third-party tools or services. - Requests for bespoke, custom integration development. ## Licensing This software is distributed under the terms of the MIT License; refer to the [LICENSE](LICENSE) file for the complete legal text. *** **WIKIPEDIA CONTEXT (Technical Background on HTTP Requests):** XMLHttpRequest (XHR) defines an Application Programming Interface (API) implemented as a JavaScript object. Its primary function is to enable a web browser environment to dispatch HTTP requests to a remote server, independent of the main page loading cycle. This capability is foundational to Asynchronous JavaScript and XML (Ajax) programming paradigms. Historically, server interaction relied primarily on form submissions or navigating hyperlinks, which necessitated full page refreshes. XHR permits dynamic data exchange without disrupting the user interface state. == Genesis == XMLHttpRequest's conceptual foundation was established around the year 2000 by Microsoft developers working on Outlook. Its initial functional implementation appeared within Internet Explorer 5 (1999), though it initially utilized COM object identifiers such as `ActiveXObject("Msxml2.XMLHTTP")` rather than the standardized `XMLHttpRequest` string. By the release of Internet Explorer 7 (2006), universal adoption of the standardized identifier was achieved across all major browser engines, including Mozilla's Gecko (2002), Safari 1.2 (2004), and Opera 8.0 (2005). === Standardization Efforts === The World Wide Web Consortium (W3C) formalized the object specification as a Working Draft on April 5, 2006. A subsequent Level 2 draft in February 2008 introduced crucial enhancements: event progress monitoring, support for cross-site data transfer, and improved byte stream handling. By late 2011, the Level 2 features were merged back into the primary specification. Development responsibility transitioned to the WHATWG near the end of 2012, which now maintains the specification as a living document defined using Web IDL. == Operational Workflow == Executing a server request using XHR typically involves a predefined sequence of programming actions: 1. **Instantiation**: Create an instance of the XMLHttpRequest object via its constructor. 2. **Configuration**: Invoke the `open()` method to define the HTTP method (e.g., GET, POST), specify the target resource Uniform Resource Identifier (URI), and select synchronous or asynchronous execution mode. 3. **Asynchronous Listener**: For asynchronous operations, register an event handler function to process state changes asynchronously. 4. **Transmission**: Finalize and dispatch the request to the server using the `send()` method. 5. **Response Handling**: Monitor the object's `readyState`. Upon reaching state 4 (the "done" state), the server's response data is accessible, typically within the `responseText` attribute, for final processing. Beyond this core sequence, XHR offers extensive control: request headers can be customized to guide server processing; data payloads can be uploaded within the `send()` call; received responses can be parsed directly from formats like JSON into native JavaScript objects, or streamed incrementally; and operations can be canceled mid-flight or subjected to timeouts. == Cross-Domain Access Limitations == Early in the Web's evolution, security models imposed strict limitations on requests originating from one domain being sent to another, a restriction designed to prevent malicious data exfiltration...

See Also

`