openai_websearch
Provides web search and image search capabilities by leveraging OpenAI's native server-side web search via the Codex/ChatGPT Responses API.
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., "@openai_websearchWhat are the latest breakthroughs in AI?"
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.
openai_websearch
Self-hostable MCP server (official @modelcontextprotocol/sdk) and reusable API client that exposes OpenAI's native server-side web search via the ChatGPT/Codex Responses API.
No API keys required. Authenticate with your ChatGPT account in 3 ways:
Browser OAuth — gets a URL, you click Connect (works on any device)
Device-code flow — URL + code for headless/remote machines (no browser needed)
Existing Codex auth — auto-falls back to
~/.codex/auth.json
Tokens auto-refresh — no manual re-login every few weeks.
Features
Capability | Description |
| Full-text web search with real URLs and citations |
| Image search returning web image URLs and source pages |
Built-in OAuth login |
|
Auto-refreshing tokens |
|
Official MCP SDK |
|
Reusable library | Import in any Node/Bun/Deno project |
Zero API keys | Uses your ChatGPT subscription |
Related MCP server: websearch-mcp
As an MCP server
Install & authenticate
git clone https://github.com/hffmnnj/openai_websearch.git
cd openai_websearch
npm install
# Authenticate (browser flow — prints a URL)
node index.js login
# Or headless (prints URL + code, enter on any device)
node index.js login --device-code
# Check auth status
node index.js auth-statusConfigure your MCP client
{
"mcpServers": {
"openai_websearch": {
"command": "node",
"args": ["/path/to/openai_websearch/index.js"]
}
}
}Tools
Tool | Args | Description |
|
| Text web search with real URLs |
|
| Image search returning URLs + source pages |
As a library (NPM package)
Install
npm install github:hffmnnj/openai_websearchQuick start
import { search, imageSearch } from 'openai_websearch';
// Web search
const results = await search('smart ring market size 2026');
console.log(results.text);
console.log(results.searchQueries); // queries OpenAI actually ran
console.log(results.usage); // token counts
// Image search
const images = await imageSearch('oura ring product photos');
console.log(images.text); // URLs and descriptionsExplicit auth (no Codex, no login prompt — pass tokens directly)
import { createClient } from 'openai_websearch';
const client = createClient({
accessToken: 'eyJhbG...', // JWT from your own OAuth flow
refreshToken: 'rt.1.AAB...', // auto-refreshes when expired
accountId: 'uuid-here',
});
const result = await client.search('test query');Full OAuth in your own code
import { authenticateBrowser, authenticateDeviceCode, createClient } from 'openai_websearch';
// Browser flow
const { tokens, authorizeUrl } = await authenticateBrowser();
// → user opens authorizeUrl, clicks Connect
// Device-code flow (headless)
const { tokens, verificationUrl, userCode } = await authenticateDeviceCode();
// → user visits verificationUrl, enters userCode
// Then use the tokens
const client = createClient({
accessToken: tokens.access_token,
refreshToken: tokens.refresh_token,
});API reference
search(query, opts?) / client.search(query, opts?)
Param | Type | Default | Description |
|
| required | What to search for |
|
|
| Web context to retrieve |
|
|
| OpenAI model |
Returns { text, searchQueries, usage, model }.
createClient(opts?)
Param | Type | Default | Description |
|
|
| Auth file location |
|
| — | Explicit JWT |
|
| — | Auto-refresh when expired |
|
| — | ChatGPT account ID |
|
|
| Fall back to |
|
|
| Default model |
Auth helpers (from openai_websearch/auth)
Export | Description |
| PKCE browser flow, callback on |
| Headless flow, returns URL + code |
| Refresh grant |
| Load/refresh/save token management |
Configuration
Env var | Default | Description |
|
| Auth file path |
|
| Default model |
|
| Fallback Codex auth file |
Requirements
Node.js 18+ (native
fetch), Bun, or DenoA ChatGPT account (free/plus/pro — whatever you have)
No Codex CLI required (unless you want the fallback auth)
How it works
Auth: OAuth2 with PKCE against
auth.openai.com(same client as Codex CLI). Browser flow or device-code flow. Tokens stored locally, refreshed automatically viarefresh_tokengrant.Search: Sends requests to the ChatGPT backend Responses API (
chatgpt.com/backend-api/codex/responses) with theweb_searchtool.MCP: The server uses the official
@modelcontextprotocol/sdk— proper JSON-RPC framing, protocol version negotiation, Zod → JSON Schema derivation, argument validation.
All search runs server-side at OpenAI — same infrastructure that powers ChatGPT's web search.
License
MIT
Available Tools
2 toolsimage_searchImage SearchA
Search the web for images using OpenAI's native web search. Returns image URLs, titles, and source pages.
Returns real image URLs from web pages, not AI-generated images
contextSize controls search depth
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | OpenAI model to use (default: gpt-5.6-luna) | |
| query | Yes | What images to search for. | |
| context_size | No | Search depth | medium |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral context. It usefully discloses that the tool performs a web search and returns real URLs, not AI-generated images, and that context_size controls depth. It does not mention rate limits, pagination, or other operational details, but for a read-only search tool this is sufficient disclosure.
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 compact, with the main purpose in the first sentence and two bullet points that add practical details. No filler or repetition, and information is front-loaded for quick scanning.
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?
Since there is no output schema, the description responsibly explains what the tool returns (image URLs, titles, source pages). It also gives a key behavioral detail (real images, not AI-generated). It does not discuss error cases or limitations, but for a simple search tool with only three parameters, the description is sufficiently complete.
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 input schema already has 100% parameter description coverage, including 'Search depth' for context_size. The description's note about contextSize controlling search depth paraphrases the schema without adding new meaning. It does not clarify the parameter list beyond what is already structured.
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 'Search the web for images' with a specific verb and resource. It also lists return types (image URLs, titles, source pages), and explicitly distinguishes itself from the sibling web_search by focusing on images rather than general web results.
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 clearly implies a use case (searching for images, not text) and notes that it returns real image URLs rather than AI-generated ones. However, it does not explicitly state when to prefer this over web_search or any exclusions, so it stops short of full usage guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
web_searchWeb SearchA
Search the web using OpenAI's native server-side web search. Returns clean, up-to-date results with real URLs and citations. Powered by your ChatGPT/Codex subscription.
contextSize: "low" (fast/cheap), "medium" (balanced, default), "high" (thorough/deep)
All search happens server-side at OpenAI, not locally
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | OpenAI model to use (default: gpt-5.6-luna) | |
| query | Yes | What to search for. Be specific for best results. | |
| context_size | No | How much web context to retrieve | medium |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the transparency burden and does well by disclosing that search is server-side, powered by a subscription, and that context_size affects speed/quality. It also promises real URLs and citations, giving useful behavioral expectations.
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 concise: two short sentences plus a bullet for context_size, with the core purpose front-loaded. Every sentence adds unique value without redundancy or unnecessary detail.
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?
Despite having no output schema, the description explains key return characteristics (clean results, real URLs, citations). It covers the essential behavior and parameter variants for a simple search tool, though it omits failure modes or edge cases like empty results.
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?
Schema description coverage is 100%, providing a baseline of 3. The description adds extra meaning to context_size by mapping values to cost/speed trade-offs ('fast/cheap' vs 'thorough/deep'), going beyond the schema's basic 'How much web context to retrieve'.
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 uses the specific verb 'Search the web' and names the resource as the web, clearly indicating the tool's function. It also mentions returning URLs and citations, which helps distinguish it from the sibling tool 'image_search', though it does not explicitly contrast them.
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 context about server-side execution and subscription reliance, plus context_size options, but it does not explicitly say when to use this tool over image_search or when not to use it. Usage is implied rather than explicitly guided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
image_search and web_search are clearly distinct: one retrieves images, the other general web results. The names and descriptions leave no ambiguity about which tool to use for a given query.
Both tools follow the identical <object>_search pattern, creating a predictable and consistent naming convention that aligns with their functions.
With only two tools, the server feels minimal but covers the two primary search needs (general and image). It is borderline because the scope could reasonably include other search types.
The tool surface covers general web search and image search well, but is missing potentially common search types like news or video. Overall, the core search functionality is not left with dead ends.
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
Provides AI assistants with access to Seltz's powerful Web Search capabilities.
The best web search for your AI Agent
Search Google straight from your AI agent. Web results, images, videos, news, products, scholarly ar
Web search and page-reading for AI agents. One-click OAuth connect, or a Caesar API key.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides intelligent web search capabilities using OpenAI's Web Search API with reasoning models. Supports localized results, multiple model options, and automatic source citations for current information retrieval.15
- AlicenseAqualityNot gradedmaintenanceEnables web searching via SearXNG, page content extraction with Crawl4AI, and image analysis using vision language models. It provides AI agents with tools for information synthesis and web-based data retrieval through OpenAI-compatible LLM endpoints.3
- AlicenseAqualityDmaintenanceProvides intelligent web search capabilities using OpenAI's reasoning models, enabling AI assistants to fetch up-to-date information with smart reasoning.1MIT
- FlicenseNot gradedqualityCmaintenanceProvides free web search, content fetching, image search, and deep research via SearXNG, no API keys required.
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/hffmnnj/openai_websearch'
If you have feedback or need assistance with the MCP directory API, please join our Discord server