@mako10k/mcp-search
v2.2.0
Published
A Model Context Protocol (MCP) server for Google Custom Search and Web Fetch with comprehensive caching capabilities. Supports both STDIO and HTTP transports.
Maintainers
Readme
MCP Search
A powerful Google Custom Search and Web Fetch MCP (Model Context Protocol) server that provides search functionality and web fetch capabilities using MCP.
Quick Start
STDIO Mode (Default - Recommended for MCP)
The easiest way to get started with MCP clients is using STDIO mode:
# Set up environment variables first
export GOOGLE_API_KEY="your_google_api_key"
export GOOGLE_CX="your_google_cx_id"
# Run the MCP server (STDIO mode is default)
npx @mako10k/mcp-searchHTTP Mode (Alternative)
For HTTP-based integration:
# Start in HTTP mode
npx @mako10k/mcp-search --http
# Or with custom port
npx @mako10k/mcp-search --http --port 8080MCP Client Configuration
For STDIO transport (recommended):
{
"command": "npx",
"args": ["@mako10k/mcp-search"],
"type": "stdio"
}For HTTP transport:
{
"url": "http://localhost:3000/mcp",
"type": "http"
}For command help:
npx @mako10k/mcp-search --helpCommand Options
The mcp-search package can be run directly using npx without installation:
npx @mako10k/mcp-search [options]Transport Options:
- Default: STDIO mode (recommended for MCP clients)
--http: Enable HTTP mode with /mcp endpoint
Configuration Options:
--port <number>: Specify the server port for HTTP mode (default: 3000)--help: Show help information--version: Show version information
Examples:
# STDIO mode (default)
npx @mako10k/mcp-search
# HTTP mode
npx @mako10k/mcp-search --http
# HTTP mode with custom port
npx @mako10k/mcp-search --http --port 8080
# One-liner with environment variables
GOOGLE_API_KEY="your_key" GOOGLE_CX="your_cx" npx @mako10k/mcp-searchNote: The server listens on a port only in HTTP mode. In STDIO mode (default), no port is used.
Features
Google Search Tools
- google-search: Execute Google Custom Search with caching
- list-search-cache: List cached search history with keyword filtering and pagination
- get-search-result: Retrieve individual search results by ID
Web Fetch Tools
- fetch: Fetch web content with automatic content processing, optional summarization, grep-like search, and caching
- list-fetch-cache: List cached fetch requests
- get-fetch-cache: Retrieve cached fetch data either as processed text view or raw byte chunks
MCP Configuration Examples
VS Code MCP Configuration
Add to your .vscode/mcp.json:
{
"servers": {
"mcp-search": {
"command": "npx",
"args": ["@mako10k/mcp-search"],
"type": "stdio",
"env": {
"GOOGLE_API_KEY": "your_google_api_key",
"GOOGLE_CX": "your_google_cx_id"
}
}
}
}Claude Desktop Configuration
Add to your Claude Desktop config:
{
"mcpServers": {
"mcp-search": {
"command": "npx",
"args": ["@mako10k/mcp-search"],
"env": {
"GOOGLE_API_KEY": "your_google_api_key",
"GOOGLE_CX": "your_google_cx_id"
}
}
}
}Cursor IDE Configuration
Add to your MCP configuration:
{
"servers": {
"search": {
"command": "npx",
"args": ["@mako10k/mcp-search"],
"type": "stdio"
}
}
}Installation & Setup
Option 1: Using npx (Recommended)
Set up environment variables:
export GOOGLE_API_KEY="your_google_api_key" export GOOGLE_CX="your_google_cx_id"Run the server:
# STDIO mode (default - recommended for MCP clients) npx @mako10k/mcp-search # OR HTTP mode (for custom integrations) npx @mako10k/mcp-search --http
Option 2: Local Development
Clone and install dependencies:
git clone https://github.com/mako10k/mcp-search cd mcp-search npm installSet up environment variables by copying the example file:
cp .env.example .envThen edit
.envwith your actual values:GOOGLE_API_KEY=your_actual_google_api_key GOOGLE_CX=your_actual_google_cx_id PORT=3000 MAX_FILE_SIZE=4194304 MAX_TOTAL_CACHE_SIZE=104857600Build and run:
npm run build npm start
Environment Variables
GOOGLE_API_KEY: Your Google Custom Search API key (required)- Get from: https://developers.google.com/custom-search/v1/introduction
GOOGLE_CX: Your Google Custom Search Engine ID (required)- Create and get from: https://cse.google.com/
PORT: Server port for HTTP mode only (default: 3000). Not used in STDIO mode.MAX_FILE_SIZE: Maximum size per fetch request in bytes (default: 4MB = 4194304 bytes)MAX_TOTAL_CACHE_SIZE: Maximum total cache size in bytes (default: 100MB = 104857600 bytes)
Note: These control internal cache limits, separate from model data window sizes.
Package Information
This package is published to npm as @mako10k/mcp-search.
Ways to use:
- Direct execution with npx:
npx @mako10k/mcp-search - Global installation:
npm install -g @mako10k/mcp-searchthen runmcp-search - Local dependency:
npm install @mako10k/mcp-search
The CLI binary name is mcp-search. The package includes TypeScript definitions and supports both CommonJS and ES modules.
Development
Use the following command for development:
npm run devAPI Specification
Google Search Tools
google-search
Execute a Google Custom Search query and cache the results.
Parameters:
query(string, required): Search querylanguage(string, optional): Language for search results (ISO 639-1)region(string, optional): Region for search results (ISO 3166-1 alpha-2)numResults(number, optional): Number of results (1-10, default: 10)startIndex(number, optional): Starting index for resultsimageSearch(boolean, optional): Enable image search modeimageSize,imageType,imageColor(string, optional): Image search filters
Response:
- Search summary with searchId, resultCount, timestamp, and result previews
- Full results cached for detailed retrieval
list-search-cache
List cached search queries with filtering and pagination.
Parameters:
keyword(string, optional): Filter searches by keyword (case-insensitive)page(number, optional): Page number (default: 1)limit(number, optional): Results per page (1-100, default: 10)
Response:
- Array of search metadata (searchId, query, timestamp, resultCount, expiresAt)
- Pagination information (totalCount, currentPage, totalPages, hasNextPage, hasPreviousPage)
get-search-result
Retrieve a specific search result by result ID.
Parameters:
resultId(string, required): Unique identifier for the search result
Response:
- Complete search result data including title, link, snippet, and raw data
Web Fetch Tools
fetch (Breaking changes in 2.1.0)
Fetch content with automatic processing and optional search/summary. By default, returns processed text (not raw HTML) based on Content-Type.
Parameters:
url(string, required): Target URL to fetchmethod(string, optional): HTTP method (default: GET)headers(object, optional): Custom HTTP headerstimeout(number, optional): Request timeout in milliseconds (min: 100, max: 600000, default: 30000)includeResponseHeaders(boolean, optional): Include response headers in output (default: false)outputSize(number, optional): Max bytes of processed text to return (replaces windowSize; max 32768; default 4096)process(boolean, optional): Auto process by Content-Type (HTML→text, JSON pretty, text passthrough; default: true)summarize(boolean, optional): Include short extractive summary (default: true)summaryMaxSentences(number, optional): Max sentences in summary (default: 3)summaryMaxChars(number, optional): Max characters in summary (default: 500)search(string, optional): Search pattern (string or regex ifsearchIsRegex=true)searchIsRegex(boolean, optional): Interpretsearchas regex (default: false)caseSensitive(boolean, optional): Case-sensitive search (default: false)context(number, optional): Lines of context around matches (-C; default: 2)before(number, optional): Lines before match (-B; overridescontext)after(number, optional): Lines after match (-A; overridescontext)maxMatches(number, optional): Max number of matches (default: 20)includeRawPreview(boolean, optional): Include raw data preview (default: false)rawPreviewSize(number, optional): Raw preview size in bytes (default: 1024)
Response:
requestId(string): Unique identifier for this fetch requeststatus(number): HTTP status codestatusText(string): HTTP status messagecontentType(string, optional): Response Content-TypecontentSize(number, optional): Total content size if knownactualSize(number): Actual size of fetched data (raw)processed(boolean): Whether processing was appliedtextSize(number, optional): Size of processed textdata(string): Processed text (up tooutputSize)summary(string, optional): Extractive summarymatches(array, optional): Grep-like matches with contextrawPreview(string, optional): Raw data preview when requestedisComplete(boolean): Whetherdatacontains the full processed textresponseHeaders(object, optional): Response headers if requestederror(string, optional): Error message for errors (network/timeout/HTTP>=400)errorCode(string, optional): Platform error code (e.g., ENOTFOUND, ECONNREFUSED, ETIMEDOUT)
Notes:
- On redirects where the final host differs from the requested host,
statusTextincludes(warning: host mismatch).
Caching Behavior:
- All responses are cached regardless of status code
- Cache includes full response data and metadata
- Cache entries have 1-hour expiry with LRU eviction
- Non-200 responses are cached with error information
list-fetch-cache
List cached fetch requests with their status and progress information.
Parameters:
requestId(string, optional): Filter by specific request IDpage(number, optional): Page number (default: 1)limit(number, optional): Results per page (1-100, default: 10)
Response:
- Array of fetch metadata:
requestId(string): Unique request identifierurl(string): Original request URLmethod(string): HTTP method usedstatus(string): Cache status ("Completed" or "InProgress")httpStatus(number): HTTP response status codeexpectedSize(number): Expected content size from headersfetchedSize(number): Actually fetched data sizetimestamp(string): Request timestampexpiresAt(string): Cache expiry timestamp
- Pagination information
get-fetch-cache (Updated in 2.1.0)
Retrieve cached fetch data in two modes: processed text view or raw byte chunks.
Parameters:
requestId(string, required): Request ID to retrievemode(string, optional):"text"(default) or"rawChunk"- For
mode="rawChunk":includeHeaders(boolean, optional): Include response headers (default: false)startPosition(number, optional): Starting byte position (default: 0)size(number, optional): Number of bytes to retrieve (max: 1MB, default: 4096)
- For
mode="text"(mirrors fetch processing options):outputSize,process,summarize,summaryMaxSentences,summaryMaxChars,search,searchIsRegex,caseSensitive,context,before,after,maxMatches
Response (mode=text): Same shape as fetch response (processed text, summary, matches, etc.)
Response (mode=rawChunk):
requestId,url,httpStatus,contentSize,startPosition,dataSize,data,hasMore,responseHeaders,metadata
Notes:
- Cache stores raw data; processed view is computed on retrieval.
Breaking changes:
fetch.datais now processed text by default (previously raw slice)windowSizeis replaced withoutputSize
