@ideadesignmedia/search-mcp
v1.0.4
Published
Serper.dev MCP server with search/fetch tools
Downloads
8
Maintainers
Readme
Serper.dev MCP Server (search-mcp)
TypeScript MCP server exposing two tools backed by Serper.dev:
serper_search: Google Search via Serper.devserper_fetch: Fetch raw content for a result URL
The server is built with @ideadesignmedia/open-ai.js (MCP server/client helpers), uses @ideadesignmedia/request for HTTP, and loads configuration via @ideadesignmedia/config.js.
Requirements
- Node.js 18+ (recommended 20+)
- Yarn (or npm)
- Serper.dev API key
Install
yarn install
Configure
@ideadesignmedia/config.js loads config.json at the project root and maps entries to process.env.
- Copy the sample and fill in values:
- PowerShell:
Copy-Item config-sample.json config.json - Bash:
cp config-sample.json config.json
- Set required values in
config.json:
SERPER_DEV_API_KEY(required)SERPER_DEV_BASE_URL(defaulthttps://google.serper.dev)SERPER_DEV_TIMEOUT_MS(default10000)MCP_TRANSPORTSone or more ofstdio,http,websocket(defaultstdio)PORTHTTP/WS port (default 3000 if unset)
Run
- Dev (TypeScript):
yarn dev - Build:
yarn build - Start (compiled):
yarn start
Transports
- HTTP: set
MCP_TRANSPORTSto includehttp(and optionallywebsocket); server listens onhttp://localhost:PORT/mcp. - STDIO: use default
MCP_TRANSPORTS=stdiowhen launched by an MCP‑compatible client via stdio. Note: avoid printing to stdout when embedding in stdio clients.
Quickstart
PowerShell
Copy-Item config-sample.json config.json$env:SERPER_DEV_API_KEY = 'your-serper-key'$env:MCP_TRANSPORTS = 'http'(orstdio)$env:PORT = '4510'yarn dev(oryarn build && yarn start)
Bash
cp config-sample.json config.jsonexport SERPER_DEV_API_KEY='your-serper-key'export MCP_TRANSPORTS=http(orstdio)export PORT=4510yarn dev(oryarn build && yarn start)
When running with MCP_TRANSPORTS=http, you can connect an MCP client to http://localhost:$PORT/mcp.
NPX
- After publishing this package to npm (name
@ideadesignmedia/search-mcp), you can run:- HTTP:
npx @ideadesignmedia/search-mcp --http --port 4510 --key $SERPER_DEV_API_KEY - STDIO (process stdio):
npx @ideadesignmedia/search-mcp --stdio --key $SERPER_DEV_API_KEY - STDIO (file-backed):
npx @ideadesignmedia/search-mcp --stdio --stdio-files(creates./mcp-stdio.in/.out) - Optional logging: add
--log-file ./server.logand/or--verbose(stderr)
- HTTP:
Flags
--keysetsSERPER_DEV_API_KEY--basesetsSERPER_DEV_BASE_URL(defaulthttps://google.serper.dev)--timeoutsetsSERPER_DEV_TIMEOUT_MS--portsetsPORT--http/--websocket/--stdiochoose transports (or--transports=http,websocket)
Notes for STDIO:
- Logging goes to stderr by default; add
--verboseto see a one-line startup message (safe for stdio). - File-backed STDIO uses two files for JSON-RPC:
*.in(client→server) and*.out(server→client). Pass custom paths via--stdio-inand--stdio-out. - Avoid printing to stdout; use stderr or
--verbosefor a minimal status line. - To force skipping config.json: set
MCP_NO_CONFIG=1. - To write logs to a file:
--log-file ./server.log(safe in all transports)
Publish
- Ensure
distis built and included (already handled byfiles+prepublishOnly). npm publish --access public(scoped public package)
Tools
serper_search- params:
{ query: string; limit?: number; language?: string; country?: string; autocorrect?: boolean } - returns Serper organic results and related sections (JSON)
- params:
serper_fetch- params:
{ url: string } - returns
{ url, content }wherecontentis raw text/HTML
- params:
Testing
- Type checks:
yarn typecheck - Live integration test (HTTP transport):
- Ensure
SERPER_DEV_API_KEYis set inconfig.jsonor the environment - Run:
yarn test - The test starts the server on a test port, uses
McpClientto callserper_search("Idea Design Media") andserper_fetch(ideadesignmedia.com), and asserts non‑empty responses.
- Ensure
Project Layout
src/server.ts– boots the MCP serversrc/config/– runtime config (reads env viaconfig.json)src/services/serperClient.ts– Serper client using@ideadesignmedia/requestsrc/tools/– MCP tools (serper_search,serper_fetch)tests/serper.mcp.integration.test.ts– live MCP client integration test
