diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json new file mode 100644 index 0000000..e270dd9 --- /dev/null +++ b/.claude-plugin/marketplace.json @@ -0,0 +1,21 @@ +{ + "name": "mastercard-developers", + "metadata": { + "description": "Official Mastercard Developers plugins and skills for AI coding agents, including the Mastercard Developers MCP server and best practices for building integrations with Mastercard APIs." + }, + "owner": { + "name": "Mastercard", + "email": "apisupport@mastercard.com" + }, + "plugins": [ + { + "name": "mastercard-developers", + "source": "./providers/claude/plugin/", + "description": "Mastercard Developers", + "version": "1.0.0", + "author": { + "name": "Mastercard" + } + } + ] +} diff --git a/.codex-plugin/marketplace.json b/.codex-plugin/marketplace.json new file mode 100644 index 0000000..dd59cd2 --- /dev/null +++ b/.codex-plugin/marketplace.json @@ -0,0 +1,27 @@ +{ + "name": "mastercard-developers", + "metadata": { + "description": "Official Mastercard Developers plugins and skills for AI coding agents, including the Mastercard Developers MCP server and best practices for building integrations with Mastercard APIs." + }, + "owner": { + "name": "Mastercard", + "email": "apisupport@mastercard.com" + }, + "plugins": [ + { + "name": "mastercard-developers", + "version": "1.0.0", + "source": { + "source": "git-subdir", + "url": "https://github.com/Mastercard/developers-agent-toolkit.git", + "path": "providers/codex/plugin", + "ref": "main" + }, + "policy": { + "installation": "AVAILABLE", + "authentication": "NONE" + }, + "category": "Finance" + } + ] +} diff --git a/.cursor-plugin/marketplace.json b/.cursor-plugin/marketplace.json new file mode 100644 index 0000000..f1d728e --- /dev/null +++ b/.cursor-plugin/marketplace.json @@ -0,0 +1,21 @@ +{ + "name": "mastercard-developers", + "metadata": { + "description": "Official Mastercard Developers plugins and skills for AI coding agents, including the Mastercard Developers MCP server and best practices for building integrations with Mastercard APIs." + }, + "owner": { + "name": "Mastercard", + "email": "apisupport@mastercard.com" + }, + "plugins": [ + { + "name": "mastercard-developers", + "source": "./providers/cursor/plugin/", + "description": "Mastercard Developers", + "version": "1.0.0", + "author": { + "name": "Mastercard" + } + } + ] +} diff --git a/.github/assets/md-prompt-output1.jpg b/.github/assets/md-prompt-output1.jpg new file mode 100644 index 0000000..0ee0c7e Binary files /dev/null and b/.github/assets/md-prompt-output1.jpg differ diff --git a/.github/assets/md-prompt-output2.jpg b/.github/assets/md-prompt-output2.jpg new file mode 100644 index 0000000..a4c73e6 Binary files /dev/null and b/.github/assets/md-prompt-output2.jpg differ diff --git a/.github/assets/md-prompt.jpg b/.github/assets/md-prompt.jpg new file mode 100644 index 0000000..2a53889 Binary files /dev/null and b/.github/assets/md-prompt.jpg differ diff --git a/.github/workflows/guard-skills.yml b/.github/workflows/guard-skills.yml new file mode 100644 index 0000000..3bc7b71 --- /dev/null +++ b/.github/workflows/guard-skills.yml @@ -0,0 +1,23 @@ +name: Guard Skills Sync +'on': + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + workflow_dispatch: +jobs: + skills-in-sync: + name: Verify provider skills match canonical skills/ + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: 'Use Node.js 20.x' + uses: actions/setup-node@v4 + with: + node-version: '20.x' + - name: Check skills are in sync + run: node scripts/sync.js --check diff --git a/.gitignore b/.gitignore index 3d826ab..bba36c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store .vscode .idea +*.iml .eslintcache .npmrc .mcpregistry* \ No newline at end of file diff --git a/README.md b/README.md index 1626bac..02da7c9 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,114 @@ main().catch((error) => { For more details, checkout [typescript](typescript/README.md) directory +## Agent Plugins + +[Agent skills](https://agentskills.io/home) are instructions that agents can use to build faster and more accurately. This repository provides official plugins that bundle the `mastercard-developers-bestpractice` skill together with the Mastercard Developers MCP server for popular agent harnesses. + +If you use one of these harnesses, we recommend installing the plugin, which includes the MCP server and updates automatically. + +> **Note:** The curated marketplace commands below (`@claude-plugins-official`, `@openai-curated`, and the Cursor slash command) work once the plugin is accepted into each vendor's registry. Until then, use the GitHub-based install shown under [Install from this repository](#install-from-this-repository). + +### Claude Code + +```bash +claude plugin install mastercard-developers@claude-plugins-official +``` + +### Codex + +```bash +codex plugin add mastercard-developers@openai-curated +``` + +### Cursor + +```bash +/add-plugin mastercard-developers +``` + +### Manual installation + +> Manually installed skills don't auto-update. Run `npx skills update -y` to get the latest versions. + +```bash +npx skills add Mastercard/developers-agent-toolkit +``` + +### Install from this repository + +Before the plugins are listed in the curated marketplaces, you can install +directly from this GitHub repository. + +**Claude Code** - add this repo as a marketplace, then install: + +```bash +claude plugin marketplace add Mastercard/developers-agent-toolkit +claude plugin install mastercard-developers@mastercard-developers +``` + +**Skills only** (any supported agent) - install the skill straight from the repo: + +```bash +npx skills add Mastercard/developers-agent-toolkit +``` + +Plugin sources live under [`providers/`](providers/), and the marketplace manifests are `.claude-plugin/marketplace.json`, `.codex-plugin/marketplace.json`, and `.cursor-plugin/marketplace.json`. + +### Using the skill + +Once the plugin (or MCP server) is installed, just prompt your agent in +plain language. The skill guides the agent to call the Mastercard +Developers MCP tools instead of relying on training data. + +Try a prompt like: + +```text +Using the Mastercard Developers tools, list the available services, +then show me the API operations for the Mastercard Locations API and +explain how to authenticate with OAuth 1.0a. +``` + +![Prompting the agent with the Mastercard Developers skill](.github/assets/md-prompt.jpg) + +Results will include the service list, the API operations for the Locations API, +and details about the OAuth 1.0a integration: + +![Service list and Locations API operations returned by the agent](.github/assets/md-prompt-output1.jpg) + +![OAuth 1.0a integration details returned by the agent](.github/assets/md-prompt-output2.jpg) + +Behind the scenes the agent chains the MCP tools to answer this, for example: + +1. `get-services-list` - discover available Mastercard products/services. +2. `get-api-operation-list` - list operations for the chosen service's spec. +3. `get-documentation-page` - discover the correct swagger spec path. +4. `get-oauth10a-integration-guide` - pull the official authentication guide. + +You don't call these tools directly - just describe your goal and the +agent selects the right tools. + +### Editing skills + +The [`skills/`](skills/) directory at the repository root is the **single source of truth** for every agent skill (for example `mastercard-developers-bestpractice`). Each provider under `providers/*/plugin/skills/` holds a synchronized copy - do not edit those copies directly. + +To update a skill: + +1. Edit the canonical file under `skills/` (e.g. `skills/mastercard-developers-bestpractice/SKILL.md`). +2. Run the sync script from the repository root to propagate the change to every provider: + + ```bash + node scripts/sync.js + ``` + +To verify (without writing) that the provider copies match the canonical source - useful in CI or a pre-commit hook - run: + +```bash +node scripts/sync.js --check +``` + +This exits non-zero if any provider skill is missing or out of sync. + ## Contributing Contributions are welcome. Please feel free to submit a pull request or open an issue to report a bug or suggest a feature. diff --git a/providers/README.md b/providers/README.md new file mode 100644 index 0000000..bebe233 --- /dev/null +++ b/providers/README.md @@ -0,0 +1,40 @@ +# Provider Plugins + +This directory contains plugins for different AI code editors and agent harnesses. + +Each provider has the same layout: + +``` +providers//plugin/ +├── skills/ # Agent skills (mastercard-developers-bestpractice) +├── .mcp.json | mcp.json # Mastercard Developers MCP server wiring +└── .-plugin/ # Provider-specific plugin manifest (plugin.json) +``` + +## Providers + +| Provider | Plugin manifest | MCP config | +|----------|-----------------|------------| +| `claude` | `.claude-plugin/plugin.json` | `.mcp.json` | +| `codex` | `.codex-plugin/plugin.json` | `.mcp.json` | +| `cursor` | `.cursor-plugin/plugin.json` | `mcp.json` | + +## MCP server + +Every plugin connects to the remote Mastercard Developers MCP server at +`https://developer.mcp.mastercard.com`, which requires **no authentication**. +A local `npx -y @mastercard/developers-mcp` alternative is documented in the +skill. + +## Skills + +Each plugin ships the `mastercard-developers-bestpractice` skill under +`skills/`. The skill instructs agents on how to set up the Mastercard +Developers MCP server (remote and local) and how to reach Mastercard +documentation in `llms.txt` format. + +> **Do not edit the skill copies under `providers/*/plugin/skills/`.** They are +> generated from the canonical [`skills/`](../skills/) directory at the +> repository root. Edit the canonical file, then run `node scripts/sync.js` +> to propagate the change to every provider. `node scripts/sync.js --check` +> (also run in CI) verifies the copies are in sync. diff --git a/providers/claude/plugin/.claude-plugin/plugin.json b/providers/claude/plugin/.claude-plugin/plugin.json new file mode 100644 index 0000000..b969131 --- /dev/null +++ b/providers/claude/plugin/.claude-plugin/plugin.json @@ -0,0 +1,24 @@ +{ + "name": "mastercard-developers", + "description": "Mastercard Developers plugin for Claude to help build integrations with Mastercard APIs, including best practices and the Mastercard Developers MCP server.", + "version": "1.0.0", + "author": { + "name": "Mastercard", + "url": "https://developer.mastercard.com" + }, + "homepage": "https://developer.mastercard.com", + "repository": "https://github.com/Mastercard/developers-agent-toolkit", + "license": "MIT", + "keywords": [ + "mastercard", + "mastercard-developers", + "payments", + "api", + "open-banking", + "open-finance", + "integration", + "mcp", + "modelcontextprotocol", + "agent-toolkit" + ] +} diff --git a/providers/claude/plugin/.mcp.json b/providers/claude/plugin/.mcp.json new file mode 100644 index 0000000..2117284 --- /dev/null +++ b/providers/claude/plugin/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "mastercard-developers": { + "type": "http", + "url": "https://developer.mcp.mastercard.com" + } + } +} diff --git a/providers/claude/plugin/skills/mastercard-developers-bestpractice/SKILL.md b/providers/claude/plugin/skills/mastercard-developers-bestpractice/SKILL.md new file mode 100644 index 0000000..ed37aee --- /dev/null +++ b/providers/claude/plugin/skills/mastercard-developers-bestpractice/SKILL.md @@ -0,0 +1,214 @@ +--- +name: mastercard-developers-bestpractice +description: Best practices for AI agents using the Mastercard Developers platform +metadata: + author: mastercard-developers + version: "1.0.0" + audience: api-integration-agents +--- + +# Mastercard Developers MCP Server + +The Mastercard Developers Agent Toolkit exposes Mastercard's product +documentation, API specifications, and integration guides to AI agents +through a Model Context Protocol (MCP) server. Once the server is +connected, call its tools to discover services, inspect API operations +and schemas, read official documentation, and generate integration code +grounded in current Mastercard Developers content instead of relying on +training data. + +Use this skill to set up the server in an MCP client, and to drive the +server's tools when answering questions about Mastercard APIs. + +## Choosing remote vs local + +| | Remote (recommended) | Local | +| --- | --- | --- | +| Setup | Add one URL; nothing to install | Runs `@mastercard/developers-mcp` via `npx` | +| Requirements | MCP client only | Node.js + `npx` on the machine | +| Best for | Most users; fastest start | Scoping to one service/spec, local tooling, customization | +| Scope flags | Not available | Supports `--service` and `--api-specification` | + +The remote server URL is `https://developer.mcp.mastercard.com` and +requires **no authentication**. Choose local only when you need the +`--service` / `--api-specification` flags or tighter local control. + +## Set up the remote server + +Pick the entry that matches the MCP client, write the config, then +reload or restart the client. + +### Claude Code + +Run: + +```bash +claude mcp add --transport http mastercard-developers https://developer.mcp.mastercard.com +``` + +### VS Code + +Add to `.vscode/mcp.json` in the workspace: + +```json +{ + "servers": { + "mastercard-developers": { + "type": "http", + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +### Cursor + +Add to `~/.cursor/mcp.json`: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +### ChatGPT and other MCP clients + +Add a custom connector or server with: + +- URL: `https://developer.mcp.mastercard.com` +- Authentication: **No authentication** + +## Set up the local server + +The local server runs through `npx`, so Node.js must be installed. The +launch command is always `npx -y @mastercard/developers-mcp`, optionally +followed by a scope flag (see below). + +### Claude Desktop + +Add to `claude_desktop_config.json` (or install the prebuilt `.dxt` +extension from Mastercard Developers, which writes the same entry): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +### VS Code + +Add to `.vscode/mcp.json`: + +```json +{ + "servers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +### Cursor and other MCP clients + +Add to `~/.cursor/mcp.json` (or the client's MCP config file): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +## Scope the local server with flags + +Flags are **local-only** and limit what the server exposes, which +reduces noise and focuses the agent on one API. + +| Flag | Effect | Example value | +| --- | --- | --- | +| `--service` | Restrict the server to one service's documentation | `https://developer.mastercard.com/open-banking-us/documentation/` | +| `--api-specification` | Point the server at one raw OpenAPI/Swagger spec | `https://static.developer.mastercard.com/content/match/swagger/match-pro.yaml` | + +If both are supplied, `--api-specification` takes priority over +`--service`. + +Pass a flag as an extra entry in `args`, using `--flag=value` form. + +Scope to a single service: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": [ + "-y", + "@mastercard/developers-mcp", + "--service=https://developer.mastercard.com/open-banking-us/documentation/" + ] + } + } +} +``` + +Scope to a single API specification (overrides `--service`): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": [ + "-y", + "@mastercard/developers-mcp", + "--api-specification=https://static.developer.mastercard.com/content/match/swagger/match-pro.yaml" + ] + } + } +} +``` + +## Verify the connection + +After configuring a client, confirm the server is live before relying +on it: + +- The client lists `mastercard-developers` among its connected MCP + servers/tools. +- A `get-services-list` call returns a non-empty list of services. + +If the tools do not appear: + +- Reload or restart the MCP client after editing its config. +- Remote: confirm the URL is exactly + `https://developer.mcp.mastercard.com` and that authentication is set + to none. +- Local: confirm Node.js and `npx` are installed and that `args` is a + JSON array of strings (`["-y", "@mastercard/developers-mcp"]`). +- Confirm the config key matches the client: `servers` for VS Code, + `mcpServers` for Cursor, Claude Desktop, and other clients. + +# Documentation in llms.txt format + +As an alternative to using the MCP, you can access documentation directly in Markdown format. + +Visit https://developer.mastercard.com/llms.txt for an overview of all Mastercard Developers APIs. + +The full documentation for each service is available by appending llms-full.txt to the end of +the main documentation URL - for example +https://developer.mastercard.com/eligibility-api/documentation/llms-full.txt \ No newline at end of file diff --git a/providers/codex/plugin/.codex-plugin/plugin.json b/providers/codex/plugin/.codex-plugin/plugin.json new file mode 100644 index 0000000..abfbec0 --- /dev/null +++ b/providers/codex/plugin/.codex-plugin/plugin.json @@ -0,0 +1,41 @@ +{ + "name": "mastercard-developers", + "version": "1.0.0", + "description": "Mastercard Developers plugin for Codex to help build integrations with Mastercard APIs, including best practices and the Mastercard Developers MCP server.", + "author": { + "name": "Mastercard", + "url": "https://developer.mastercard.com" + }, + "homepage": "https://developer.mastercard.com", + "repository": "https://github.com/Mastercard/developers-agent-toolkit", + "license": "MIT", + "keywords": [ + "mastercard", + "mastercard-developers", + "payments", + "api", + "open-banking", + "open-finance", + "integration", + "mcp", + "modelcontextprotocol", + "agent-toolkit" + ], + "skills": "./skills/", + "interface": { + "displayName": "Mastercard Developers", + "developerName": "Mastercard", + "shortDescription": "Mastercard Developers plugin for Codex", + "longDescription": "Build integrations with Mastercard APIs using current product documentation, API specifications, and integration guides. Includes best practices and the Mastercard Developers MCP server.", + "category": "Finance", + "capabilities": [], + "websiteURL": "https://developer.mastercard.com", + "privacyPolicyURL": "https://www.mastercard.com/global/en/vision/corp-responsibility/commitment-to-privacy/privacy.html", + "termsOfServiceURL": "https://developer.mastercard.com/terms-of-use", + "brandColor": "#EB001B", + "defaultPrompt": [ + "Use Mastercard Developers to help with this task" + ], + "screenshots": [] + } +} diff --git a/providers/codex/plugin/.mcp.json b/providers/codex/plugin/.mcp.json new file mode 100644 index 0000000..2117284 --- /dev/null +++ b/providers/codex/plugin/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "mastercard-developers": { + "type": "http", + "url": "https://developer.mcp.mastercard.com" + } + } +} diff --git a/providers/codex/plugin/README.md b/providers/codex/plugin/README.md new file mode 100644 index 0000000..734b02c --- /dev/null +++ b/providers/codex/plugin/README.md @@ -0,0 +1,49 @@ +# Mastercard Developers Codex Plugin + +This directory contains the Codex-specific assets for the Mastercard Developers +plugin. + +## What's here + +| File | Purpose | +|------|---------| +| `.codex-plugin/plugin.json` | Plugin manifest (metadata, skills path, interface) | +| `.mcp.json` | Wires the remote Mastercard Developers MCP server (`https://developer.mcp.mastercard.com`, no authentication) | +| `skills/` | One subdirectory per skill (`mastercard-developers-bestpractice`) | + +## MCP + +The Mastercard Developers MCP server is a remote HTTP server that requires +**no authentication**, so no OAuth or app registration is needed. The +connection is declared directly in `.mcp.json`: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "type": "http", + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +## Skills + +Skills live under `skills/`, one subdirectory each. The +`mastercard-developers-bestpractice` skill explains how to set up the MCP +server (remote and local via `npx -y @mastercard/developers-mcp`) and how to +access Mastercard documentation in `llms.txt` format. + +## Installing + +See the [top-level README](../../../README.md) for install commands. For Codex: + +```bash +codex plugin add mastercard-developers@openai-curated +``` + +> **Note:** The `@openai-curated` command works once this plugin is accepted +> into OpenAI's curated registry. Until then, install directly from this +> repository as described in the +> [top-level README](../../../README.md#install-from-this-repository). diff --git a/providers/codex/plugin/skills/mastercard-developers-bestpractice/SKILL.md b/providers/codex/plugin/skills/mastercard-developers-bestpractice/SKILL.md new file mode 100644 index 0000000..ed37aee --- /dev/null +++ b/providers/codex/plugin/skills/mastercard-developers-bestpractice/SKILL.md @@ -0,0 +1,214 @@ +--- +name: mastercard-developers-bestpractice +description: Best practices for AI agents using the Mastercard Developers platform +metadata: + author: mastercard-developers + version: "1.0.0" + audience: api-integration-agents +--- + +# Mastercard Developers MCP Server + +The Mastercard Developers Agent Toolkit exposes Mastercard's product +documentation, API specifications, and integration guides to AI agents +through a Model Context Protocol (MCP) server. Once the server is +connected, call its tools to discover services, inspect API operations +and schemas, read official documentation, and generate integration code +grounded in current Mastercard Developers content instead of relying on +training data. + +Use this skill to set up the server in an MCP client, and to drive the +server's tools when answering questions about Mastercard APIs. + +## Choosing remote vs local + +| | Remote (recommended) | Local | +| --- | --- | --- | +| Setup | Add one URL; nothing to install | Runs `@mastercard/developers-mcp` via `npx` | +| Requirements | MCP client only | Node.js + `npx` on the machine | +| Best for | Most users; fastest start | Scoping to one service/spec, local tooling, customization | +| Scope flags | Not available | Supports `--service` and `--api-specification` | + +The remote server URL is `https://developer.mcp.mastercard.com` and +requires **no authentication**. Choose local only when you need the +`--service` / `--api-specification` flags or tighter local control. + +## Set up the remote server + +Pick the entry that matches the MCP client, write the config, then +reload or restart the client. + +### Claude Code + +Run: + +```bash +claude mcp add --transport http mastercard-developers https://developer.mcp.mastercard.com +``` + +### VS Code + +Add to `.vscode/mcp.json` in the workspace: + +```json +{ + "servers": { + "mastercard-developers": { + "type": "http", + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +### Cursor + +Add to `~/.cursor/mcp.json`: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +### ChatGPT and other MCP clients + +Add a custom connector or server with: + +- URL: `https://developer.mcp.mastercard.com` +- Authentication: **No authentication** + +## Set up the local server + +The local server runs through `npx`, so Node.js must be installed. The +launch command is always `npx -y @mastercard/developers-mcp`, optionally +followed by a scope flag (see below). + +### Claude Desktop + +Add to `claude_desktop_config.json` (or install the prebuilt `.dxt` +extension from Mastercard Developers, which writes the same entry): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +### VS Code + +Add to `.vscode/mcp.json`: + +```json +{ + "servers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +### Cursor and other MCP clients + +Add to `~/.cursor/mcp.json` (or the client's MCP config file): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +## Scope the local server with flags + +Flags are **local-only** and limit what the server exposes, which +reduces noise and focuses the agent on one API. + +| Flag | Effect | Example value | +| --- | --- | --- | +| `--service` | Restrict the server to one service's documentation | `https://developer.mastercard.com/open-banking-us/documentation/` | +| `--api-specification` | Point the server at one raw OpenAPI/Swagger spec | `https://static.developer.mastercard.com/content/match/swagger/match-pro.yaml` | + +If both are supplied, `--api-specification` takes priority over +`--service`. + +Pass a flag as an extra entry in `args`, using `--flag=value` form. + +Scope to a single service: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": [ + "-y", + "@mastercard/developers-mcp", + "--service=https://developer.mastercard.com/open-banking-us/documentation/" + ] + } + } +} +``` + +Scope to a single API specification (overrides `--service`): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": [ + "-y", + "@mastercard/developers-mcp", + "--api-specification=https://static.developer.mastercard.com/content/match/swagger/match-pro.yaml" + ] + } + } +} +``` + +## Verify the connection + +After configuring a client, confirm the server is live before relying +on it: + +- The client lists `mastercard-developers` among its connected MCP + servers/tools. +- A `get-services-list` call returns a non-empty list of services. + +If the tools do not appear: + +- Reload or restart the MCP client after editing its config. +- Remote: confirm the URL is exactly + `https://developer.mcp.mastercard.com` and that authentication is set + to none. +- Local: confirm Node.js and `npx` are installed and that `args` is a + JSON array of strings (`["-y", "@mastercard/developers-mcp"]`). +- Confirm the config key matches the client: `servers` for VS Code, + `mcpServers` for Cursor, Claude Desktop, and other clients. + +# Documentation in llms.txt format + +As an alternative to using the MCP, you can access documentation directly in Markdown format. + +Visit https://developer.mastercard.com/llms.txt for an overview of all Mastercard Developers APIs. + +The full documentation for each service is available by appending llms-full.txt to the end of +the main documentation URL - for example +https://developer.mastercard.com/eligibility-api/documentation/llms-full.txt \ No newline at end of file diff --git a/providers/cursor/plugin/.cursor-plugin/plugin.json b/providers/cursor/plugin/.cursor-plugin/plugin.json new file mode 100644 index 0000000..7c77860 --- /dev/null +++ b/providers/cursor/plugin/.cursor-plugin/plugin.json @@ -0,0 +1,24 @@ +{ + "name": "mastercard-developers", + "description": "Mastercard Developers plugin for Cursor to help build integrations with Mastercard APIs, including best practices and the Mastercard Developers MCP server.", + "version": "1.0.0", + "author": { + "name": "Mastercard", + "url": "https://developer.mastercard.com" + }, + "homepage": "https://developer.mastercard.com", + "repository": "https://github.com/Mastercard/developers-agent-toolkit", + "license": "MIT", + "keywords": [ + "mastercard", + "mastercard-developers", + "payments", + "api", + "open-banking", + "open-finance", + "integration", + "mcp", + "modelcontextprotocol", + "agent-toolkit" + ] +} diff --git a/providers/cursor/plugin/mcp.json b/providers/cursor/plugin/mcp.json new file mode 100644 index 0000000..8c5bdf0 --- /dev/null +++ b/providers/cursor/plugin/mcp.json @@ -0,0 +1,7 @@ +{ + "mcpServers": { + "mastercard-developers": { + "url": "https://developer.mcp.mastercard.com" + } + } +} diff --git a/providers/cursor/plugin/skills/mastercard-developers-bestpractice/SKILL.md b/providers/cursor/plugin/skills/mastercard-developers-bestpractice/SKILL.md new file mode 100644 index 0000000..ed37aee --- /dev/null +++ b/providers/cursor/plugin/skills/mastercard-developers-bestpractice/SKILL.md @@ -0,0 +1,214 @@ +--- +name: mastercard-developers-bestpractice +description: Best practices for AI agents using the Mastercard Developers platform +metadata: + author: mastercard-developers + version: "1.0.0" + audience: api-integration-agents +--- + +# Mastercard Developers MCP Server + +The Mastercard Developers Agent Toolkit exposes Mastercard's product +documentation, API specifications, and integration guides to AI agents +through a Model Context Protocol (MCP) server. Once the server is +connected, call its tools to discover services, inspect API operations +and schemas, read official documentation, and generate integration code +grounded in current Mastercard Developers content instead of relying on +training data. + +Use this skill to set up the server in an MCP client, and to drive the +server's tools when answering questions about Mastercard APIs. + +## Choosing remote vs local + +| | Remote (recommended) | Local | +| --- | --- | --- | +| Setup | Add one URL; nothing to install | Runs `@mastercard/developers-mcp` via `npx` | +| Requirements | MCP client only | Node.js + `npx` on the machine | +| Best for | Most users; fastest start | Scoping to one service/spec, local tooling, customization | +| Scope flags | Not available | Supports `--service` and `--api-specification` | + +The remote server URL is `https://developer.mcp.mastercard.com` and +requires **no authentication**. Choose local only when you need the +`--service` / `--api-specification` flags or tighter local control. + +## Set up the remote server + +Pick the entry that matches the MCP client, write the config, then +reload or restart the client. + +### Claude Code + +Run: + +```bash +claude mcp add --transport http mastercard-developers https://developer.mcp.mastercard.com +``` + +### VS Code + +Add to `.vscode/mcp.json` in the workspace: + +```json +{ + "servers": { + "mastercard-developers": { + "type": "http", + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +### Cursor + +Add to `~/.cursor/mcp.json`: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +### ChatGPT and other MCP clients + +Add a custom connector or server with: + +- URL: `https://developer.mcp.mastercard.com` +- Authentication: **No authentication** + +## Set up the local server + +The local server runs through `npx`, so Node.js must be installed. The +launch command is always `npx -y @mastercard/developers-mcp`, optionally +followed by a scope flag (see below). + +### Claude Desktop + +Add to `claude_desktop_config.json` (or install the prebuilt `.dxt` +extension from Mastercard Developers, which writes the same entry): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +### VS Code + +Add to `.vscode/mcp.json`: + +```json +{ + "servers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +### Cursor and other MCP clients + +Add to `~/.cursor/mcp.json` (or the client's MCP config file): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +## Scope the local server with flags + +Flags are **local-only** and limit what the server exposes, which +reduces noise and focuses the agent on one API. + +| Flag | Effect | Example value | +| --- | --- | --- | +| `--service` | Restrict the server to one service's documentation | `https://developer.mastercard.com/open-banking-us/documentation/` | +| `--api-specification` | Point the server at one raw OpenAPI/Swagger spec | `https://static.developer.mastercard.com/content/match/swagger/match-pro.yaml` | + +If both are supplied, `--api-specification` takes priority over +`--service`. + +Pass a flag as an extra entry in `args`, using `--flag=value` form. + +Scope to a single service: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": [ + "-y", + "@mastercard/developers-mcp", + "--service=https://developer.mastercard.com/open-banking-us/documentation/" + ] + } + } +} +``` + +Scope to a single API specification (overrides `--service`): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": [ + "-y", + "@mastercard/developers-mcp", + "--api-specification=https://static.developer.mastercard.com/content/match/swagger/match-pro.yaml" + ] + } + } +} +``` + +## Verify the connection + +After configuring a client, confirm the server is live before relying +on it: + +- The client lists `mastercard-developers` among its connected MCP + servers/tools. +- A `get-services-list` call returns a non-empty list of services. + +If the tools do not appear: + +- Reload or restart the MCP client after editing its config. +- Remote: confirm the URL is exactly + `https://developer.mcp.mastercard.com` and that authentication is set + to none. +- Local: confirm Node.js and `npx` are installed and that `args` is a + JSON array of strings (`["-y", "@mastercard/developers-mcp"]`). +- Confirm the config key matches the client: `servers` for VS Code, + `mcpServers` for Cursor, Claude Desktop, and other clients. + +# Documentation in llms.txt format + +As an alternative to using the MCP, you can access documentation directly in Markdown format. + +Visit https://developer.mastercard.com/llms.txt for an overview of all Mastercard Developers APIs. + +The full documentation for each service is available by appending llms-full.txt to the end of +the main documentation URL - for example +https://developer.mastercard.com/eligibility-api/documentation/llms-full.txt \ No newline at end of file diff --git a/scripts/sync.js b/scripts/sync.js new file mode 100644 index 0000000..ad02b8a --- /dev/null +++ b/scripts/sync.js @@ -0,0 +1,224 @@ +#!/usr/bin/env node +// +// sync.js - Sync agent skills from the canonical `skills/` directory into every +// provider plugin's skills directory. +// +// The canonical source of truth for every skill is the repo-root `skills/` +// directory. Edit a skill there once, run `node scripts/sync.js`, and the change +// is duplicated into each provider plugin folder (Claude, Codex, Cursor). +// +// Usage: +// node scripts/sync.js # copy canonical skills into all providers +// node scripts/sync.js --check # verify providers are in sync; exit 1 if not +// +const fs = require("fs").promises; +const fsSync = require("fs"); +const path = require("path"); +const { execSync } = require("child_process"); + +const REPO_ROOT = path.join(__dirname, ".."); + +// Canonical source of truth for all skills. +const SKILLS_DIR = path.join(REPO_ROOT, "skills"); + +// Provider plugin skill directories that mirror the canonical skills. +const PLUGIN_SKILLS_DIRS = [ + path.join(REPO_ROOT, "providers/claude/plugin/skills"), + path.join(REPO_ROOT, "providers/codex/plugin/skills"), + path.join(REPO_ROOT, "providers/cursor/plugin/skills"), +]; + +// Files preserved in provider skill dirs during cleanup (never deleted). +const PRESERVE_FILES = new Set(["README.md", ".gitkeep"]); + +// --------------------------------------------------------------------------- +// Version bumping (DISABLED by default). +// +// Flip BUMP_VERSION to `true` to auto-bump plugin/marketplace versions whenever +// a skill change is detected. The supporting logic below is ready to use. +// --------------------------------------------------------------------------- +const BUMP_VERSION = false; + +const VERSION_FILES = [ + path.join(REPO_ROOT, ".claude-plugin/marketplace.json"), + path.join(REPO_ROOT, ".codex-plugin/marketplace.json"), + path.join(REPO_ROOT, ".cursor-plugin/marketplace.json"), + path.join(REPO_ROOT, "providers/claude/plugin/.claude-plugin/plugin.json"), + path.join(REPO_ROOT, "providers/codex/plugin/.codex-plugin/plugin.json"), + path.join(REPO_ROOT, "providers/cursor/plugin/.cursor-plugin/plugin.json"), +]; + +const bumpVersion = (version, type) => { + const [major, minor, patch] = version.split(".").map(Number); + if (type === "minor") return `${major}.${minor + 1}.0`; + return `${major}.${minor}.${patch + 1}`; +}; + +const updateVersionFile = async (filePath, bumpType) => { + const raw = await fs.readFile(filePath, "utf8"); + const content = JSON.parse(raw); + if (content.version) { + content.version = bumpVersion(content.version, bumpType); + } + if (content.plugins) { + for (const plugin of content.plugins) { + if (plugin.version) plugin.version = bumpVersion(plugin.version, bumpType); + } + } + await fs.writeFile(filePath, JSON.stringify(content, null, 2) + "\n", "utf8"); + console.log(` Bumped version in: ${path.relative(REPO_ROOT, filePath)}`); +}; + +// Returns { added, deleted, modified } by inspecting git working-tree status +// for the provider skill directories after files have been written. +const getGitSkillChanges = () => { + const rels = PLUGIN_SKILLS_DIRS.map((d) => path.relative(REPO_ROOT, d)); + try { + const output = execSync( + `git status --porcelain -- ${rels.map((r) => `"${r}"`).join(" ")}`, + { cwd: REPO_ROOT, encoding: "utf8" }, + ); + const lines = output.trim().split("\n").filter(Boolean); + const added = lines.some((l) => l.startsWith("??")); + const deleted = lines.some((l) => l[1] === "D"); + const modified = lines.some((l) => !l.startsWith("??") && l[1] !== "D"); + return { added, deleted, modified }; + } catch { + return { added: false, deleted: false, modified: false }; + } +}; + +// --------------------------------------------------------------------------- +// Helpers +// --------------------------------------------------------------------------- + +// Recursively list files under a directory, relative to it. +const listFiles = async (dir) => { + const out = []; + const walk = async (current, prefix) => { + const entries = await fs.readdir(current, { withFileTypes: true }); + for (const entry of entries) { + const rel = prefix ? path.join(prefix, entry.name) : entry.name; + if (entry.isDirectory()) { + await walk(path.join(current, entry.name), rel); + } else { + out.push(rel); + } + } + }; + await walk(dir, ""); + return out; +}; + +// Remove everything from a provider skills dir except preserved files. +const cleanDirectory = async (dir) => { + let entries; + try { + entries = await fs.readdir(dir, { withFileTypes: true }); + } catch { + return; // dir does not exist yet + } + for (const entry of entries) { + if (PRESERVE_FILES.has(entry.name)) continue; + await fs.rm(path.join(dir, entry.name), { recursive: true, force: true }); + } +}; + +// --------------------------------------------------------------------------- +// Sync +// --------------------------------------------------------------------------- + +const collectCanonicalFiles = async () => { + if (!fsSync.existsSync(SKILLS_DIR)) { + throw new Error(`Canonical skills directory not found: ${SKILLS_DIR}`); + } + const files = (await listFiles(SKILLS_DIR)).filter( + (f) => !PRESERVE_FILES.has(path.basename(f)), + ); + if (files.length === 0) { + throw new Error(`No skill files found under ${SKILLS_DIR}`); + } + return files; +}; + +const runSync = async () => { + const files = await collectCanonicalFiles(); + console.log(`Found ${files.length} skill file(s) in canonical skills/`); + + for (const dir of PLUGIN_SKILLS_DIRS) { + await fs.mkdir(dir, { recursive: true }); + await cleanDirectory(dir); + } + + for (const file of files) { + const content = await fs.readFile(path.join(SKILLS_DIR, file), "utf8"); + for (const dir of PLUGIN_SKILLS_DIRS) { + const outputPath = path.join(dir, file); + await fs.mkdir(path.dirname(outputPath), { recursive: true }); + await fs.writeFile(outputPath, content, "utf8"); + console.log(` Written: ${path.relative(REPO_ROOT, outputPath)}`); + } + } + + if (BUMP_VERSION) { + const { added, deleted, modified } = getGitSkillChanges(); + if (added || deleted || modified) { + const bumpType = added || deleted ? "minor" : "patch"; + console.log(`Skills changed (type: ${bumpType}), bumping plugin versions`); + for (const versionFile of VERSION_FILES) { + await updateVersionFile(versionFile, bumpType); + } + } else { + console.log("No skill changes detected, skipping version bump"); + } + } + + console.log("Sync complete."); +}; + +// --check: verify each provider mirror matches the canonical source. Does not +// write anything; exits 1 if any provider is out of sync (useful in CI). +const runCheck = async () => { + const files = await collectCanonicalFiles(); + let outOfSync = 0; + + for (const dir of PLUGIN_SKILLS_DIRS) { + for (const file of files) { + const canonical = await fs.readFile(path.join(SKILLS_DIR, file), "utf8"); + const targetPath = path.join(dir, file); + let target; + try { + target = await fs.readFile(targetPath, "utf8"); + } catch { + console.error(` MISSING: ${path.relative(REPO_ROOT, targetPath)}`); + outOfSync++; + continue; + } + if (target !== canonical) { + console.error(` OUT OF SYNC: ${path.relative(REPO_ROOT, targetPath)}`); + outOfSync++; + } + } + } + + if (outOfSync > 0) { + throw new Error( + `${outOfSync} provider skill file(s) out of sync. Run \`node scripts/sync.js\`.`, + ); + } + console.log("All provider skills are in sync with canonical skills/."); +}; + +const main = async () => { + const check = process.argv.includes("--check"); + if (check) { + await runCheck(); + } else { + await runSync(); + } +}; + +main().catch((err) => { + console.error(err.message); + process.exit(1); +}); diff --git a/skills/mastercard-developers-bestpractice/SKILL.md b/skills/mastercard-developers-bestpractice/SKILL.md new file mode 100644 index 0000000..ed37aee --- /dev/null +++ b/skills/mastercard-developers-bestpractice/SKILL.md @@ -0,0 +1,214 @@ +--- +name: mastercard-developers-bestpractice +description: Best practices for AI agents using the Mastercard Developers platform +metadata: + author: mastercard-developers + version: "1.0.0" + audience: api-integration-agents +--- + +# Mastercard Developers MCP Server + +The Mastercard Developers Agent Toolkit exposes Mastercard's product +documentation, API specifications, and integration guides to AI agents +through a Model Context Protocol (MCP) server. Once the server is +connected, call its tools to discover services, inspect API operations +and schemas, read official documentation, and generate integration code +grounded in current Mastercard Developers content instead of relying on +training data. + +Use this skill to set up the server in an MCP client, and to drive the +server's tools when answering questions about Mastercard APIs. + +## Choosing remote vs local + +| | Remote (recommended) | Local | +| --- | --- | --- | +| Setup | Add one URL; nothing to install | Runs `@mastercard/developers-mcp` via `npx` | +| Requirements | MCP client only | Node.js + `npx` on the machine | +| Best for | Most users; fastest start | Scoping to one service/spec, local tooling, customization | +| Scope flags | Not available | Supports `--service` and `--api-specification` | + +The remote server URL is `https://developer.mcp.mastercard.com` and +requires **no authentication**. Choose local only when you need the +`--service` / `--api-specification` flags or tighter local control. + +## Set up the remote server + +Pick the entry that matches the MCP client, write the config, then +reload or restart the client. + +### Claude Code + +Run: + +```bash +claude mcp add --transport http mastercard-developers https://developer.mcp.mastercard.com +``` + +### VS Code + +Add to `.vscode/mcp.json` in the workspace: + +```json +{ + "servers": { + "mastercard-developers": { + "type": "http", + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +### Cursor + +Add to `~/.cursor/mcp.json`: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "url": "https://developer.mcp.mastercard.com" + } + } +} +``` + +### ChatGPT and other MCP clients + +Add a custom connector or server with: + +- URL: `https://developer.mcp.mastercard.com` +- Authentication: **No authentication** + +## Set up the local server + +The local server runs through `npx`, so Node.js must be installed. The +launch command is always `npx -y @mastercard/developers-mcp`, optionally +followed by a scope flag (see below). + +### Claude Desktop + +Add to `claude_desktop_config.json` (or install the prebuilt `.dxt` +extension from Mastercard Developers, which writes the same entry): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +### VS Code + +Add to `.vscode/mcp.json`: + +```json +{ + "servers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +### Cursor and other MCP clients + +Add to `~/.cursor/mcp.json` (or the client's MCP config file): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": ["-y", "@mastercard/developers-mcp"] + } + } +} +``` + +## Scope the local server with flags + +Flags are **local-only** and limit what the server exposes, which +reduces noise and focuses the agent on one API. + +| Flag | Effect | Example value | +| --- | --- | --- | +| `--service` | Restrict the server to one service's documentation | `https://developer.mastercard.com/open-banking-us/documentation/` | +| `--api-specification` | Point the server at one raw OpenAPI/Swagger spec | `https://static.developer.mastercard.com/content/match/swagger/match-pro.yaml` | + +If both are supplied, `--api-specification` takes priority over +`--service`. + +Pass a flag as an extra entry in `args`, using `--flag=value` form. + +Scope to a single service: + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": [ + "-y", + "@mastercard/developers-mcp", + "--service=https://developer.mastercard.com/open-banking-us/documentation/" + ] + } + } +} +``` + +Scope to a single API specification (overrides `--service`): + +```json +{ + "mcpServers": { + "mastercard-developers": { + "command": "npx", + "args": [ + "-y", + "@mastercard/developers-mcp", + "--api-specification=https://static.developer.mastercard.com/content/match/swagger/match-pro.yaml" + ] + } + } +} +``` + +## Verify the connection + +After configuring a client, confirm the server is live before relying +on it: + +- The client lists `mastercard-developers` among its connected MCP + servers/tools. +- A `get-services-list` call returns a non-empty list of services. + +If the tools do not appear: + +- Reload or restart the MCP client after editing its config. +- Remote: confirm the URL is exactly + `https://developer.mcp.mastercard.com` and that authentication is set + to none. +- Local: confirm Node.js and `npx` are installed and that `args` is a + JSON array of strings (`["-y", "@mastercard/developers-mcp"]`). +- Confirm the config key matches the client: `servers` for VS Code, + `mcpServers` for Cursor, Claude Desktop, and other clients. + +# Documentation in llms.txt format + +As an alternative to using the MCP, you can access documentation directly in Markdown format. + +Visit https://developer.mastercard.com/llms.txt for an overview of all Mastercard Developers APIs. + +The full documentation for each service is available by appending llms-full.txt to the end of +the main documentation URL - for example +https://developer.mastercard.com/eligibility-api/documentation/llms-full.txt \ No newline at end of file