- Home
- MCP servers
- SearchAPI
SearchAPI
- typescript
14
GitHub Stars
typescript
Language
4 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You run a Model Context Protocol (MCP) server that lets AI assistants securely access external data sources through SearchAPI.site. You can operate the server locally via a stdio transport for CLI workflows or expose it remotely via HTTP for web clients. This server setup supports Google and Bing data sources, offers an inspector for debugging, and includes a ready-to-use example tool to demonstrate MCP tool patterns.
How to use
You connect to the MCP server from your MCP client or tooling layer to perform data lookups through SearchAPI.site. Use the stdio transport for local CLI usage or the HTTP transport to expose the MCP endpoint over the network. Start by ensuring the server is running, then register the MCP server in your client configuration to enable tool calls and data fetches through the MCP protocol.
How to install
Prerequisites you need installed before running the MCP server:
• Node.js version 18.x or later
• Git for cloning and version control
Steps to set up locally with the stdio transport (default) and enable hot-reloading during development:
# Clone the repository
git clone https://github.com/mrgoonie/searchapi-mcp-server.git
cd searchapi-mcp-server
# Install dependencies
npm install
# Start the server in development mode (stdio transport by default)
npm run dev:server
# Optional: start the server with HTTP transport for web-based clients
npm run dev:server:http
Configuration and usage notes
You can connect via two MCP configurations: a remote HTTP URL configuration or a local stdio configuration. Use the HTTP configuration if you want to access the MCP endpoint over the network, and use the stdio configuration for local CLI usage.
# Local stdio configuration example
{
"mcpServers": {
"searchapi": {
"command": "node",
"args": ["/path/to/searchapi-mcp-server/dist/index.js"],
"transportType": "stdio"
}
}
}
# Remote HTTP configuration example
{
"mcpServers": {
"searchapi": {
"type": "http",
"url": "http://mcp.searchapi.site/mcp"
}
}
}
Environment variables for HTTP transport you may configure to control host, port, and path are MCP_HTTP_HOST, MCP_HTTP_PORT, and MCP_HTTP_PATH. Common defaults are 127.0.0.1 for the host, 8080 for the port, and /mcp for the path.
# Example environment variables for HTTP transport
{
"MCP_HTTP_HOST": "127.0.0.1",
"MCP_HTTP_PORT": "8080",
"MCP_HTTP_PATH": "/mcp"
}
Example tool and how to extend MCP capabilities
The server includes a concrete example tool that demonstrates how to fetch data from an API and present it as Markdown content. You can model additional tools using the same pattern to expose new external data sources to AI assistants.
// Example tool: get_data
// This is a representative snippet showing the tool wiring pattern
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';
const GetDataArgs = z.object({
param: z.string().optional()
});
type GetDataArgsType = z.infer<typeof GetDataArgs>;
async function handleGetData(args: GetDataArgsType) {
// perform data fetch and return formatted content
return { content: [{ type: 'text' as const, text: 'example data' }] };
}
export function register(server: McpServer) {
server.tool(
'get_data',
'Gets data from the example API, optionally using `param`.',
GetDataArgs.shape,
handleGetData,
);
}
How to test and debug
Use the MCP Inspector during development to test your tools and view request/response details. Start the server, then open the inspector UI to exercise tools and verify responses.
# Start in development mode with inspector
npm run dev:server
# Access the MCP Inspector in your browser
http://localhost:5173
Notes on publishing and maintenance
When you are ready to publish, ensure you include your MCP server configuration in your deployment, build the project, and start the server in production mode. You can also use an HTTP-based deployment for remote clients.
Available tools
get_data
Gets data from the example API, optionally using the provided parameter. Returns formatted data as Markdown.