An opinionated, coding-specialized, Model Context Protocol server that integrates Perplexity AI's Sonar models into AI coding assistants like Claude Code or Codex CLI.
  • TypeScript 82.5%
  • Shell 14.3%
  • JavaScript 3.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Łukasz Jerciński d794a8be48
All checks were successful
Release / Check tip (push) Successful in 3s
Release / pr-flow-canary (push) Has been skipped
Release / reuse (push) Successful in 4s
Release / quality-checks (24.15.0) (push) Has been skipped
Release / quality-checks (26.12.1) (push) Has been skipped
Release / qc-result (push) Successful in 3s
Release / quality-checks (push) Successful in 0s
Release / Release (push) Successful in 21s
chore: sync managed files with align 17.4.4 (#16)
2026-10-28 09:16:05 +00:00
.forgejo/workflows chore: sync managed files with align 17.4.4 (#16) 2026-10-28 09:16:05 +00:00
.githooks chore: align with j4k-align 13.1.0 (#9) 2026-10-24 12:17:51 +00:00
.vscode fix: point pr-review workflow at the smart review recipes and refresh managed files (#22) 2026-07-02 19:28:06 +02:00
scripts chore: sync managed files with align 17.4.4 (#16) 2026-10-28 09:16:05 +00:00
src fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
types chore: re-render managed files with @j4k/align@1.82.1 (#25) 2026-07-11 16:55:12 +02:00
.gitignore chore: align with @j4k/align 6.1.3 (#29) 2026-10-13 16:46:58 +02:00
.node-version chore: refresh managed runtime workflows (#10) 2026-10-24 19:23:26 +00:00
.oxfmtrc.json chore: retire the legacy CI review pipeline (#27) 2026-09-04 13:28:23 +02:00
.review-enrolled fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
AGENTS.md chore: regenerate agent instructions (#11) 2026-10-25 11:49:53 +00:00
CLAUDE.md chore: add CI/CD workflows and agent instructions (#12) 2025-12-13 07:44:33 +01:00
knip.json fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
LICENSE Initial commit 2025-08-26 05:45:15 +02:00
oxlint.config.ts fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
package.json fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
pnpm-lock.yaml fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
pnpm-workspace.yaml fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
README.md docs: name the tools in "How it works" only (#6) 2026-10-23 09:01:36 +00:00
release.config.mjs chore: align with j4k-align 13.1.0 (#9) 2026-10-24 12:17:51 +00:00
tsconfig.app.json chore: retire the legacy CI review pipeline (#27) 2026-09-04 13:28:23 +02:00
tsconfig.base.json chore: retire the legacy CI review pipeline (#27) 2026-09-04 13:28:23 +02:00
tsconfig.build.json fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
tsconfig.check.json fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
tsconfig.json fix: publish as @j4k-oss/perplexity-agent-mcp from code.j4k.dev (#1) 2026-10-21 15:11:45 +00:00
tsconfig.scripts.json chore: align with @j4k/align 6.1.3 (#29) 2026-10-13 16:46:58 +02:00
tsconfig.test.json chore: align with @j4k/align 6.1.3 (#29) 2026-10-13 16:46:58 +02:00

Perplexity Agent MCP

Source: https://code.j4k.dev/j4k-oss/perplexity-agent-mcp. github.com/Jercik/perplexity-agent-mcp is a read-only mirror; open issues and pull requests on the Forge.

An opinionated, coding-specialized, Model Context Protocol server that integrates Perplexity AI's Sonar models into AI coding assistants like Claude Code or Codex CLI. It's deliberately lean and adds very few tokens to your context. It covers quick API fact-checks and deeper research; How it works describes the tools.

Setup

The package is published only as @j4k-oss/perplexity-agent-mcp on the code.j4k.dev registry. The unscoped perplexity-agent-mcp package on npmjs is deprecated and gets no updates.

Always map the @j4k-oss scope to the code.j4k.dev registry: without a mapping, npm looks on npmjs, finds nothing, and fails with a 404. To do that once for every command, add this line to ~/.npmrc:

@j4k-oss:registry=https://code.j4k.dev/api/packages/j4k-oss/npm/

The inline flag in the commands below is enough for a single npx run. Keep the ~/.npmrc line for the global install: npm update -g and npm outdated -g read the registry from your configuration, so without the line they look the scoped name up on npmjs.org. Install the package globally:

npm install -g --@j4k-oss:registry=https://code.j4k.dev/api/packages/j4k-oss/npm/ @j4k-oss/perplexity-agent-mcp

If you installed the unscoped package globally, run npm uninstall -g perplexity-agent-mcp (or pnpm remove -g perplexity-agent-mcp) first: both packages provide the perplexity-agent-mcp command, npm refuses to overwrite it, and pnpm keeps running the old copy. To check the latest release without installing it:

npx -y --@j4k-oss:registry=https://code.j4k.dev/api/packages/j4k-oss/npm/ @j4k-oss/perplexity-agent-mcp@latest --version

In a pnpm project, map the scope to its registry and exempt it from minimumReleaseAge in pnpm-workspace.yaml, then add the package:

registries:
  "@j4k-oss": https://code.j4k.dev/api/packages/j4k-oss/npm/
minimumReleaseAgeExclude:
  - "@j4k-oss/*"
pnpm add -D @j4k-oss/perplexity-agent-mcp

The package installs the perplexity-agent-mcp command and reports the MCP server name perplexity-agent-mcp.

Then add it to your Claude config file (~/.claude.json or ~/.config/claude/config.json):

"mcpServers": {
  "perplexity": {
    "command": "perplexity-agent-mcp",
    "env": {
      "PERPLEXITY_API_KEY": "your-api-key-here"
    }
  }
}

Restart Claude Code after saving, and you're ready to go.

How it works

The server exposes only two tools with concise descriptions (~1.3K tokens), keeping your context window lean and efficient:

  • lookup: Gets quick facts from documentation (like API syntax or config keys)
  • answer: Does deeper research to compare options and make recommendations

Under the hood, both tools are opinionated wrappers that call Perplexity API with coding-specialized system prompts. The lookup tool uses a compact fact‑extraction prompt focused on code/docs facts (see LOOKUP_SYSTEM_PROMPT in src/prompts.ts). The answer tool uses a technical decision/analysis prompt tailored for migrations and architecture choices (see ANSWER_SYSTEM_PROMPT in src/prompts.ts). Each tool calls a fixed Perplexity model chosen for its task, and callers cannot select another. The models are set in registerLookupTool (src/tools/lookup.ts) and registerAnswerTool (src/tools/answer.ts).

Example AI agent prompt that will trigger AI agent to use this MCP and give you good results:

Please update the "foo" dependency to the latest version. Use Perplexity for the migration guide.

Requirements

  • Node.js v24.15.0 or newer
  • A Perplexity API key