Google Search MCP Server
Google 검색 MCP 서버
Google의 맞춤 검색 API를 통해 웹 및 이미지 검색 기능을 제공하는 모델 컨텍스트 프로토콜(MCP) 서버입니다. 이 서버는 Claude 및 기타 AI 비서와 통합하기 위해 MCP 사양을 따릅니다.
우리가 무엇을 만들고 있는가
많은 AI 비서가 최신 정보를 제공하거나 웹을 검색할 수 있는 기능을 갖추고 있지 않습니다. 이 MCP 서버는 두 가지 도구를 제공하여 이 문제를 해결합니다.
google_web_search: 웹에서 최신 정보를 검색합니다.google_image_search: 검색어와 관련된 이미지 찾기
MCP 호환 클라이언트(예: Claude in Cursor, VSCode 또는 Claude Desktop)에 연결되면 AI 비서가 검색을 수행하고 최신 정보에 액세스할 수 있습니다.
Related MCP server: Google Search MCP Server
핵심 MCP 개념
MCP 서버는 AI 어시스턴트에 기능을 제공합니다. 이 서버는 다음을 구현합니다.
도구 : AI가 호출할 수 있는 기능(사용자 승인 필요)
구조화된 커뮤니케이션 : MCP 프로토콜을 통한 표준화된 메시징 형식
전송 계층 : 표준 입출력을 통한 통신
필수 조건
Node.js(v18 이상) 및 npm
Google Cloud Platform 계정
Google 맞춤 검색 API 키 및 검색 엔진 ID
MCP 호환 클라이언트(데스크톱용 Claude, Cursor, Claude가 포함된 VSCode 등)
빠른 시작(이 저장소 복제)
서버를 처음부터 구축하지 않고 사용하려면 다음 단계를 따르세요.
지엑스피1
빌드 후 MCP 클라이언트에 연결 섹션에 따라 서버를 원하는 클라이언트에 연결하세요.
환경 설정(처음부터 구축)
서버를 처음부터 직접 구축하고 싶다면 다음 지침을 따르세요.
프로젝트 구조 생성
맥OS/리눅스
# Create a new directory for our project
mkdir google-search-mcp
cd google-search-mcp
# Initialize a new npm project
npm init -y
# Install dependencies
npm install @modelcontextprotocol/sdk dotenv zod
npm install -D @types/node typescript
# Create our files
mkdir src
touch src/index.ts윈도우
# Create a new directory for our project
md google-search-mcp
cd google-search-mcp
# Initialize a new npm project
npm init -y
# Install dependencies
npm install @modelcontextprotocol/sdk dotenv zod
npm install -D @types/node typescript
# Create our files
md src
new-item src\index.tsTypeScript 구성
루트 디렉토리에 tsconfig.json 만듭니다.
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}package.json 업데이트
package.json 에 다음이 포함되어 있는지 확인하세요.
{
"name": "google_search_mcp",
"version": "0.1.0",
"description": "MCP server for Google Custom Search API integration",
"license": "MIT",
"type": "module",
"bin": {
"google_search": "./dist/index.js"
},
"files": [
"dist"
],
"scripts": {
"build": "tsc",
"build:unix": "tsc && chmod 755 dist/index.js",
"prepare": "npm run build",
"watch": "tsc --watch",
"start": "node dist/index.js"
}
}Google API 설정
Google Cloud Platform을 설정하고 API 자격 증명을 받아야 합니다.
Google Cloud Platform 설정
Google Cloud Console 로 이동
새 프로젝트를 만듭니다
사용자 정의 검색 API 활성화:
Navigate to "APIs & Services" → "Library" Search for "Custom Search API" Click on "Custom Search API" → "Enable"API 자격 증명을 만듭니다.
Navigate to "APIs & Services" → "Credentials" Click "Create Credentials" → "API key" Copy your API key
사용자 정의 검색 엔진 설정
프로그래밍 가능한 검색 엔진 으로 이동
새로운 검색 엔진을 만들려면 "추가"를 클릭하세요.
"전체 웹 검색"을 선택하고 검색 엔진의 이름을 지정하세요.
제어판에서 검색 엔진 ID(cx 값)를 가져옵니다.
환경 구성
루트 디렉토리에 .env 파일을 만듭니다.
GOOGLE_API_KEY=your_api_key_here
GOOGLE_CSE_ID=your_search_engine_id_here자격 증명을 보호하려면 .gitignore 파일에 .env 추가하세요.
echo ".env" >> .gitignore서버 구축
서버 구현 만들기
src/index.ts 에 서버 구현을 만듭니다.
import dotenv from "dotenv"
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
CallToolRequestSchema,
ListToolsRequestSchema,
Tool,
} from "@modelcontextprotocol/sdk/types.js";
dotenv.config();
// Define your tools
const WEB_SEARCH_TOOL: Tool = {
name: "google_web_search",
description: "Performs a web search using Google's Custom Search API...",
inputSchema: {
// Schema details here
},
};
const IMAGE_SEARCH_TOOL: Tool = {
name: "google_image_search",
description: "Searches for images using Google's Custom Search API...",
inputSchema: {
// Schema details here
}
};
// Server implementation
const server = new Server(
{
name: "google-search",
version: "0.1.0",
},
{
capabilities: {
tools: {},
},
},
);
// Check for API key and Search Engine ID
const GOOGLE_API_KEY = process.env.GOOGLE_API_KEY!;
const GOOGLE_CSE_ID = process.env.GOOGLE_CSE_ID!;
if (!GOOGLE_API_KEY || !GOOGLE_CSE_ID) {
console.error("Error: Missing environment variables");
process.exit(1);
}
// Tool handlers
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [WEB_SEARCH_TOOL, IMAGE_SEARCH_TOOL],
}));
server.setRequestHandler(CallToolRequestSchema, async (request) => {
// Implement tool handlers
});
// Run the server
async function runServer() {
const transport = new StdioServerTransport();
await server.connect(transport);
console.error("Google Search MCP Server running on stdio");
}
runServer().catch((error) => {
console.error("Fatal error running server:", error);
process.exit(1);
});전체 구현 세부 사항은 저장소 파일을 참조하세요.
서버 구축
구현을 완료한 후 서버를 빌드합니다.
npm run build이렇게 하면 TypeScript 코드가 dist 디렉토리의 JavaScript로 컴파일됩니다.
MCP 클라이언트에 연결
MCP 서버는 다양한 클라이언트에 연결할 수 있습니다. 자주 사용되는 클라이언트에 대한 설정 지침은 다음과 같습니다.
데스크톱용 클로드
맥OS/리눅스
구성 파일을 엽니다.
code ~/Library/Application\ Support/Claude/claude_desktop_config.json서버 구성을 추가합니다.
{
"mcpServers": {
"google_search": {
"command": "node",
"args": [
"/absolute/path/to/google-search-mcp/dist/index.js"
],
"env": {
"GOOGLE_API_KEY": "your_api_key_here",
"GOOGLE_CSE_ID": "your_search_engine_id_here"
}
}
}
}윈도우
구성 파일을 엽니다.
code $env:AppData\Claude\claude_desktop_config.json서버 구성을 추가합니다.
{
"mcpServers": {
"google_search": {
"command": "node",
"args": [
"C:\\absolute\\path\\to\\google-search-mcp\\dist\\index.js"
],
"env": {
"GOOGLE_API_KEY": "your_api_key_here",
"GOOGLE_CSE_ID": "your_search_engine_id_here"
}
}
}
}데스크톱용 Claude를 다시 시작하세요
인터페이스에서 도구 아이콘을 클릭하여 도구가 나타나는지 확인하세요.
클로드와 함께하는 VSCode
macOS/Linux 및 Windows
작업 공간에서
.vscode/settings.json만들거나 편집하세요.
macOS/Linux의 경우:
{
"mcp.servers": {
"google_search": {
"command": "node",
"args": [
"/absolute/path/to/google-search-mcp/dist/index.js"
],
"env": {
"GOOGLE_API_KEY": "your_api_key_here",
"GOOGLE_CSE_ID": "your_search_engine_id_here"
}
}
}
}Windows의 경우:
{
"mcp.servers": {
"google_search": {
"command": "node",
"args": [
"C:\\absolute\\path\\to\\google-search-mcp\\dist\\index.js"
],
"env": {
"GOOGLE_API_KEY": "your_api_key_here",
"GOOGLE_CSE_ID": "your_search_engine_id_here"
}
}
}
}VSCode를 다시 시작하세요
이 도구는 VSCode에서 Claude에게 제공됩니다.
커서
커서 설정 열기(기어 아이콘)
"MCP"를 검색하고 MCP 설정을 엽니다.
"새 MCP 서버 추가"를 클릭하세요.
위와 유사한 설정으로 구성하세요.
macOS/Linux의 경우:
{
"mcpServers": {
"google_search": {
"command": "node",
"args": [
"/absolute/path/to/google-search-mcp/dist/index.js"
],
"env": {
"GOOGLE_API_KEY": "your_api_key_here",
"GOOGLE_CSE_ID": "your_search_engine_id_here"
}
}
}
}Windows의 경우:
{
"mcpServers": {
"google_search": {
"command": "node",
"args": [
"C:\\absolute\\path\\to\\google-search-mcp\\dist\\index.js"
],
"env": {
"GOOGLE_API_KEY": "your_api_key_here",
"GOOGLE_CSE_ID": "your_search_engine_id_here"
}
}
}
}커서 재시작
서버 테스트
Claude와 함께 사용
연결되면 Claude에게 다음과 같은 질문을 하여 도구를 테스트할 수 있습니다.
"재생에너지에 대한 최신 뉴스를 검색하세요"
"전기 자동차 이미지 찾기"
"일본의 인기 관광지는 어디인가요?"
클로드는 필요할 때 자동으로 적절한 검색 도구를 사용합니다.
수동 테스트
서버를 직접 테스트할 수도 있습니다.
# Test web search
echo '{
"jsonrpc": "2.0",
"method": "callTool",
"params": {
"name": "google_web_search",
"arguments": {
"query": "test query",
"count": 2
}
},
"id": 1
}' | node dist/index.js후드 아래에서 무슨 일이 일어나고 있나요?
질문을 할 때:
클라이언트가 귀하의 질문을 Claude에게 보냅니다.
Claude는 사용 가능한 도구를 분석하고 어떤 도구를 사용할지 결정합니다.
클라이언트는 MCP 서버를 통해 선택한 도구를 실행합니다.
결과는 Claude에게 다시 전송됩니다.
Claude는 검색 결과를 기반으로 자연어 응답을 공식화합니다.
응답이 표시됩니다
문제 해결
일반적인 문제
환경 변수
Error: GOOGLE_API_KEY environment variable is required .
# Check your .env file
cat .env
# Try setting environment variables directly:
export GOOGLE_API_KEY=your_key_here
export GOOGLE_CSE_ID=your_id_hereAPI 오류
API 오류가 발생하는 경우:
# Test your API credentials directly
curl "https://www.googleapis.com/customsearch/v1?key=YOUR_API_KEY&cx=YOUR_CX_ID&q=test"연결 문제
클라이언트가 서버에 연결할 수 없는 경우:
# Verify the server runs correctly on its own
node dist/index.js
# Check file permissions
chmod 755 dist/index.js
# Ensure you're using absolute paths in your configurationAPI 참조
google_web_search
Google의 맞춤 검색 API를 사용하여 웹 검색을 수행합니다.
매개변수:
query(문자열, 필수): 검색 쿼리count(숫자, 선택 사항): 결과 수(1-10, 기본값 5)start(숫자, 선택 사항): 페이지 시작 인덱스(기본값 1)site(문자열, 선택 사항): 검색을 특정 사이트로 제한합니다(예: 'example.com')
google_image_search
Google의 맞춤 검색 API를 사용하여 이미지를 검색합니다.
매개변수:
query(문자열, 필수): 이미지 검색 쿼리count(숫자, 선택 사항): 결과 수(1-10, 기본값 5)start(숫자, 선택 사항): 페이지 시작 인덱스(기본값 1)
제한 사항
Google 맞춤 검색 API 무료 계층: 하루 100개 쿼리
서버에서 적용하는 속도 제한: 초당 5개 요청
쿼리당 최대 10개 결과(Google API 제한)
특허
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.
Available Tools
2 toolsgoogle_image_searchB
Searches for images using Google's Custom Search API. Best for finding images related to specific terms, concepts, or objects. Returns image URLs, titles, and thumbnails. Use this when needing to find relevant images or visual references.
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of results (1-10, default 5) | |
| query | Yes | Image search query | |
| start | No | Pagination start index (default 1) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the API source and return values (image URLs, titles, thumbnails) but lacks details on rate limits, authentication needs, error handling, or whether this is a read-only operation. For a search tool with external API dependencies, this leaves significant behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded: it starts with the core purpose, adds context about best use cases, specifies return values, and ends with usage guidance. Every sentence adds value without redundancy, making it efficient and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (external API search with 3 parameters) and no annotations or output schema, the description is partially complete. It covers purpose, usage, and returns but lacks behavioral details like rate limits or error handling. It's adequate for basic use but insufficient for robust agent operation without additional context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the schema already documents all three parameters (count, query, start) with their types, defaults, and constraints. The description adds no additional parameter semantics beyond what's in the schema, meeting the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Searches for images using Google's Custom Search API' with specific resources (image URLs, titles, thumbnails) and distinguishes it from the sibling google_web_search by focusing on images rather than general web content. However, it doesn't explicitly name the sibling for comparison.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides implied usage guidance: 'Best for finding images related to specific terms, concepts, or objects' and 'Use this when needing to find relevant images or visual references.' It suggests when to use it but doesn't explicitly mention when not to use it or directly compare it to the sibling google_web_search.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
google_web_searchA
Performs a web search using the Google Custom Search API, ideal for general queries, news, articles, and online content. Use this for broad information gathering, recent events, or when you need diverse web sources. Supports pagination and filtering by site or type. Maximum 10 results per request, with start index for pagination.
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of results (1-10, default 5) | |
| query | Yes | Search query | |
| site | No | Optional: Limit search to specific site (e.g., 'site:example.com') | |
| start | No | Pagination start index (default 1) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions key behavioral traits: 'maximum 10 results per request', 'supports pagination and filtering by site or type', and 'start index for pagination'. However, it doesn't cover important aspects like rate limits, authentication requirements, error conditions, or what the response format looks like.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is efficiently structured in three sentences that each serve distinct purposes: stating the core functionality, providing usage guidance, and disclosing behavioral constraints. Every sentence earns its place with no redundant information, making it appropriately sized and front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a search tool with 4 parameters, 100% schema coverage, but no annotations and no output schema, the description provides adequate context about what the tool does and when to use it. However, it lacks information about the response format, error handling, and operational constraints like rate limits, which would be important for an API-based search tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 100% schema description coverage, the input schema already documents all 4 parameters thoroughly. The description adds minimal value beyond what's in the schema - it mentions 'filtering by site or type' and 'pagination' which map to the 'site' and 'start' parameters, but doesn't provide additional semantic context beyond what the schema descriptions already offer.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool 'performs a web search using the Google Custom Search API' with specific examples of use cases (general queries, news, articles, online content). It distinguishes from the sibling tool 'google_image_search' by specifying this is for web content rather than images. However, it doesn't explicitly contrast with the sibling beyond the domain difference.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use this tool ('broad information gathering, recent events, or when you need diverse web sources'), which implicitly distinguishes it from the image search sibling. It doesn't explicitly state when NOT to use it or name alternatives beyond the implied contrast with image search.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.0.0- First observed
google_image_search - First observed
google_web_search
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: google_image_search is for finding images, while google_web_search is for general web content like articles and news. There is no overlap in functionality, making it easy for an agent to choose the correct tool based on the need for visual vs. textual information.
Both tools follow a consistent verb_noun pattern with 'google_' prefix and descriptive suffixes (_image_search, _web_search). The naming is uniform and predictable, adhering to snake_case throughout without any deviations or mixed conventions.
With only 2 tools, the server is minimal but reasonable for a search-focused domain, covering image and web searches. It might feel slightly thin if broader search capabilities (e.g., video, news-specific) were expected, but it's well-scoped for basic search needs without being overloaded.
For a Google Search server, the tools cover the core search operations: image and web searches. Minor gaps exist, such as lack of specialized search types (e.g., video, scholarly articles) or advanced filtering options, but agents can work around this with the provided tools for most common queries.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for Google search results via SERP API
Live AI-native web search with citations. One tool for every MCP client. Flat per-request pricing.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables LLMs to perform web searches using Google's Custom Search API through a standardized interface.147MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables Claude to perform Google Custom Search operations by connecting to Google's search API.2MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables Claude to perform web research by integrating Google search, extracting webpage content, and capturing screenshots.31,20220MIT
- AlicenseAqualityCmaintenanceA Model Context Protocol server that enables Claude to perform web research by integrating Google search, extracting webpage content, and capturing screenshots in real-time.41,2029MIT