Guide

MCP server

Give an AI assistant the golf course data as tools. Ask it in plain words for a club, a scorecard or the slope from a tee, and it searches and fetches the answer itself, with your own API key.

Endpoint and key

The server speaks the Model Context Protocol (MCP) over Streamable HTTP at:

https://mcp.golfdata.io/mcp

Send your API key in the Authorization header as Bearer <key>, the same key as for the REST API. No key yet? Create an account and make one on your account page; the free trial works here too. A separate key for the assistant lets you turn it off on its own.

The key goes in the client's settings, not in the chat: the assistant never sees it. Keep it in an environment variable or let the client ask for it, as in the examples below.

Add it to your assistant

Claude Code

With your key in GOLFDATA_KEY:

Terminal
claude mcp add --transport http golfdata https://mcp.golfdata.io/mcp \
  --header "Authorization: Bearer $GOLFDATA_KEY"

Cursor

In .cursor/mcp.json in your project, or ~/.cursor/mcp.json for every project. Cursor fills in GOLFDATA_KEY from your environment.

.cursor/mcp.json
{
  "mcpServers": {
    "golfdata": {
      "url": "https://mcp.golfdata.io/mcp",
      "headers": { "Authorization": "Bearer ${env:GOLFDATA_KEY}" }
    }
  }
}

VS Code

In .vscode/mcp.json. VS Code asks for the key the first time and keeps it in its own secret storage.

.vscode/mcp.json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "golfdata-key",
      "description": "golfdata.io API key",
      "password": true
    }
  ],
  "servers": {
    "golfdata": {
      "type": "http",
      "url": "https://mcp.golfdata.io/mcp",
      "headers": { "Authorization": "Bearer ${input:golfdata-key}" }
    }
  }
}

Claude Desktop

Through mcp-remote, which runs with Node and passes the header on. Replace your-key with your key.

claude_desktop_config.json
{
  "mcpServers": {
    "golfdata": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote", "https://mcp.golfdata.io/mcp",
        "--header", "Authorization:${GOLFDATA_AUTH}"
      ],
      "env": { "GOLFDATA_AUTH": "Bearer your-key" }
    }
  }
}

Any other client that speaks Streamable HTTP and lets you set a header works the same way. Connectors that only offer a sign-in with OAuth, and no header, cannot use the server yet.

Tools

Every tool only reads, and answers with the same JSON as the REST endpoint next to it.

ToolWhat it answersCounts
search_clubsClubs by name, town or region, or near a point, with their courses. Same as GET /v1/clubs.Free
get_clubOne club with its courses, position, address and website.Free
search_coursesCourse summaries by name, or all courses of a country. Same as GET /v1/courses.Free
get_courseThe whole scorecard: par and stroke index per hole, every tee with its lengths, course rating and slope.1 course request
get_coursesUp to 25 scorecards in one call. Same as GET /v1/courses/batch.1 per course found
get_green_positionsThe middle of each green, where the course has them.1 more course request, when there are any
list_countriesEvery country code with its number of courses and clubs.Free
list_changesWhat was added, changed and removed since a release.Free
list_releasesThe release history with each data_version.Free
get_usageYour plan and how many course requests are left.Free

The counting is the same as for the REST API: only course data counts, and searching never does. The server tells the assistant to search first and fetch only the courses you ask for, and each answer that counts says how many course requests are left. See pricing for the plans.

Things to ask

  • What is the course rating and slope from the blue tees at Kilmacolm, for men and for women?
  • Find the golf clubs within 20 km of Málaga and list their 18-hole courses with par.
  • Give me the scorecard of the Old Course at St Andrews in yards, as a table.
  • Which holes at this course are par 5, and what is their stroke index?
  • Build a handicap calculator for my app that uses the golfdata.io API, and test it against a real course.

The last one is where the server helps most when you write code: the assistant can look at real answers while it builds against the API reference.

When something goes wrong

An error from the API comes back to the assistant as a tool error with the status, the error code and what to do: a missing or wrong key, an id that does not exist or has been withdrawn, or a quota that is used up. A replaced id is followed to its new id, and the answer says so. Missing values are null, never 0 and never estimated, the same as in the REST API.