syn-search-mcp
🔍 syn-search-mcp
An MCP server that adds web search using Synthetic's Search API. Built for OpenCode, works with any MCP client.
Port of the pi-synthetic-search Pi extension to a standalone MCP server.
Features
synthetic_searchtool — automatically available to the LLM alongside built-in tools4-tier payload control to protect your context window:
Result count limit — caps at 5 results by default (configurable, max 10)
detail_levelparameter — LLM chooses its own tradeoff:summary— title + URL + date only (~50 tokens/result)snippet— + 300-char text excerpt (~100 tokens/result)ai-summary— full text sent to AI summarizer with optional focus prompt (~300-500 tokens total)full— complete untruncated text (LLM opts in for deep reads)
summary_promptparameter — when usingai-summary, the LLM can provide conversation context to focus the summarizer on what mattersOverall truncation — safety net at 2000 lines / 50KB; full output saved to a temp file the LLM can
read
AI Summarizer — uses Synthetic's chat completions API (
syn:small:text) to condense search results into focused, query-relevant summariesGraceful error handling — missing key, 401, 429, network failures
Abort-aware — respects client cancellation (e.g. Esc in OpenCode) during in-flight requests
Setup
1. Build
cd syn-search-mcp
npm install
npm run buildRequires Node.js 18+.
2. Get a Synthetic API key
Sign up at synthetic.new and grab your API key (starts with syn_).
3. Add to OpenCode
Global — ~/.config/opencode/opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"syn-search": {
"type": "local",
"command": ["node", "/path/to/syn-search-mcp/dist/index.js"],
"environment": {
"SYNTHETIC_API_KEY": "{env:SYNTHETIC_API_KEY}"
},
"enabled": true
}
}
}Project-local — same object under mcp in an opencode.json at the project root.
The key is read from SYNTHETIC_API_KEY (set in your shell or passed via the environment block). You can also hardcode it there instead of {env:...}.
4. Restart OpenCode
The tool is exposed as syn-search_synthetic_search. Ask it anything that needs search:
Search the web for the latest TypeScript 5.x featuresTool parameters
Parameter | Type | Default | Description |
| string | (required) | Search terms |
|
|
| Result detail level |
| string | (none) | Context/instructions for the AI summarizer (only used with |
| number |
| Max results to return (1–10) |
detail_level guide
Mode | Output size | Tokens (est.) | Use case |
| ~500B | ~150 | Quick scan — "does anything relevant exist?" |
| ~2KB | ~550 | Relevance check — "is this worth digging into?" |
| ~1-3KB | ~300-500 | Real questions — focused, context-aware extraction |
| Up to 300KB+ | ~66K+ | Deep dive — only when raw content is needed |
ai-summary example
{
"query": "Docker multi-stage builds",
"detail_level": "ai-summary",
"summary_prompt": "User is trying to reduce a Node.js Docker image from 1.2GB to under 200MB. Focus on layer caching, Alpine vs Debian, and COPY vs ADD patterns."
}The summarizer becomes a lightweight sub-agent — the main LLM delegates research focus via summary_prompt, and only relevant info returns to the context window.
Truncation
When output exceeds 2000 lines or 50KB, it's truncated with a notice; the full output is written to a temp file:
[Output truncated: showing 1210 of 8954 lines (48.8KB of 297.3KB).
7744 lines (248.5KB) omitted.
Full output saved to: /tmp/syn-search-mcp-XXXX/search-results.txt
— use the read tool to view it.]Environment variables
Variable | Default | Description |
| (required) | Synthetic API key ( |
|
| Chat model used for |
|
| Truncation line limit |
|
| Truncation byte limit |
| (unset) | Set to |
Error handling
Scenario | Behavior |
| isError result with setup instructions |
Invalid API key (401) | isError result with key-check guidance |
Rate limited (429) | isError result with retry advice |
Network failure | isError result with connection guidance |
Empty results | Informational message (not an error) |
Request cancelled (Esc) |
|
Summarizer returns empty content | isError result suggesting |
Errors return isError: true tool results so the LLM knows the search failed and can react accordingly.
Testing
# smoke test against the live API (uses SYNTHETIC_API_KEY from your env)
node scripts/smoke-test.mjs summary
node scripts/smoke-test.mjs ai-summary
# interactive MCP inspector
npx @modelcontextprotocol/inspector node dist/index.jsLicense
MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Camcdonou/syn-search-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server