VOOZH about

URL: https://deepwiki.com/ppl-ai/modelcontextprotocol/8-development-guide

⇱ Development Guide | ppl-ai/modelcontextprotocol | DeepWiki


Loading...
Last indexed: 28 February 2026 (95c7a8)
Menu

Development Guide

This section covers everything needed to work on the @perplexity-ai/mcp-server codebase itself: the repository layout, how to run the server without a build step during development, how to build and test, and the TypeScript compiler configuration. It is intended for contributors and anyone modifying or extending the server.

For deployment of the built server, see Deployment. For configuration of the running server (environment variables, proxy, etc.), see Configuration.


Quick Start for Contributors

The minimum requirements to start developing are:

RequirementMinimum Version
Node.js18
npmbundled with Node 18+

Set PERPLEXITY_API_KEY in your environment, then:

npm ci
npm run dev # stdio mode, no build needed
npm run dev:http # HTTP mode, no build needed
npm test # run the test suite

Sources: package.json68-70 package.json44-46


Repository Layout

Development workflow diagram: source to output


Sources: package.json26-36 package.json37-49


npm Scripts Reference

All developer-facing tasks are exposed as npm scripts in package.json37-49

ScriptCommandPurpose
buildtsc && shx chmod +x dist/*.jsCompile TypeScript and mark output files executable
preparenpm run buildAuto-runs build on npm install
watchtsc --watchIncremental compile on file change
startnode dist/index.jsRun compiled stdio server
start:httpnode dist/http.jsRun compiled HTTP server
start:http:publicBIND_ADDRESS=0.0.0.0 ALLOWED_ORIGINS=* node dist/http.jsHTTP server open to all origins
devtsx src/index.tsRun stdio server directly from TypeScript (no build)
dev:httptsx src/http.tsRun HTTP server directly from TypeScript (no build)
dev:http:publicBIND_ADDRESS=0.0.0.0 ALLOWED_ORIGINS=* tsx src/http.tsHTTP server, open to all origins, no build
testvitest runSingle-pass test run
test:watchvitestContinuous test watch mode
test:coveragevitest run --coverageTest run with v8 coverage report

Sources: package.json37-49


Development vs Production Mode

Mode selection diagram


tsx executes TypeScript source files directly using an ESBuild-based transformer, enabling fast iteration without a compile step. The build script uses tsc for full type checking and produces the dist/ artifacts that are shipped in the npm package.

Sources: package.json37-49


Child Pages

The remaining sections in this Development Guide cover each topic in detail:

  • Project Structure and Architecture — Source file layout, dist/ output, config files, and how src/index.ts and src/http.ts relate to the shared src/server.ts core.
  • Building and Testing — Full details on the tsc build pipeline, shx cross-platform chmod, tsx dev mode, vitest configuration, the PERPLEXITY_API_KEY test stub, and coverage exclusions.
  • TypeScript Configurationtsconfig.json settings: ES2020 target, ESNext module system, strict mode, esModuleInterop, node module resolution, src/ as rootDir, and dist/ as outDir.

Key Dependencies at a Glance

Development toolchain dependency diagram


Sources: package.json58-67 package.json37-49