@queryhere/mcp-server 1.0.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.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/index.js +149 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 JeromeBillion
|
|
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,60 @@
|
|
|
1
|
+
# Query Here MCP Server
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server that gives Claude Desktop, Cursor, and other MCP clients access to Query Here search.
|
|
4
|
+
|
|
5
|
+
## Install (users)
|
|
6
|
+
|
|
7
|
+
Add to your MCP config (`claude_desktop_config.json` or Cursor MCP settings):
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"queryhere": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "@queryhere/mcp-server"],
|
|
15
|
+
"env": {
|
|
16
|
+
"QUERY_HERE_API_KEY": "qh_live_..."
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Create a free API key at [queryhere.com](https://www.queryhere.com).
|
|
24
|
+
|
|
25
|
+
### Environment variables
|
|
26
|
+
|
|
27
|
+
| Variable | Required | Default |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| `QUERY_HERE_API_KEY` | Yes | — |
|
|
30
|
+
| `QUERY_HERE_API_URL` | No | `https://api.queryhere.com` |
|
|
31
|
+
| `QUERY_HERE_TIMEOUT_MS` | No | `30000` |
|
|
32
|
+
|
|
33
|
+
## Local development
|
|
34
|
+
|
|
35
|
+
```powershell
|
|
36
|
+
cd mcp
|
|
37
|
+
npm install
|
|
38
|
+
npm run build
|
|
39
|
+
$env:QUERY_HERE_API_KEY="qh_live_..."
|
|
40
|
+
$env:QUERY_HERE_API_URL="http://localhost:3000"
|
|
41
|
+
npm start
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Publish checklist (maintainers)
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
cd mcp
|
|
48
|
+
npm whoami
|
|
49
|
+
npm run build
|
|
50
|
+
npm pack --dry-run
|
|
51
|
+
npm publish --access public
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Verify after publish:
|
|
55
|
+
|
|
56
|
+
```powershell
|
|
57
|
+
npx -y @queryhere/mcp-server
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The server expects stdio MCP transport and will exit immediately if `QUERY_HERE_API_KEY` is not set.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
const QUERY_HERE_API_KEY = process.env.QUERY_HERE_API_KEY;
|
|
7
|
+
const QUERY_HERE_API_URL = process.env.QUERY_HERE_API_URL || "https://api.queryhere.com";
|
|
8
|
+
const QUERY_HERE_TIMEOUT_MS = Number(process.env.QUERY_HERE_TIMEOUT_MS || 30000);
|
|
9
|
+
if (!QUERY_HERE_API_KEY) {
|
|
10
|
+
console.error("Error: QUERY_HERE_API_KEY environment variable is required");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
let API_URL;
|
|
14
|
+
try {
|
|
15
|
+
const parsedApiUrl = new URL(QUERY_HERE_API_URL);
|
|
16
|
+
if (parsedApiUrl.protocol !== "https:" && parsedApiUrl.protocol !== "http:") {
|
|
17
|
+
throw new Error("QUERY_HERE_API_URL must use http or https");
|
|
18
|
+
}
|
|
19
|
+
API_URL = parsedApiUrl.toString().replace(/\/$/, "");
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error(`Error: invalid QUERY_HERE_API_URL: ${error.message}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
if (!Number.isFinite(QUERY_HERE_TIMEOUT_MS) || QUERY_HERE_TIMEOUT_MS < 1000) {
|
|
26
|
+
console.error("Error: QUERY_HERE_TIMEOUT_MS must be a number greater than or equal to 1000");
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
const searchArgumentsSchema = z.object({
|
|
30
|
+
query: z.string().trim().min(3).max(240),
|
|
31
|
+
mode: z.enum(["hybrid", "catalog_only", "live_only"]).default("hybrid"),
|
|
32
|
+
limit: z.coerce.number().int().min(1).max(50).default(10),
|
|
33
|
+
});
|
|
34
|
+
const server = new Server({
|
|
35
|
+
name: "queryhere-search",
|
|
36
|
+
version: "1.0.0",
|
|
37
|
+
}, {
|
|
38
|
+
capabilities: {
|
|
39
|
+
tools: {},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
// Define the single tool
|
|
43
|
+
const SEARCH_TOOL = {
|
|
44
|
+
name: "search_query_here",
|
|
45
|
+
description: "Searches the web and the Query Here registry for actionable APIs, CLIs, MCP servers, and websites. Use this to find external capabilities and tools that you can integrate with or direct the user to.",
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: "object",
|
|
48
|
+
properties: {
|
|
49
|
+
query: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "The natural language search query (e.g., 'find an MCP server for browser automation' or 'book a flight').",
|
|
52
|
+
},
|
|
53
|
+
mode: {
|
|
54
|
+
type: "string",
|
|
55
|
+
enum: ["hybrid", "catalog_only", "live_only"],
|
|
56
|
+
default: "hybrid",
|
|
57
|
+
description: "Search mode to use. Hybrid is recommended for broad discovery.",
|
|
58
|
+
},
|
|
59
|
+
limit: {
|
|
60
|
+
type: "number",
|
|
61
|
+
minimum: 1,
|
|
62
|
+
maximum: 50,
|
|
63
|
+
default: 10,
|
|
64
|
+
description: "Maximum number of results to return (default: 10).",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
required: ["query"],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
71
|
+
return {
|
|
72
|
+
tools: [SEARCH_TOOL],
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
76
|
+
if (request.params.name !== "search_query_here") {
|
|
77
|
+
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
78
|
+
}
|
|
79
|
+
const parsedArguments = searchArgumentsSchema.safeParse(request.params.arguments ?? {});
|
|
80
|
+
if (!parsedArguments.success) {
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: "text",
|
|
85
|
+
text: `Invalid search_query_here arguments: ${JSON.stringify(parsedArguments.error.flatten(), null, 2)}`,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
isError: true,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const { query, mode, limit } = parsedArguments.data;
|
|
92
|
+
try {
|
|
93
|
+
const response = await fetch(`${API_URL}/v1/search`, {
|
|
94
|
+
method: "POST",
|
|
95
|
+
headers: {
|
|
96
|
+
"Content-Type": "application/json",
|
|
97
|
+
"x-api-key": QUERY_HERE_API_KEY,
|
|
98
|
+
"User-Agent": "QueryHere-MCP-Server/1.0",
|
|
99
|
+
},
|
|
100
|
+
body: JSON.stringify({
|
|
101
|
+
query,
|
|
102
|
+
mode,
|
|
103
|
+
limit,
|
|
104
|
+
}),
|
|
105
|
+
signal: AbortSignal.timeout(QUERY_HERE_TIMEOUT_MS),
|
|
106
|
+
});
|
|
107
|
+
if (!response.ok) {
|
|
108
|
+
const errorText = await response.text();
|
|
109
|
+
return {
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
type: "text",
|
|
113
|
+
text: `Search API failed with status ${response.status}: ${errorText}`,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
isError: true,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const data = await response.json();
|
|
120
|
+
return {
|
|
121
|
+
content: [
|
|
122
|
+
{
|
|
123
|
+
type: "text",
|
|
124
|
+
text: JSON.stringify(data, null, 2),
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
return {
|
|
131
|
+
content: [
|
|
132
|
+
{
|
|
133
|
+
type: "text",
|
|
134
|
+
text: `An error occurred during search: ${error.message}`,
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
isError: true,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
async function run() {
|
|
142
|
+
const transport = new StdioServerTransport();
|
|
143
|
+
await server.connect(transport);
|
|
144
|
+
console.error("Query Here MCP Server running on stdio");
|
|
145
|
+
}
|
|
146
|
+
run().catch((error) => {
|
|
147
|
+
console.error("Fatal error running server:", error);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@queryhere/mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "An MCP Server for searching the Query Here registry and the live web for actionable AI tools.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"queryhere-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"prepublishOnly": "npm run build",
|
|
18
|
+
"start": "node dist/index.js",
|
|
19
|
+
"dev": "tsx src/index.ts"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
23
|
+
"zod": "^3.22.4"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^20.11.16",
|
|
27
|
+
"tsx": "^4.7.0",
|
|
28
|
+
"typescript": "^5.3.3"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"queryhere",
|
|
32
|
+
"mcp",
|
|
33
|
+
"model-context-protocol",
|
|
34
|
+
"ai-agents",
|
|
35
|
+
"service-discovery",
|
|
36
|
+
"cursor",
|
|
37
|
+
"claude-desktop"
|
|
38
|
+
],
|
|
39
|
+
"homepage": "https://www.queryhere.com",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/JeromeBillion/QueryHere.com.git",
|
|
43
|
+
"directory": "mcp"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/JeromeBillion/QueryHere.com/issues"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=20"
|
|
53
|
+
},
|
|
54
|
+
"license": "MIT"
|
|
55
|
+
}
|