Back to blog
TutorialJune 28, 20263 min read

JustSerpAPI MCP Server Tutorial: Let AI Assistants Search, Inspect, and Call SERP APIs

Learn how to connect JustSerpAPI MCP Server to Codex, Claude Desktop, Cursor, Claude Code, OpenAI Agents SDK, and other MCP-compatible clients.

What MCP is

MCP stands for Model Context Protocol. It gives AI clients a standard way to connect to external tools and APIs. For a SERP API workflow, that means your assistant can do more than explain a request: it can discover available endpoints, inspect required parameters, call APIs, and continue paginated results when the response includes a next-page token or offset.

JustSerpAPI MCP Server exposes JustSerpAPI to MCP-compatible clients such as Codex, Claude Desktop, Cursor, Claude Code, OpenAI Agents SDK, and other AI assistant tools.

What JustSerpAPI MCP helps with

  • Find the right Google Search, Google Maps, Google Trends, Google Shopping, or Web endpoint from a natural-language request.
  • Inspect required parameters, optional parameters, enum values, and pagination hints before calling.
  • Call a selected JustSerpAPI endpoint with your API key and return raw JSON data.
  • Continue paginated results when the previous response includes a next-page token or offset.
  • Check subscription state, remaining credits, recent API usage, consumed credits, and endpoint trends.
  • Ask the assistant to explain common API errors, such as a 402 response.

Prepare your JustSerpAPI API key

Before using MCP, prepare your JustSerpAPI API key. Log in to the JustSerpAPI Dashboard, then copy your key from the account or API key area.

Your API key is sensitive. Do not commit it to public repositories, include it in screenshots, or share it with untrusted parties. Replace your_api_key in the examples with your real key.

Remote HTTP is the recommended setup. You do not need to run a local server. Add the hosted MCP URL and Authorization header to your MCP client configuration.

json
{
  "mcpServers": {
    "justserpapi": {
      "url": "https://mcp.justserpapi.com/mcp",
      "headers": {
        "Authorization": "Bearer your_api_key"
      }
    }
  }
}

After saving the configuration, restart or refresh your MCP client. Any client that supports remote HTTP MCP servers can connect to JustSerpAPI MCP through this URL.

Alternative setup: local stdio

If your client works better with a local command-based MCP server, you can run the server locally with npx.

json
{
  "mcpServers": {
    "justserpapi": {
      "command": "npx",
      "args": ["-y", "justserpapi-mcp"],
      "env": {
        "JUSTSERPAPI_API_KEY": "your_api_key"
      }
    }
  }
}

This configuration runs the same local command as npx -y justserpapi-mcp and passes your key through JUSTSERPAPI_API_KEY.

Local stdio is useful when you want the MCP server to run on your own machine. Most users should start with Remote HTTP.

Prompts you can use

After the connection works, ask in normal business language.

text
Find the Google search API and show me the required parameters.
text
Search Google for "best running shoes" in the United States.
text
Find the Google Maps reviews endpoint and tell me how to request the next page.
text
Get Google Trends trending-now results for the US.
text
Find the Google Shopping search API and call it for "iphone 16 case".
text
Convert this web page to Markdown: https://example.com
text
Continue to the next page of the previous JustSerpAPI result.
text
Check my remaining JustSerpAPI credits.
text
Show my API usage for the last 30 days.
text
The API returned code 402. Explain what it means and what I should check.
  • First ask the assistant to find the endpoint for your search task.
  • Ask it to inspect the schema before calling, especially when location, language, device, pagination, or result type matters.
  • Provide the business parameters after reviewing required fields. Do not ask the assistant to guess required values.
  • If the response includes pagination metadata, ask the assistant to continue with the next-page hint.
  • When a call fails, share the response code and error message so the assistant can compare them with the endpoint schema and common API behavior.

FAQ

Where should I put the API key?

Remote HTTP uses the Authorization: Bearer your_api_key header. Local stdio uses the JUSTSERPAPI_API_KEY environment variable.

Does MCP replace API documentation?

No. MCP is best for letting AI assistants discover and call APIs inside a workflow. API documentation is still the right place for humans to read complete endpoint details and field definitions.

Can the assistant call every JustSerpAPI endpoint?

The assistant calls APIs through your JustSerpAPI API key. Actual access depends on your account, subscription, remaining credits, and endpoint permissions. Before making a call, ask the assistant to show the endpoint and parameters it plans to use.

Next steps

If you already have a JustSerpAPI API key, start with the Remote HTTP setup and ask your AI client to find one endpoint for a search workflow you use often. For complete endpoint details, keep the JustSerpAPI Documentation open. For source code and release updates, visit JustSerpAPI MCP GitHub.

Continue with JustSerpAPI

Open the Dashboard for your API key, read the full API docs, or view the MCP GitHub project for the latest configuration.