Skip to main content
Glama

Perplexity MCP Server

by IsaiahDupree
index.js1.93 kB
/** * Perplexity MCP Server - Main Entry Point * * This file serves as the entry point for the Perplexity MCP Server Actor. * It sets up a proxy server that forwards requests to the locally running * Perplexity MCP server, which provides a Model Context Protocol (MCP) interface * for AI assistants to search and access information using the Perplexity API. */ // Apify SDK - toolkit for building Apify Actors (Read more at https://docs.apify.com/sdk/js/) import { Actor, log } from 'apify'; import { stdioToSse } from './lib/server.js'; import { getLogger } from './lib/getLogger.js'; // This is an ESM project, and as such, it requires you to specify extensions in your relative imports // Read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions // Configuration constants for the MCP server // Command to run the Perplexity MCP server const MCP_COMMAND = 'node ./lib/perplexity-mcp.js'; // Check if the Actor is running in standby mode const STANDBY_MODE = process.env.APIFY_META_ORIGIN === 'STANDBY'; const SERVER_PORT = parseInt(process.env.ACTOR_WEB_SERVER_PORT || '', 10); // Logger configuration const LOG_LEVEL = 'info'; const OUTPUT_TRANSPORT = 'sse'; // Initialize the Apify Actor environment // The init() call configures the Actor for its environment. It's recommended to start every Actor with an init() await Actor.init(); // Note: Actor.charge was removed as it's not available in this Apify SDK version if (!STANDBY_MODE) { // If the Actor is not in standby mode, we should not run the MCP server const msg = 'This Actor is not meant to be run directly. It should be run in standby mode.'; log.error(msg); await Actor.exit({ statusMessage: msg }); } const logger = getLogger({ logLevel: LOG_LEVEL, outputTransport: OUTPUT_TRANSPORT, }); await stdioToSse({ port: SERVER_PORT, stdioCmd: MCP_COMMAND, logger, });

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/IsaiahDupree/perplexity-mcp-server-actor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server