@breaknorm_hu/mcp-server 0.1.1 → 0.1.3
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/dist/index.js +29 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var BreakNormClient = class {
|
|
|
10
10
|
apiKey;
|
|
11
11
|
constructor(apiKey, baseUrl) {
|
|
12
12
|
this.apiKey = apiKey;
|
|
13
|
-
this.baseUrl = (baseUrl || "https://breaknorm.
|
|
13
|
+
this.baseUrl = (baseUrl || "https://breaknorm.hu").replace(/\/$/, "");
|
|
14
14
|
}
|
|
15
15
|
async request(method, path, options) {
|
|
16
16
|
const url = new URL(`/api/v1${path}`, this.baseUrl);
|
|
@@ -123,9 +123,32 @@ var tools = [
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
name: "get_search_filters",
|
|
126
|
-
description: "Get
|
|
127
|
-
schema: z.object({
|
|
128
|
-
|
|
126
|
+
description: "Get available filter values with counts. Call this FIRST before searching. Returns top values per category (max 50 each to keep response small).",
|
|
127
|
+
schema: z.object({
|
|
128
|
+
category: z.enum(["all", "industries", "cities", "counties", "seniorities", "departments", "companyTypes"]).default("all").optional().describe("Which filter category to fetch. Use 'all' for overview (top 20 each) or a specific category for full list (top 50).")
|
|
129
|
+
}),
|
|
130
|
+
handler: async (client, args) => {
|
|
131
|
+
const result = await client.get("/search/filters");
|
|
132
|
+
const data = result.data;
|
|
133
|
+
const cat = args.category || "all";
|
|
134
|
+
const limit = cat === "all" ? 20 : 50;
|
|
135
|
+
if (cat !== "all" && data[cat]) {
|
|
136
|
+
return { data: { [cat]: data[cat].slice(0, limit) } };
|
|
137
|
+
}
|
|
138
|
+
const trimmed = {};
|
|
139
|
+
for (const [key, values] of Object.entries(data)) {
|
|
140
|
+
if (Array.isArray(values)) {
|
|
141
|
+
trimmed[key] = values.slice(0, limit);
|
|
142
|
+
if (values.length > limit) {
|
|
143
|
+
trimmed[`${key}_total`] = values.length;
|
|
144
|
+
trimmed[`${key}_note`] = `Showing top ${limit} of ${values.length}. Use category="${key}" for more.`;
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
trimmed[key] = values;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return { data: trimmed };
|
|
151
|
+
}
|
|
129
152
|
},
|
|
130
153
|
{
|
|
131
154
|
name: "get_contact",
|
|
@@ -294,10 +317,10 @@ async function main() {
|
|
|
294
317
|
const apiKey = process.env.BREAKNORM_API_KEY;
|
|
295
318
|
if (!apiKey) {
|
|
296
319
|
console.error("Error: BREAKNORM_API_KEY environment variable is required.");
|
|
297
|
-
console.error("Get your API key at https://breaknorm.
|
|
320
|
+
console.error("Get your API key at https://breaknorm.hu/app/settings/developers");
|
|
298
321
|
process.exit(1);
|
|
299
322
|
}
|
|
300
|
-
const baseUrl = process.env.BREAKNORM_BASE_URL || "https://breaknorm.
|
|
323
|
+
const baseUrl = process.env.BREAKNORM_BASE_URL || "https://breaknorm.hu";
|
|
301
324
|
const client = new BreakNormClient(apiKey, baseUrl);
|
|
302
325
|
const server = new McpServer({
|
|
303
326
|
name: SERVER_NAME,
|