@perplexity-ai/mcp-server 0.14.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.claude-plugin/marketplace.json +49 -0
  2. package/LICENSE +21 -201
  3. package/README.md +105 -157
  4. package/dist/http.d.ts +15 -0
  5. package/dist/http.js +190 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +23 -0
  8. package/dist/logger.d.ts +19 -0
  9. package/dist/logger.js +82 -0
  10. package/dist/server.d.ts +61 -0
  11. package/dist/server.js +613 -0
  12. package/dist/types.d.ts +93 -0
  13. package/dist/types.js +1 -0
  14. package/dist/validation.d.ts +1063 -0
  15. package/dist/validation.js +62 -0
  16. package/package.json +67 -155
  17. package/compat.d.mts +0 -58
  18. package/compat.d.mts.map +0 -1
  19. package/compat.d.ts +0 -58
  20. package/compat.d.ts.map +0 -1
  21. package/compat.js +0 -387
  22. package/compat.js.map +0 -1
  23. package/compat.mjs +0 -378
  24. package/compat.mjs.map +0 -1
  25. package/dynamic-tools.d.mts +0 -12
  26. package/dynamic-tools.d.mts.map +0 -1
  27. package/dynamic-tools.d.ts +0 -12
  28. package/dynamic-tools.d.ts.map +0 -1
  29. package/dynamic-tools.js +0 -135
  30. package/dynamic-tools.js.map +0 -1
  31. package/dynamic-tools.mjs +0 -132
  32. package/dynamic-tools.mjs.map +0 -1
  33. package/filtering.d.mts +0 -2
  34. package/filtering.d.mts.map +0 -1
  35. package/filtering.d.ts +0 -2
  36. package/filtering.d.ts.map +0 -1
  37. package/filtering.js +0 -20
  38. package/filtering.js.map +0 -1
  39. package/filtering.mjs +0 -13
  40. package/filtering.mjs.map +0 -1
  41. package/headers.d.mts +0 -4
  42. package/headers.d.mts.map +0 -1
  43. package/headers.d.ts +0 -4
  44. package/headers.d.ts.map +0 -1
  45. package/headers.js +0 -22
  46. package/headers.js.map +0 -1
  47. package/headers.mjs +0 -18
  48. package/headers.mjs.map +0 -1
  49. package/http.d.mts +0 -9
  50. package/http.d.mts.map +0 -1
  51. package/http.d.ts +0 -9
  52. package/http.d.ts.map +0 -1
  53. package/http.js +0 -108
  54. package/http.js.map +0 -1
  55. package/http.mjs +0 -100
  56. package/http.mjs.map +0 -1
  57. package/index.d.mts +0 -3
  58. package/index.d.mts.map +0 -1
  59. package/index.d.ts +0 -3
  60. package/index.d.ts.map +0 -1
  61. package/index.js +0 -91
  62. package/index.js.map +0 -1
  63. package/index.mjs +0 -89
  64. package/index.mjs.map +0 -1
  65. package/options.d.mts +0 -18
  66. package/options.d.mts.map +0 -1
  67. package/options.d.ts +0 -18
  68. package/options.d.ts.map +0 -1
  69. package/options.js +0 -415
  70. package/options.js.map +0 -1
  71. package/options.mjs +0 -408
  72. package/options.mjs.map +0 -1
  73. package/server.d.mts +0 -35
  74. package/server.d.mts.map +0 -1
  75. package/server.d.ts +0 -35
  76. package/server.d.ts.map +0 -1
  77. package/server.js +0 -166
  78. package/server.js.map +0 -1
  79. package/server.mjs +0 -152
  80. package/server.mjs.map +0 -1
  81. package/src/compat.ts +0 -483
  82. package/src/dynamic-tools.ts +0 -159
  83. package/src/filtering.ts +0 -14
  84. package/src/headers.ts +0 -23
  85. package/src/http.ts +0 -127
  86. package/src/index.ts +0 -108
  87. package/src/options.ts +0 -453
  88. package/src/server.ts +0 -201
  89. package/src/stdio.ts +0 -13
  90. package/src/tools/chat/completions/create-chat-completions.ts +0 -1323
  91. package/src/tools/index.ts +0 -73
  92. package/src/tools/search/create-search.ts +0 -89
  93. package/src/tools/types.ts +0 -103
  94. package/src/tools.ts +0 -1
  95. package/src/tsconfig.json +0 -11
  96. package/stdio.d.mts +0 -3
  97. package/stdio.d.mts.map +0 -1
  98. package/stdio.d.ts +0 -3
  99. package/stdio.d.ts.map +0 -1
  100. package/stdio.js +0 -14
  101. package/stdio.js.map +0 -1
  102. package/stdio.mjs +0 -10
  103. package/stdio.mjs.map +0 -1
  104. package/tools/chat/completions/create-chat-completions.d.mts +0 -45
  105. package/tools/chat/completions/create-chat-completions.d.mts.map +0 -1
  106. package/tools/chat/completions/create-chat-completions.d.ts +0 -45
  107. package/tools/chat/completions/create-chat-completions.d.ts.map +0 -1
  108. package/tools/chat/completions/create-chat-completions.js +0 -1320
  109. package/tools/chat/completions/create-chat-completions.js.map +0 -1
  110. package/tools/chat/completions/create-chat-completions.mjs +0 -1316
  111. package/tools/chat/completions/create-chat-completions.mjs.map +0 -1
  112. package/tools/index.d.mts +0 -10
  113. package/tools/index.d.mts.map +0 -1
  114. package/tools/index.d.ts +0 -10
  115. package/tools/index.d.ts.map +0 -1
  116. package/tools/index.js +0 -57
  117. package/tools/index.js.map +0 -1
  118. package/tools/index.mjs +0 -50
  119. package/tools/index.mjs.map +0 -1
  120. package/tools/search/create-search.d.mts +0 -45
  121. package/tools/search/create-search.d.mts.map +0 -1
  122. package/tools/search/create-search.d.ts +0 -45
  123. package/tools/search/create-search.d.ts.map +0 -1
  124. package/tools/search/create-search.js +0 -86
  125. package/tools/search/create-search.js.map +0 -1
  126. package/tools/search/create-search.mjs +0 -82
  127. package/tools/search/create-search.mjs.map +0 -1
  128. package/tools/types.d.mts +0 -51
  129. package/tools/types.d.mts.map +0 -1
  130. package/tools/types.d.ts +0 -51
  131. package/tools/types.d.ts.map +0 -1
  132. package/tools/types.js +0 -46
  133. package/tools/types.js.map +0 -1
  134. package/tools/types.mjs +0 -42
  135. package/tools/types.mjs.map +0 -1
  136. package/tools.d.mts +0 -2
  137. package/tools.d.mts.map +0 -1
  138. package/tools.d.ts +0 -2
  139. package/tools.d.ts.map +0 -1
  140. package/tools.js +0 -18
  141. package/tools.js.map +0 -1
  142. package/tools.mjs +0 -2
  143. package/tools.mjs.map +0 -1
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "perplexity-mcp-server",
3
+ "owner": {
4
+ "name": "Perplexity AI",
5
+ "email": "api@perplexity.ai"
6
+ },
7
+ "metadata": {
8
+ "description": "Official Perplexity AI plugin providing real-time web search, reasoning, and research capabilities",
9
+ "version": "1.1.0"
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "perplexity",
14
+ "source": "./",
15
+ "description": "Real-time web search, reasoning, and research through Perplexity's API",
16
+ "version": "1.1.0",
17
+ "author": {
18
+ "name": "Perplexity AI",
19
+ "email": "api@perplexity.ai"
20
+ },
21
+ "homepage": "https://docs.perplexity.ai/guides/mcp-server",
22
+ "repository": "https://github.com/perplexityai/modelcontextprotocol",
23
+ "license": "MIT",
24
+ "keywords": [
25
+ "mcp",
26
+ "search",
27
+ "web-search",
28
+ "perplexity",
29
+ "research",
30
+ "reasoning",
31
+ "ai"
32
+ ],
33
+ "category": "productivity",
34
+ "strict": false,
35
+ "mcpServers": {
36
+ "perplexity": {
37
+ "type": "stdio",
38
+ "command": "npx",
39
+ "args": ["-y", "@perplexity-ai/mcp-server"],
40
+ "env": {
41
+ "PERPLEXITY_API_KEY": "${PERPLEXITY_API_KEY}",
42
+ "PERPLEXITY_TIMEOUT_MS": "${PERPLEXITY_TIMEOUT_MS:-600000}"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ ]
48
+ }
49
+
package/LICENSE CHANGED
@@ -1,201 +1,21 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2025 Perplexity
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 perplexity
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,213 +1,161 @@
1
- # Perplexity TypeScript MCP Server
1
+ # Perplexity API Platform MCP Server
2
2
 
3
- It is generated with [Stainless](https://www.stainless.com/).
3
+ [![Install in Cursor](https://custom-icon-badges.demolab.com/badge/Install_in_Cursor-000000?style=for-the-badge&logo=cursor-ai-white)](https://cursor.com/en/install-mcp?name=perplexity&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBwZXJwbGV4aXR5LWFpL21jcC1zZXJ2ZXIiXSwiZW52Ijp7IlBFUlBMRVhJVFlfQVBJX0tFWSI6IiJ9fQ==)
4
+  
5
+ [![Install in VS Code](https://custom-icon-badges.demolab.com/badge/Install_in_VS_Code-007ACC?style=for-the-badge&logo=vsc&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=perplexity&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40perplexity-ai%2Fmcp-server%22%5D%2C%22env%22%3A%7B%22PERPLEXITY_API_KEY%22%3A%22%22%7D%7D)
6
+  
7
+ [![Add to Kiro](https://img.shields.io/badge/Add_to_Kiro-9046FF?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkxIiBoZWlnaHQ9IjIyNi44MTQiIHZpZXdCb3g9IjAgMCAxOTEgMjI2LjgxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMzUuNjA5IDE3My4xNjVjLTIzLjExMSA1MS4yMzUgMjYuMTA2IDY0LjA2OCA2Mi4zOTYgMzQuMTA2IDEwLjY2IDMzLjYwNSA1MC42OTggOC41MzQgNjUuMDU5LTE3LjUxMSAzMS42MzQtNTcuMzgzIDE4Ljg2Mi0xMTUuOTM3IDE1LjU3OS0xMjguMDE3LTIyLjUwMi04Mi4zNTctMTM0LjkyOS04Mi40MjktMTU0LjI4MS40MTgtNC41MjMgMTQuNTA1LTQuNTk1IDMxLjAwMy03LjE2MSA0OC4xMzItMS4yOSA4LjYzMS0yLjE5OCAxNC4xNDUtNS41MzkgMjMuMjMtMS45MjEgNS4yMTgtNC41NTkgOS44NDktOC43MTQgMTcuNjY2LTguMjEzIDEyLjU0NS4xNTUgMzguMiAzMi42NSAyMi4wMDF6IiBmaWxsPSIjZmZmIi8+PHBhdGggZD0iTTEwMi42MDMgOTYuODk4Yy05LjIyOSAwLTEwLjYxMy0xMS4wMzEtMTAuNjEzLTE3LjU5NyAwLTUuOTMyIDEuMDc0LTEwLjY0OSAzLjA2Ny0xMy42NDRhOC41OCA4LjU4IDAgMCAxIDcuNTIxLTMuOTY0YzMuMjM2IDAgNi4wMDQgMS4zNjIgNy45NjEgNC4wMzYgMi4yMDkgMy4wNDUgMy4zOTEgNy43NTkgMy4zOTEgMTMuNTg2IDAgMTEuMDE3LTQuMjM4IDE3LjU5Ny0xMS4zNDEgMTcuNTk3em0zNy45NDggMGMtOS4yNCAwLTEwLjYyNC0xMS4wMzEtMTAuNjI0LTE3LjU5NyAwLTUuOTMyIDEuMDc0LTEwLjY0OSAzLjA4MS0xMy42NDRhOC41OCA4LjU4IDAgMCAxIDcuNTIxLTMuOTY0IDkuNTEgOS41MSAwIDAgMSA3Ljk1IDQuMDM2YzIuMjIgMy4wNDUgMy40MDIgNy43NTkgMy40MDIgMTMuNTg2IDAgMTEuMDE3LTQuMjM4IDE3LjU5Ny0xMS4zNDEgMTcuNTk3eiIgZmlsbD0iIzAwMCIvPlw8L3N2Zz4=&logoColor=white)](https://kiro.dev/launch/mcp/add?name=perplexity&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40perplexity-ai%2Fmcp-server%22%5D%2C%22env%22%3A%7B%22PERPLEXITY_API_KEY%22%3A%22your_key_here%22%7D%7D)
8
+  
9
+ [![npm version](https://img.shields.io/npm/v/%40perplexity-ai%2Fmcp-server?style=for-the-badge&logo=npm&logoColor=white&color=CB3837)](https://www.npmjs.com/package/@perplexity-ai/mcp-server)
4
10
 
5
- ## Installation
11
+ The official MCP server implementation for the Perplexity API Platform, providing AI assistants with real-time web search, reasoning, and research capabilities through the [Agent API](https://docs.perplexity.ai/docs/agent-api/quickstart) and the Search API.
6
12
 
7
- ### Direct invocation
8
-
9
- You can run the MCP Server directly via `npx`:
10
-
11
- ```sh
12
- export PERPLEXITY_API_KEY="My API Key"
13
- npx -y @perplexity-ai/mcp-server@latest
14
- ```
15
-
16
- ### Via MCP Client
17
-
18
- There is a partial list of existing clients at [modelcontextprotocol.io](https://modelcontextprotocol.io/clients). If you already
19
- have a client, consult their documentation to install the MCP server.
20
-
21
- For clients with a configuration JSON, it might look something like this:
22
-
23
- ```json
24
- {
25
- "mcpServers": {
26
- "perplexity_ai_perplexity_ai_api": {
27
- "command": "npx",
28
- "args": ["-y", "@perplexity-ai/mcp-server", "--client=claude", "--tools=all"],
29
- "env": {
30
- "PERPLEXITY_API_KEY": "My API Key"
31
- }
32
- }
33
- }
34
- }
35
- ```
36
-
37
- ## Exposing endpoints to your MCP Client
38
-
39
- There are two ways to expose endpoints as tools in the MCP server:
40
-
41
- 1. Exposing one tool per endpoint, and filtering as necessary
42
- 2. Exposing a set of tools to dynamically discover and invoke endpoints from the API
43
-
44
- ### Filtering endpoints and tools
45
-
46
- You can run the package on the command line to discover and filter the set of tools that are exposed by the
47
- MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
48
- context window.
49
-
50
- You can filter by multiple aspects:
51
-
52
- - `--tool` includes a specific tool by name
53
- - `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
54
- - `--operation` includes just read (get/list) or just write operations
55
-
56
- ### Dynamic tools
57
-
58
- If you specify `--tools=dynamic` to the MCP server, instead of exposing one tool per endpoint in the API, it will
59
- expose the following tools:
60
-
61
- 1. `list_api_endpoints` - Discovers available endpoints, with optional filtering by search query
62
- 2. `get_api_endpoint_schema` - Gets detailed schema information for a specific endpoint
63
- 3. `invoke_api_endpoint` - Executes any endpoint with the appropriate parameters
64
-
65
- This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all
66
- of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to
67
- search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it
68
- can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
69
- you can opt-in to explicit tools, the dynamic tools, or both.
70
-
71
- See more information with `--help`.
72
-
73
- All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).
74
-
75
- Use `--list` to see the list of available tools, or see below.
76
-
77
- ### Specifying the MCP Client
78
-
79
- Different clients have varying abilities to handle arbitrary tools and schemas.
13
+ ## Available Tools
80
14
 
81
- You can specify the client you are using with the `--client` argument, and the MCP server will automatically
82
- serve tools and schemas that are more compatible with that client.
15
+ ### **perplexity_search**
16
+ Direct web search using the Perplexity Search API. Returns ranked search results with metadata, perfect for finding current information. Supports recency filters (`search_recency_filter`) and domain restrictions (`search_domain_filter`).
83
17
 
84
- - `--client=<type>`: Set all capabilities based on a known MCP client
18
+ ### **perplexity_ask**
19
+ General-purpose conversational AI with real-time web search, backed by the Agent API `fast` preset. Great for quick questions and everyday searches.
85
20
 
86
- - Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
87
- - Example: `--client=cursor`
21
+ ### **perplexity_research**
22
+ Deep, comprehensive research backed by the Agent API `high` preset. Ideal for thorough analysis and detailed reports. Runs can take minutes; the server streams the run and reports progress to clients that request it.
88
23
 
89
- Additionally, if you have a client not on the above list, or the client has gotten better
90
- over time, you can manually enable or disable certain capabilities:
24
+ ### **perplexity_reason**
25
+ Advanced reasoning and problem-solving backed by the Agent API `medium` preset. Perfect for complex analytical tasks.
91
26
 
92
- - `--capability=<name>`: Specify individual client capabilities
93
- - Available capabilities:
94
- - `top-level-unions`: Enable support for top-level unions in tool schemas
95
- - `valid-json`: Enable JSON string parsing for arguments
96
- - `refs`: Enable support for $ref pointers in schemas
97
- - `unions`: Enable support for union types (anyOf) in schemas
98
- - `formats`: Enable support for format validations in schemas (e.g. date-time, email)
99
- - `tool-name-length=N`: Set maximum tool name length to N characters
100
- - Example: `--capability=top-level-unions --capability=tool-name-length=40`
101
- - Example: `--capability=top-level-unions,tool-name-length=40`
27
+ > [!NOTE]
28
+ > Presets are managed configurations (model, search setup, step budget) that Perplexity keeps tuned over time; see the [presets guide](https://docs.perplexity.ai/docs/agent-api/presets). Earlier versions of this server called the legacy `sonar-pro`, `sonar-reasoning-pro`, and `sonar-deep-research` models and accepted `strip_thinking` / `reasoning_effort` parameters. Those parameters are no longer part of the tool schemas and are ignored if sent; the Agent API produces no `<think>` tags.
102
29
 
103
- ### Examples
30
+ ## Configuration
104
31
 
105
- 1. Filter for read operations on cards:
32
+ ### Get Your API Key
106
33
 
107
- ```bash
108
- --resource=cards --operation=read
109
- ```
34
+ 1. Get your Perplexity API Key from the [API Portal](https://www.perplexity.ai/account/api/group)
35
+ 2. Replace `your_key_here` in the configurations below with your API key
36
+ 3. (Optional) Set timeout: `PERPLEXITY_TIMEOUT_MS=600000` (default: 5 minutes)
37
+ 4. (Optional) Set custom base URL: `PERPLEXITY_BASE_URL=https://your-custom-url.com` (default: https://api.perplexity.ai)
38
+ 5. (Optional) Set log level: `PERPLEXITY_LOG_LEVEL=DEBUG|INFO|WARN|ERROR` (default: ERROR)
110
39
 
111
- 2. Exclude specific tools while including others:
40
+ ### Claude Code
112
41
 
113
42
  ```bash
114
- --resource=cards --no-tool=create_cards
43
+ claude mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server
115
44
  ```
116
45
 
117
- 3. Configure for Cursor client with custom max tool name length:
118
-
46
+ Or install via plugin:
119
47
  ```bash
120
- --client=cursor --capability=tool-name-length=40
48
+ export PERPLEXITY_API_KEY="your_key_here"
49
+ claude
50
+ # Then run: /plugin marketplace add perplexityai/modelcontextprotocol
51
+ # Then run: /plugin install perplexity
121
52
  ```
122
53
 
123
- 4. Complex filtering with multiple criteria:
54
+ ### Codex
124
55
 
125
56
  ```bash
126
- --resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
57
+ codex mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server
127
58
  ```
128
59
 
129
- ## Running remotely
60
+ ### Cursor, Claude Desktop, Kiro, Windsurf, and VS Code
130
61
 
131
- Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket.
62
+ Most clients can be configured manually using the same `mcpServers` wrapper in their client config (as shown for Cursor). If a client has a different schema, check its docs for the exact wrapper format.
132
63
 
133
- Authorization can be provided via the `Authorization` header using the Bearer scheme.
64
+ For manual setup, these clients all use the same `mcpServers` structure:
134
65
 
135
- Additionally, authorization can be provided via the following headers:
136
- | Header | Equivalent client option | Security scheme |
137
- | ---------------------- | ------------------------ | --------------- |
138
- | `x-perplexity-api-key` | `apiKey` | HTTPBearer |
139
-
140
- A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`:
66
+ | Client | Config File |
67
+ |--------|-------------|
68
+ | Cursor | `~/.cursor/mcp.json` |
69
+ | Claude Desktop | `claude_desktop_config.json` |
70
+ | Kiro | `.kiro/settings/mcp.json` |
71
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
72
+ | VS Code | `.vscode/mcp.json` |
141
73
 
142
74
  ```json
143
75
  {
144
76
  "mcpServers": {
145
- "perplexity_ai_perplexity_ai_api": {
146
- "url": "http://localhost:3000",
147
- "headers": {
148
- "Authorization": "Bearer <auth value>"
77
+ "perplexity": {
78
+ "command": "npx",
79
+ "args": ["-y", "@perplexity-ai/mcp-server"],
80
+ "env": {
81
+ "PERPLEXITY_API_KEY": "your_key_here"
149
82
  }
150
83
  }
151
84
  }
152
85
  }
153
86
  ```
154
87
 
155
- The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
156
- For example, to exclude specific tools while including others, use the URL:
88
+ ### Proxy Setup (For Corporate Networks)
157
89
 
158
- ```
159
- http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
160
- ```
90
+ If you are running this server at work—especially behind a company firewall or proxy—you may need to tell the program how to send its internet traffic through your network's proxy. Follow these steps:
161
91
 
162
- Or, to configure for the Cursor client, with a custom max tool name length, use the URL:
92
+ **1. Get your proxy details**
163
93
 
94
+ - Ask your IT department for your HTTPS proxy address and port.
95
+ - You may also need a username and password.
96
+
97
+ **2. Set the proxy environment variable**
98
+
99
+ The easiest and most reliable way for Perplexity MCP is to use `PERPLEXITY_PROXY`. For example:
100
+
101
+ ```bash
102
+ export PERPLEXITY_PROXY=https://your-proxy-host:8080
164
103
  ```
165
- http://localhost:3000?client=cursor&capability=tool-name-length%3D40
104
+
105
+ If your proxy needs a username and password, use:
106
+
107
+ ```bash
108
+ export PERPLEXITY_PROXY=https://username:password@your-proxy-host:8080
166
109
  ```
167
110
 
168
- ## Importing the tools and server individually
111
+ **3. Alternate: Standard environment variables**
169
112
 
170
- ```js
171
- // Import the server, generated endpoints, or the init function
172
- import { server, endpoints, init } from "@perplexity-ai/mcp-server/server";
113
+ If you'd rather use the standard variables, we support `HTTPS_PROXY` and `HTTP_PROXY`.
173
114
 
174
- // import a specific tool
175
- import createChatCompletions from "@perplexity-ai/mcp-server/tools/chat/completions/create-chat-completions";
115
+ > [!NOTE]
116
+ > The server checks proxy settings in this order: `PERPLEXITY_PROXY` → `HTTPS_PROXY` → `HTTP_PROXY`. If none are set, it connects directly to the internet.
117
+ > URLs must include `https://`. Typical ports are `8080`, `3128`, and `80`.
176
118
 
177
- // initialize the server and all endpoints
178
- init({ server, endpoints });
119
+ ### HTTP Server Deployment
179
120
 
180
- // manually start server
181
- const transport = new StdioServerTransport();
182
- await server.connect(transport);
121
+ For cloud or shared deployments, run the server in HTTP mode.
183
122
 
184
- // or initialize your own server with specific tools
185
- const myServer = new McpServer(...);
123
+ #### Environment Variables
186
124
 
187
- // define your own endpoint
188
- const myCustomEndpoint = {
189
- tool: {
190
- name: 'my_custom_tool',
191
- description: 'My custom tool',
192
- inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
193
- },
194
- handler: async (client: client, args: any) => {
195
- return { myResponse: 'Hello world!' };
196
- })
197
- };
125
+ | Variable | Description | Default |
126
+ |----------|-------------|---------|
127
+ | `PERPLEXITY_API_KEY` | Your Perplexity API key | *Required* |
128
+ | `PERPLEXITY_BASE_URL` | Custom base URL for API requests | `https://api.perplexity.ai` |
129
+ | `PORT` | HTTP server port | `8080` |
130
+ | `BIND_ADDRESS` | Network interface to bind to. Defaults to loopback. Set to `0.0.0.0` to expose on all interfaces. | `127.0.0.1` |
131
+ | `ALLOWED_ORIGINS` | CORS origins (comma-separated). Defaults to empty (no cross-origin browser requests). Set to an explicit allowlist (e.g. `https://app.example.com`) or to `*` to allow any origin. | *(empty)* |
132
+ | `ALLOWED_HOSTS` | Additional `Host` header values to accept (comma-separated). Loopback hosts on `PORT` are always allowed. Add the public hostname when binding to `0.0.0.0`. | *(loopback only)* |
198
133
 
199
- // initialize the server with your custom endpoints
200
- init({ server: myServer, endpoints: [createChatCompletions, myCustomEndpoint] });
134
+ #### Docker
135
+
136
+ ```bash
137
+ docker build -t perplexity-mcp-server .
138
+ docker run -p 8080:8080 -e PERPLEXITY_API_KEY=your_key_here perplexity-mcp-server
201
139
  ```
202
140
 
203
- ## Available Tools
141
+ #### Node.js
142
+
143
+ ```bash
144
+ export PERPLEXITY_API_KEY=your_key_here
145
+ npm install && npm run build && npm run start:http
146
+ ```
204
147
 
205
- The following tools are available in this MCP server.
148
+ The server will be accessible at `http://localhost:8080/mcp`
206
149
 
207
- ### Resource `chat.completions`:
150
+ ## Troubleshooting
208
151
 
209
- - `create_chat_completions` (`write`): Generate a chat completion response for the given conversation.
152
+ - **API Key Issues**: Ensure `PERPLEXITY_API_KEY` is set correctly
153
+ - **Connection Errors**: Check your internet connection and API key validity
154
+ - **Tool Not Found**: Make sure the package is installed and the command path is correct
155
+ - **Timeout Errors**: For very long research queries, set `PERPLEXITY_TIMEOUT_MS` to a higher value
156
+ - **Proxy Issues**: Verify your `PERPLEXITY_PROXY` or `HTTPS_PROXY` setup and ensure `api.perplexity.ai` isn't blocked by your firewall.
157
+ - **EOF / Initialize Errors**: Some strict MCP clients fail because `npx` writes installation messages to stdout. Use `npx -yq` instead of `npx -y` to suppress this output.
210
158
 
211
- ### Resource `search`:
159
+ For support, visit [community.perplexity.ai](https://community.perplexity.ai) or [file an issue](https://github.com/perplexityai/modelcontextprotocol/issues).
212
160
 
213
- - `create_search` (`write`): Search the web and retrieve relevant web page contents.
161
+ ---
package/dist/http.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import { type Express } from "express";
3
+ export interface HttpAppOptions {
4
+ port: number;
5
+ bindAddress: string;
6
+ allowedOrigins: string[];
7
+ allowedHosts: Set<string>;
8
+ }
9
+ /**
10
+ * Build the Express app for the HTTP transport. Exported so tests can
11
+ * exercise the same wiring used in production.
12
+ */
13
+ export declare function createHttpApp(options: HttpAppOptions): Express;
14
+ /** Build the Host header allowlist from PORT + ALLOWED_HOSTS. */
15
+ export declare function buildAllowedHosts(port: number, extra: string[]): Set<string>;