API Integration and Code Assist Toolkit using MCP

Get contextual intelligence about Merchant API from the coding assistant of your choice. Within your integrated development environment (IDE), you can now access the developer documentation integration using the Model Context Protocol (MCP) service. This service accelerates your development for integration and migration workflows by providing your coding assistant with authoritative context from official Google API documentation.

For more information on the protocol itself, see the Model Context Protocol standard.

Overview

When migrating from Content API for Shopping to Merchant API or building a new integration, you need to understand new service structures, resource names, and methods. The MCP service simplifies this by providing official documentation and code samples to your coding assistant.

The service utilizes a highly specialized Retrieval-Augmented Generation (RAG) backend. When you ask your MCP-enabled IDE coding assistant a question about Merchant API, the service retrieves the most relevant snippets of text and code from Google's official resources and returns them as context to your coding assistant. This lets your assistant provide accurate, up-to-date answers without you ever having to leave your development environment.

How it works

Developer documentation integration using MCP integrates into a modern, AI-assisted development workflow:

  1. You ask a question in your MCP-compatible coding assistant or Agent. This can be a natural language question or a request for a code sample for the implementation of Merchant API methods.
  2. Your coding assistant sends a request for context to the MCP endpoint.
  3. The MCP service searches its indexed collection of official Merchant API documentation, guides, and code samples to find the most relevant information.
  4. The service returns these authoritative snippets as context to your coding assistant.
  5. Your coding assistant uses this high-quality context to generate a precise and helpful answer to your original question.

Getting started

To use MCP, you need an IDE or a coding assistant that supports the Model Context Protocol with streamable HTTP transport.

Endpoint configuration

To connect your tool to the service, use the provided remote endpoint details, which may require you to input either the direct service URL or the MCP definition, depending on your tool's configuration.

The service URL is:

MCP Server Name: "MAPI Docs MCP"
MCP Server URL:  "https://merchantapi.googleapis.com/devdocs/mcp/"

Example usage scenarios

MCP can accelerate your workflow in these common use cases.

Scenario 1: Migrating a legacy API call

You have an existing application using the Content API for Shopping and need to update it. You can ask about a specific legacy method to get details on the new implementation and a relevant code sample.

User prompt:

"What is the Merchant API equivalent for the accountstatuses.get method in the Content API for Shopping?"

The MCP service provides context from the official migration guides and reference documentation, letting your assistant respond with a detailed answer, including the new API name, accounts.issues.

Scenario 2: Finding a code sample

You are implementing a new feature and need a practical example to follow.

User prompt:

"Show me a Python code sample for adding a new shipping service using Merchant API."

The MCP service retrieves relevant code samples from the official Google GitHub repositories and developer guides. Your assistant can then present a complete, ready-to-adapt code block.

Scenario 3: Understanding API concepts

You encounter a new concept or want to understand the structure of a resource or the overall Merchant API pattern.

User prompt:

"How do I update the inventory for a product using Merchant API?"

The MCP service returns context from the products resource documentation and relevant guides. Your assistant can then explain how to use the accounts.productInputs.insert method and provide the partial product resource containing just the productId and the inventory-related fields you need to update.

"How do I authorize my application calls with Merchant API?"

The MCP service retrieves context from the official authentication guides, which cover different authorization methods. Your assistant can then explain the primary options available, such as using a service account for server-to-server interactions or an OAuth 2.0 client ID when acting on behalf of a user.

Scenario 4: Adapting to API changes

Merchant API introduces new patterns — such as batching requests — that differ from the Content API for Shopping. The Content API for Shopping uses specific custombatch methods, while the Merchant API uses a built-in, generic HTTP batching feature.

User prompt:

"What is the new way to do a products.custombatch in Merchant API?"

The MCP service retrieves context from Refactor code for concurrent requests explaining that dedicated custombatch methods don't exist in Merchant API. Instead, it provides documentation on using HTTP batching with a Content-Type of multipart. Your assistant can then explain how to construct a single HTTP request containing multiple API calls, sent to the https://merchantapi.googleapis.com/batch/{sub-api}/v1 endpoint, and provide an example of how to structure the multipart request. This turns a potentially confusing migration task into a guided process.

Knowledge base sources

The MCP service builds its knowledge base exclusively from public and official sources to ensure the context it provides is accurate and reliable. The service indexes the entire content of the official developer site and code sample repository, including: