Skip to content

Conversation

@kesku
Copy link
Collaborator

@kesku kesku commented Nov 9, 2025

Summary

Migrates the Perplexity MCP Server to support both STDIO and HTTP transports while maintaining backward compatibility. Users can continue using npx @perplexity-ai/mcp-server unchanged, while gaining the ability to deploy as HTTP servers for session based cloud/remote access

Changes

  • **Migrated to McpServer API
  • Separate entry points - src/index.ts (STDIO), src/http.ts (HTTP), src/server.ts (shared core)
  • StreamableHTTP transport with full session management and SSE support
  • Express server with CORS, health checks, error handling

Misc

Deployment Options

Local/Development (Unchanged):

npx @perplexity-ai/mcp-server  # Works exactly as before

HTTP/Cloud (New):

# Docker
docker run -p 8080:8080 -e PERPLEXITY_API_KEY=key perplexity-mcp-server

# Node.js
npm run start:http

This migration enables the Perplexity MCP Server to scale from local developer tools to enterprise cloud deployments while maintaining full compatibility with existing users.


Note

Adds HTTP transport (Express + StreamableHTTP) alongside STDIO, refactors to a shared McpServer core, updates Docker/docs/tests, and bumps to v0.5.0.

  • Core Refactor
    • Migrate to McpServer API with shared core in src/server.ts; split entry points: src/index.ts (STDIO) and src/http.ts (HTTP).
    • Remove monolithic index.ts; add zod-typed tool schemas and keep existing tools (perplexity_ask, perplexity_research, perplexity_reason, perplexity_search).
  • HTTP Transport
    • Implement StreamableHTTP transport with session management (SSE), CORS, JSON handling, and /health in src/http.ts.
  • Docker/Deployment
    • Update Dockerfile to build runtime for HTTP (EXPOSE 8080, entrypoint dist/http.js).
    • Add smithery.yaml; expand HTTP deployment docs in README.md and DOCKER.md.
  • Build/Config
    • Bump version to 0.5.0; update server.json and .claude-plugin/marketplace.json.
    • Adjust package.json scripts (start:http, dev scripts), publish files list, and add deps: express, cors, zod, tsx.
    • Update tsconfig.json (target ES2020, rootDir=src).
  • Tests/CI
    • Add src/transport.test.ts; update tests to new module paths; set PERPLEXITY_API_KEY in CI workflow.

Written by Cursor Bugbot for commit b28bd14. This will update automatically on new commits. Configure here.

- Migrate from Server class to modern McpServer
- Add StreamableHTTP transport with session management and SSE support
- Maintain backward compatibility for existing STDIO users
- Preserve all tool annotations
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

};

// Connect server to transport
await mcpServer.connect(transport);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Server instance improperly shared across sessions.

The mcpServer instance is created once at module level but mcpServer.connect(transport) is called for each new session. This causes a single server instance to be connected to multiple transports simultaneously, which can lead to message routing errors, resource leaks, and state corruption. Each transport should have its own dedicated server instance, or the server should be created once and never reconnected.

Fix in Cursor Fix in Web

@kesku kesku closed this Nov 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants