generic-mcp-search-fetch
v1.0.6
Published
Generic MCP server with OpenAI-compliant search and fetch tools
Maintainers
Readme
Generic MCP Search-Fetch Server
A generic MCP server that provides OpenAI-compliant search and fetch tools without any external API dependencies. This server can be easily customized to work with any data source.
Features
- OpenAI Compliant: Implements the exact tool specifications required for ChatGPT connectors and deep research
- No External Dependencies: Works with local data sources without requiring API keys
- Easy Customization: Simple to adapt for different data backends (database, API, vector store, etc.)
- TypeScript Implementation: Modern, type-safe codebase
Quick Start
# Install dependencies
npm install
# Development mode
npm run dev
# Build and run
npm run build
npm startRun the Published Package
Recent npm releases (10.x/11.x) ship npx as an alias of npm exec. In this mode the
classic npx <pkg>@<version> syntax no longer injects the package's bin into PATH,
so the shell prints command not found. Use the explicit --package flag instead:
npx --yes --package [email protected] generic-mcp-search-fetch --stdioTo always track the latest publish, swap @1.0.6 for @latest. The command keeps the
process alive and speaks MCP over STDIO.
MetaMCP Configuration
When adding the server in MetaMCP (STDIO transport):
- Command:
/opt/homebrew/bin/npx(or your system'snpxpath) - Arguments:
--yes --package [email protected] generic-mcp-search-fetch --stdio
As an alternative that bypasses npx, resolve the published CLI and run it with Node:
node $(node -e "const p=require.resolve('generic-mcp-search-fetch/package.json'); const {dirname,join}=require('path'); console.log(join(dirname(p),'dist/cli.js'));") --stdioCline Configuration
Add the server to cline_mcp_settings.json (macOS path: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):
{
"mcpServers": {
"search_fetch": {
"timeout": 60,
"type": "stdio",
"command": "npx",
"args": [
"--yes",
"--package",
"[email protected]",
"generic-mcp-search-fetch",
"--stdio"
]
}
}
}Customize the server key (search_fetch) or add autoApprove/env blocks as needed for your workflow.
ChatGPT Connector Setup
When adding this MCP server in ChatGPT → Settings → Connectors:
- Command:
node - Arguments:
dist/server.js(ornpm run devfor development)
Tools
search Tool
Searches through the data corpus and returns matching results.
Input:
{
query: string, // Search query
limit?: number, // Maximum results (default: 10, max: 50)
cursor?: string // Pagination cursor (optional)
}Output:
{
results: [{
id: string, // Unique identifier for fetching
title: string, // Human-readable title
snippet?: string, // Preview snippet
url?: string // Source URL for citation
}],
nextCursor?: string | null // For pagination
}fetch Tool
Retrieves complete document content by ID.
Input:
{
id: string // Document ID from search results
}Output:
{
id: string, // Document ID
title?: string, // Document title
content: string, // Full document content
url?: string, // Source URL
metadata?: object // Additional metadata
}Customization
Data Source
Replace the data in data/corpus.json with your own content. The file structure should be:
[
{
"id": "unique_id",
"title": "Document Title",
"url": "https://example.com/source",
"content": "Full document content here..."
}
]Backend Integration
To connect to a different data source (database, API, etc.), modify the loadCorpus() function in src/server.ts and the search logic to match your backend.
Development
# Development with hot reload
npm run dev
# Build for production
npm run build
# Run production build
npm startLicense
MIT License - Feel free to customize for your specific use case.
