pi-web-search
Provides web search using DuckDuckGo as a fallback search engine, returning up to 8 results with titles, URLs, and snippets.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pi-web-searchsearch for the latest stable Node.js version"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pi-web-search
A web_search tool for the pi coding agent that uses your z.ai GLM Coding Plan's native web search via the web_search_prime MCP endpoint — included in the plan, no extra cost, no separate API key — with a free DuckDuckGo fallback.
Zero dependencies. Zero configuration. ~350 lines of TypeScript.
Goal
One thing, done well: lean native web search through the z.ai Coding Plan, falling back to DuckDuckGo otherwise.
It's search-only by design — there are already good web_fetch extensions out there, so this one doesn't ship a fetcher, and never will. Pair it with whichever you use and you get a full research pipeline: discover → read.
z.ai is the only native provider for now, simply because that's what I use. Other providers may be added down the line, but that's the most this extension will ever grow into.
Related MCP server: DDG Web Search
How it works
web_search(query)
│
├─ key: ZAI_API_KEY env → ~/.pi/agent/auth.json (zai)
▼
┌─────────────────────┐ fail / empty ┌──────────────────────┐
│ ZAI MCP │ ─────────────────► │ DuckDuckGo HTML │
│ web_search_prime │ │ regex scrape │
│ (raw results) │ │ (8 results) │
└─────────────────────┘ └──────────────────────┘
trim to 8 → numbered list (title / URL / snippet)
output annotated with which engine answeredZAI MCP protocol (https://api.z.ai/api/mcp/web_search_prime/mcp):
POSTJSON-RPCinitialize→ captureMcp-Session-Idresponse headerPOSTtools/callwithweb_search_prime+{ search_query }(session header)Parse the SSE
data:line → the text payload is a double-JSON-encoded array of{ title, link, content, refer }
If native search fails or returns nothing, DuckDuckGo takes over automatically, with a visible > zai-mcp unavailable (...) note in the output so you always know which engine answered.
Install
Clone into pi's extensions directory:
git clone <this-repo> ~/.pi/agent/extensions/web-searchRestart pi (or run /reload). The web_search tool appears alongside the built-ins.
Or load it explicitly for a one-off:
pi -e /path/to/pi-web-search/index.tsUsage
The model calls it on its own when it needs current information:
{ "query": "latest stable node version" }Returns:
1. **Node.js 24.x is now LTS ...**
https://nodejs.org/en/blog/announcements/v24-release
Node.js 24 enters long-term support ...
2. **...**Configuration
None required. Optional overrides:
Default | Notes | |
|
| Env var wins if set |
Result count | 8 ( | Client-side trim; edit constant |
Timeouts | MCP 25s / DDG 15s | Edit constants |
Notes
The
Mcp-Session-Idheader from theinitializeresponse is required ontools/callThe MCP text payload is double-JSON-encoded and needs two rounds of
JSON.parseDuckDuckGo's HTML endpoint may bot-wall curl; testing with Node fetch (real browser
User-Agent) matches what the extension actually doesA fresh MCP session is created per search — fine at typical agent search volume
Future work
Additional native provider backends (search only — a fetcher will never be part of this)
Forward optional
count/ domain filters to the MCP endpoint once its input schema is mappedallowed_domains/blocked_domainstool parametersFallback ladder (DDG POST variant →
lite.duckduckgo.com→ Mojeek) if DDG tightens bot detection
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
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
Enable AI assistants to perform web searches using Perplexity's Sonar Pro.
The best web search for your AI Agent
Agent-native search engine with live web research optimized for AI agents.
Search the agentic web. 4,100+ sites, 11 tools incl. check_url + verify_mcp for probe-before-use.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables web search capabilities using DuckDuckGo's free API without requiring authentication or API keys.-
- AlicenseNot gradedqualityDmaintenanceEnables web search via DuckDuckGo and web content fetching through the Model Context Protocol, allowing AI assistants to search and retrieve web page content.23MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to search the web via DuckDuckGo and fetch relevant webpage content using an LLM, without requiring an API key.-
- FlicenseNot gradedqualityDmaintenanceEnables web search for large language models using Zhipu AI's Web Search API, supporting multiple search engines and advanced filtering options.-
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/weibolu-rm/pi-web-search'
If you have feedback or need assistance with the MCP directory API, please join our Discord server