MCP Server Setup
The Model Context Protocol (MCP) allows LLMs and AI agents to connect directly to external data sources. By connecting to our MCP server, your AI tools gain access to comprehensive horse racing data including racecards, results, form analysis, jockey and trainer statistics, and more.
Once connected, your AI tools can seamlessly interact with the API to provide horse racing information and insights, as well as gaining an improved understanding of coding and development with the API.
https://mcp.theracingapi.com
Authentication
You'll need your Racing API credentials to connect. You can find your username and password in the dashboard under My Account after subscribing to a plan.
Apps and editors (claude.ai, chatgpt.com, grok.com, gemini.google.com, Cursor, VS Code and more) use OAuth — you'll be redirected to a login page to enter your credentials. APIs and CLIs can instead send your credentials as HTTP headers in your configuration.
OAuth sessions expire after 30 days of inactivity. If no requests are made to the MCP server within that period, you'll need to reconnect and log in again.
Select your AI platform for setup instructions:
Web & Desktop App
Requires Free, Pro, Max, Team, or Enterprise plan — Free is limited to one custom connectorThese steps work for both claude.ai and the Claude Desktop app.
- Open Customize from the main menu in Claude
- Select the Connectors tab
- Click the + button, then Add custom connector
- Enter the connector name: The Racing API
- Enter the MCP server URL:
https://mcp.theracingapi.com - Click Add then click Connect once The Racing API appears in the Connectors list — you will be redirected to a login page where you can enter your Racing API username and password
- Once authenticated, The Racing API tools will be available in your conversations
Team & Enterprise plans: an organisation Owner may need to add the connector first under Organization settings > Connectors > Add > Custom > Web before members can connect to it from Customize > Connectors.
Recommended model: Opus 5.5 with medium or high effort offers the best balance of speed and intelligence for racing data queries.
Claude Code (CLI)
Run the following command in your terminal, replacing the placeholder values with your API credentials:
claude mcp add --transport http \ the-racing-api \ https://mcp.theracingapi.com/ \ --header "X-RacingAPI-Username: YOUR_USERNAME" \ --header "X-RacingAPI-Password: YOUR_PASSWORD"
Prefer a browser login? Leave out the two --header lines, then run /mcp inside Claude Code (or claude mcp login the-racing-api) and sign in with your Racing API username and password.
API (Messages API)
Requires anthropic-beta: mcp-client-2025-11-20 headerConnect to the MCP server programmatically using the Messages API, replacing the placeholder values with your API credentials:
{
"model": "claude-opus-5-5",
"max_tokens": 16000,
"messages": [
{
"role": "user",
"content": "What are today's racecards?"
}
],
"mcp_servers": [
{
"type": "url",
"url": "https://mcp.theracingapi.com/",
"name": "the-racing-api",
"authorization_token": "YOUR_OAUTH_ACCESS_TOKEN"
}
],
"tools": [
{
"type": "mcp_toolset",
"mcp_server_name": "the-racing-api"
}
]
}
Authentication: The Messages API uses OAuth. Obtain an access token by running npx @modelcontextprotocol/inspector, connecting to https://mcp.theracingapi.com/, and completing the OAuth flow. Pass the resulting token as authorization_token. The API does not handle token refresh automatically — you are responsible for tracking expiry and using your refresh token to obtain a new access token when it expires.
References: Custom connectors using remote MCP • MCP — Claude Code • MCP Connector — Claude API
Web Interface (chatgpt.com)
Requires a paid plan (Plus, Pro, Business, Enterprise, or Edu)- Go to Settings > Security and login and enable Developer mode
- Open the Plugins page and click the + button
- Enter the name as 'The Racing API'
- Under Connection, enter the MCP Server URL:
https://mcp.theracingapi.com - Ensure Authentication is set to OAuth
- Create the connection — you will be redirected to a login page — enter your Racing API username and password to authorize the connection
- Once authenticated, The Racing API tools will be available in your conversations
Business, Enterprise & Edu plans: a workspace admin may need to allow developer mode under Workspace Settings > Permissions & Roles.
API (Responses API)
Connect to the MCP server programmatically using the Responses API, replacing the placeholder values with your API credentials:
{
"model": "gpt-6-astra",
"tools": [
{
"type": "mcp",
"server_label": "the-racing-api",
"server_url": "https://mcp.theracingapi.com/",
"headers": {
"X-RacingAPI-Username": "YOUR_USERNAME",
"X-RacingAPI-Password": "YOUR_PASSWORD"
},
"require_approval": "never"
}
],
"input": "What are today's racecards?"
}
Codex (CLI)
Add the following to your Codex configuration file, replacing the placeholder values with your API credentials:
[mcp_servers.the-racing-api] url = "https://mcp.theracingapi.com/" [mcp_servers.the-racing-api.http_headers] X-RacingAPI-Username = "YOUR_USERNAME" X-RacingAPI-Password = "YOUR_PASSWORD"
Prefer a browser login? Run codex mcp add the-racing-api --url https://mcp.theracingapi.com/, then codex mcp login the-racing-api and sign in with your Racing API username and password.
References: Developer mode — ChatGPT • MCP and Connectors — OpenAI API • MCP — Codex
Web Interface (gemini.google.com)
Personal Google accounts, 18+, in the US — English only- Make sure Keep Activity is turned on for your Google Account
- In the Gemini web app, go to Settings > Connected Apps
- Under Custom apps, click Add a custom app and enter the MCP server URL:
https://mcp.theracingapi.com - Click Next and complete the OAuth flow — you will be redirected to a login page where you can enter your Racing API username and password
- Once connected, The Racing API tools will be available in Gemini chat and Gemini Spark, on the web and in the Gemini mobile app
Gemini CLI
Run the following command in your terminal, replacing the placeholder values with your API credentials:
gemini mcp add --transport http \ the-racing-api \ https://mcp.theracingapi.com/ \ --header "X-RacingAPI-Username: YOUR_USERNAME" \ --header "X-RacingAPI-Password: YOUR_PASSWORD"
Alternatively, add the following to your Gemini CLI settings file:
{
"mcpServers": {
"the-racing-api": {
"httpUrl": "https://mcp.theracingapi.com/",
"headers": {
"X-RacingAPI-Username": "YOUR_USERNAME",
"X-RacingAPI-Password": "YOUR_PASSWORD"
}
}
}
}
References: Connect & manage custom apps for Gemini Apps • MCP servers with the Gemini CLI
Web Interface (grok.com)
- Go to grok.com/connectors
- Click New Connector, then select Custom
- Enter the MCP server URL:
https://mcp.theracingapi.com - Complete the authentication flow — you will be redirected to a login page where you can enter your Racing API username and password
- Once connected, The Racing API tools will be available in your conversations
Business & Enterprise plans: a team admin may need to provision the connector via console.x.ai > Grok Business > Connectors.
xAI API
Connect to the MCP server via the xAI API, replacing the placeholder values with your API credentials:
{
"model": "grok-4.7",
"tools": [
{
"type": "mcp",
"server_label": "the-racing-api",
"server_url": "https://mcp.theracingapi.com/",
"headers": {
"X-RacingAPI-Username": "YOUR_USERNAME",
"X-RacingAPI-Password": "YOUR_PASSWORD"
}
}
],
"input": [
{
"role": "user",
"content": "What are today's racecards?"
}
]
}
References: Connectors — Grok • Remote MCP Tools — xAI API
Lovable App
- Open Connectors in the Lovable dashboard
- Click the + button (top right) and select MCP server
- Enter the server name: The Racing API
- Leave the connection type as Direct connection
- Enter the server URL:
https://mcp.theracingapi.com - Ensure the authentication method is set to OAuth
- Click Add & authorize — you will be redirected to a login page where you can enter your Racing API username and password
- Once authorized, The Racing API tools will be available as contextual data for the Lovable Agent
Note: MCP connectors act as chat connectors — they provide contextual data while building, but cannot be used inside your published app. To use racing data in a published app, call the REST API directly.
Reference: Connect a custom MCP server — Lovable Docs
Web Interface (perplexity.ai)
Requires Pro, Max, or Enterprise plan- Go to Settings > Connectors
- Add a custom remote connector
- Enter the connector name: The Racing API
- Enter the MCP server URL:
https://mcp.theracingapi.com - Select the Streamable HTTP transport and set authentication to OAuth 2.0
- Save the connector — you will be redirected to a login page where you can enter your Racing API username and password
- Once authenticated, The Racing API tools will be available in your conversations
Reference: Adding custom remote connectors — Perplexity Help Center
Cursor
Add the following to your Cursor MCP configuration file. Use ~/.cursor/mcp.json to make the server available in all projects, or .cursor/mcp.json inside a project for that project only. No credentials go in the file — Cursor will open a browser login the first time it connects:
{
"mcpServers": {
"the-racing-api": {
"url": "https://mcp.theracingapi.com/"
}
}
}
- Save the file, then open Customize in the Cursor sidebar (older versions: Settings > Tools & MCP) and make sure The Racing API is toggled on
- When Cursor prompts you to log in, open the login page in your browser and sign in with your Racing API username and password
- Return to Cursor — once the server shows as connected, The Racing API tools will be available to the agent
Signing in: the login uses your Racing API username and password (the same HTTP Basic auth credentials as the REST API — there are no separate API keys). If you change plan or add a regional add-on, it is picked up on your next fresh sign-in.
If you need to sign in again: remove The Racing API server and add it again (from Customize, or by editing mcp.json), then reconnect to trigger a new browser login.
Reference: MCP — Cursor Docs
VS Code (GitHub Copilot)
Requires GitHub Copilot (free tier available)- Open the Command Palette (
Cmd/Ctrl+Shift+P) and run MCP: Add Server - Choose HTTP as the server type
- Enter the server URL:
https://mcp.theracingapi.com/ - Give the server a name (for example the-racing-api) and choose whether to save it to the workspace or your user settings
- When VS Code prompts you to allow authentication, accept — a browser login page will open where you can sign in with your Racing API username and password
- Once authenticated, The Racing API tools will be available in Copilot agent mode — select the Configure Tools button in the chat input to see them
Alternatively, add the following to your MCP configuration file. No credentials go in the file — VS Code will run the browser login the first time it connects:
{
"servers": {
"the-racing-api": {
"type": "http",
"url": "https://mcp.theracingapi.com/"
}
}
}
Signing in: the login uses your Racing API username and password (the same HTTP Basic auth credentials as the REST API — there are no separate API keys). If you change plan or add a regional add-on, it is picked up on your next fresh sign-in.
If you need to sign in again: open the Command Palette, run Authentication: Remove Dynamic Authentication Providers and remove the entry for mcp.theracingapi.com, then restart the server from MCP: List Servers to trigger a new browser login.
Reference: MCP servers — VS Code Docs