desearch-mcp-server 0.0.1

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Desearch AI
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 ADDED
@@ -0,0 +1,134 @@
1
+ # Desearch MCP Server
2
+
3
+ [![npm version](https://badge.fury.io/js/desearch-mcp-server.svg)](https://www.npmjs.com/package/desearch-mcp-server)
4
+
5
+ A Model Context Protocol (MCP) server lets clients like Claude or Cursor use the Desearch AI for real-time AI X search and web search.
6
+
7
+ ## Tools
8
+
9
+ The Desearch MCP server includes the following tools:
10
+
11
+ - **AI Search**: Performs real-time AI Twitter and web searches with relevant links and summary.
12
+ - **X Search**: Real-time tweet search on X.
13
+
14
+ ## Prerequisites 📋
15
+
16
+ - An [Desearch API Key](https://console.desearch.ai/api-keys)
17
+ - [Node.js](https://nodejs.org/) (v18 or higher)
18
+ - [Claude Desktop](https://claude.ai/download) installed
19
+ - [Cursor IDE](https://www.cursor.com/)
20
+
21
+ ## Installation 🛠️
22
+
23
+ ### NPM Installation
24
+
25
+ ```bash
26
+ npm install -g desearch-mcp-server
27
+ ```
28
+
29
+ ## Configuration ⚙️
30
+
31
+ ### 1. Configure Cursor IDE to run the Desearch MCP server
32
+
33
+ Open Cursor IDE, access command palette `Cmd+Shift+P` or `Ctrl+Shift+P`, and search for `Open MCP Settings`. Click on `Add new global MCP server` to open the `mcp.json` file.
34
+
35
+ ### 2. Add the Desearch server configuration:
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "desearch": {
41
+ "command": "desearch-mcp-server",
42
+ "env": {
43
+ "DESEARCH_API_KEY": "your-api-key"
44
+ }
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ Replace `your-api-key` with your actual Desearch API key from [console.desearch.ai/api-keys](https://console.desearch.ai/api-keys).
51
+
52
+ ### 3. Restart Cursor IDE
53
+
54
+ For the changes to take effect:
55
+
56
+ 1. Completely quit Cursor IDE
57
+ 2. Start Cursor IDE again
58
+
59
+ ### 1. Configure Claude Desktop to run the Desearch MCP server
60
+
61
+ Open the Claude Desktop app and enable Developer Mode from the top-left menu bar.
62
+
63
+ Once enabled, open Settings (also from the top-left menu bar) and navigate to the Developer Option, where you'll find the Edit Config button. Clicking it will open the `claude_desktop_config.json` file, allowing you to make the necessary edits.
64
+
65
+ OR (if you want to open `claude_desktop_config.json` from terminal)
66
+
67
+ #### For macOS:
68
+
69
+ 1. Open your Claude Desktop config:
70
+
71
+ ```bash
72
+ code ~/Library/Application\ Support/Claude/claude_desktop_config.json
73
+ ```
74
+
75
+ #### For Windows:
76
+
77
+ 1. Open your Claude Desktop configuration:
78
+
79
+ ```powershell
80
+ code %APPDATA%\Claude\claude_desktop_config.json
81
+ ```
82
+
83
+ ### 2. Add the Desearch server configuration:
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "desearch": {
89
+ "command": "desearch-mcp-server",
90
+ "env": {
91
+ "DESEARCH_API_KEY": "your-api-key"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ Replace `your-api-key` with your actual Desearch API key from [console.desearch.ai/api-keys](https://console.desearch.ai/api-keys).
99
+
100
+ ### 3. Restart Claude Desktop
101
+
102
+ For the changes to take effect:
103
+
104
+ 1. Completely quit Claude Desktop
105
+ 2. Start Claude Desktop again
106
+ 3. You can verify the server by checking status in Settings > Developer > desearch
107
+
108
+ ## Troubleshooting 🔧
109
+
110
+ ### Common Issues
111
+
112
+ 1. **Server Not Found**
113
+
114
+ - Check Claude or Cursor Desktop configuration syntax
115
+ - Ensure Node.js is installed
116
+
117
+ 2. **API Key Issues**
118
+
119
+ - Confirm your `DESEARCH_API_KEY` is valid
120
+ - Check the `DESEARCH_API_KEY` is correctly set in the Cursor or Claude Desktop config
121
+ - Verify that there are no spaces around the API key
122
+
123
+ 3. **Connection Issues**
124
+
125
+ - Restart Claude Desktop or Cursor IDE completely
126
+ - Check Claude Desktop logs:
127
+
128
+ ```bash
129
+ # macOS
130
+ tail -n 50 -f ~/Library/Logs/Claude/mcp*.log
131
+
132
+ # Windows
133
+ type "%APPDATA%\Claude\logs\mcp*.log"
134
+ ```
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":""}
package/build/index.js ADDED
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod";
5
+ import Desearch from "desearch-js";
6
+ const server = new McpServer({
7
+ name: "Desearch",
8
+ version: "0.0.1",
9
+ });
10
+ const DESEARCH_API_KEY = process.env.DESEARCH_API_KEY;
11
+ if (!DESEARCH_API_KEY) {
12
+ throw new Error("DESEARCH_API_KEY environment variable is required");
13
+ }
14
+ const desearch = new Desearch(DESEARCH_API_KEY);
15
+ server.tool("ai-search", "Real-time AI search and analysis on web using Desearch AI", {
16
+ prompt: z.string().describe("Question, example: 'What is the latest news on AI?'"),
17
+ tools: z
18
+ .array(z.enum([
19
+ "Twitter Search",
20
+ "Web Search",
21
+ "ArXiv Search",
22
+ "Wikipedia Search",
23
+ "Youtube Search",
24
+ "Hacker News Search",
25
+ "Reddit Search",
26
+ ]))
27
+ .optional()
28
+ .default(["Twitter Search", "Web Search"])
29
+ .describe("Tools to use for the search, example: ['Web Search', 'Twitter Search']"),
30
+ date_filter: z
31
+ .enum([
32
+ "PAST_24_HOURS",
33
+ "PAST_2_DAYS",
34
+ "PAST_WEEK",
35
+ "PAST_2_WEEKS",
36
+ "PAST_MONTH",
37
+ "PAST_2_MONTHS",
38
+ "PAST_YEAR",
39
+ "PAST_2_YEARS",
40
+ ])
41
+ .optional()
42
+ .describe("Time range for the search, example: 'PAST_WEEK'"),
43
+ model: z
44
+ .enum(["NOVA", "ORBIT"])
45
+ .default("NOVA")
46
+ .describe("Model to use for the search, example: 'NOVA', Nova is 10s model, Orbit is 30s model"),
47
+ }, async ({ prompt, tools, date_filter, model }) => {
48
+ try {
49
+ const aiResult = await desearch.AISearch({
50
+ prompt,
51
+ tools,
52
+ date_filter,
53
+ model,
54
+ streaming: false,
55
+ });
56
+ return {
57
+ content: [
58
+ {
59
+ type: "text",
60
+ text: JSON.stringify(aiResult, null, 2),
61
+ },
62
+ ],
63
+ };
64
+ }
65
+ catch (error) {
66
+ return {
67
+ content: [
68
+ {
69
+ type: "text",
70
+ text: `X Search error: ${error instanceof Error ? error.message : String(error)}`,
71
+ },
72
+ ],
73
+ isError: true,
74
+ };
75
+ }
76
+ });
77
+ server.tool("x-search", "Search the X (Twitter) using Desearch AI - performs real-time tweet search on X.", {
78
+ query: z
79
+ .string()
80
+ .describe("Twitter advanced search query, example: 'from:elonmusk since:2023-01-01 min_replies:10'"),
81
+ count: z
82
+ .number()
83
+ .optional()
84
+ .default(20)
85
+ .describe("Number of search results to return (default: 20), max is 100"),
86
+ }, async ({ query, count }) => {
87
+ try {
88
+ const twitterResult = await desearch.twitterSearch({
89
+ query,
90
+ sort: "Top",
91
+ count,
92
+ });
93
+ return {
94
+ content: [
95
+ {
96
+ type: "text",
97
+ text: JSON.stringify(twitterResult, null, 2),
98
+ },
99
+ ],
100
+ };
101
+ }
102
+ catch (error) {
103
+ return {
104
+ content: [
105
+ {
106
+ type: "text",
107
+ text: `X Search error: ${error instanceof Error ? error.message : String(error)}`,
108
+ },
109
+ ],
110
+ isError: true,
111
+ };
112
+ }
113
+ });
114
+ (async () => {
115
+ try {
116
+ // Start receiving messages on stdin and sending messages on stdout
117
+ const transport = new StdioServerTransport();
118
+ await server.connect(transport);
119
+ }
120
+ catch (error) {
121
+ console.log(`Server error: ${error instanceof Error ? error.message : String(error)}`);
122
+ process.exit(1);
123
+ }
124
+ })();
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "desearch-mcp-server",
3
+ "version": "0.0.1",
4
+ "description": "A Model Context Protocol server with Desearch for real-time AI search, X search and web search.",
5
+ "type": "module",
6
+ "author": "Desearch AI",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Desearch-ai/mcp-desearch.git"
10
+ },
11
+ "bin": {
12
+ "desearch-mcp-server": "./build/index.js"
13
+ },
14
+ "files": [
15
+ "build"
16
+ ],
17
+ "keywords": [
18
+ "desearch",
19
+ "mcp",
20
+ "model context protocol",
21
+ "ai",
22
+ "twitter",
23
+ "websearch",
24
+ "claude"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
28
+ "inspector": "npx @modelcontextprotocol/inspector build/index.js",
29
+ "prepare": "npm run build",
30
+ "prepublishOnly": "npm run build"
31
+ },
32
+ "dependencies": {
33
+ "@modelcontextprotocol/sdk": "^1.11.3",
34
+ "desearch-js": "^1.0.1",
35
+ "zod": "^3.24.4"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^20.14.8",
39
+ "typescript": "^5.8.3"
40
+ },
41
+ "engines": {
42
+ "node": ">=18.0.0"
43
+ }
44
+ }