Skip to main content
Glama

Google Ads MCP Server

by martechery
fields.ts1.16 kB
import { buildAdsHeaders } from '../headers.js'; import { getAccessToken } from '../auth.js'; import { normalizeApiVersion } from '../utils/normalizeApiVersion.js'; const API_VERSION = normalizeApiVersion(process.env.GOOGLE_ADS_API_VERSION); export type FieldSearchResponse = { ok: boolean; status: number; data?: any; errorText?: string; }; export async function searchGoogleAdsFields(query: string, sessionKey?: string): Promise<FieldSearchResponse> { const { token, quotaProjectId, developerToken: devFromToken } = await getAccessToken(sessionKey); const developerToken = devFromToken || process.env.GOOGLE_ADS_DEVELOPER_TOKEN || ''; const headers = buildAdsHeaders({ accessToken: token, developerToken, quotaProjectId }); const url = `https://googleads.googleapis.com/${API_VERSION}/googleAdsFields:search`; const init: RequestInit = { method: 'POST', headers, body: JSON.stringify({ query }) }; const res = await fetch(url, init); if (res.ok) { const data = await res.json(); return { ok: true, status: res.status, data }; } const errorText = await res.text(); return { ok: false, status: res.status, errorText }; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/martechery/mcp-google-ads-ts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server