@foundrole/ai-job-search-mcp
Version:
Run your job search from your AI assistant. Connect FoundRole to Claude, ChatGPT, Cursor, or any MCP client and search live jobs right away — no sign-up. Sign in once (your AI does it for you) to save and track applications on a Kanban board, set follow-u
66 lines • 2.56 kB
JavaScript
import fs from "node:fs";
import path from "node:path";
// Find package.json by trying multiple search strategies
export function findPackageJson() {
// Strategy 1: Try current working directory (works for local development)
const cwdPath = path.resolve(process.cwd(), "package.json");
if (fs.existsSync(cwdPath)) {
return cwdPath;
}
// Strategy 2: Traverse up from current working directory
let currentDir = process.cwd();
while (currentDir !== path.dirname(currentDir)) {
const pkgPath = path.join(currentDir, "package.json");
if (fs.existsSync(pkgPath)) {
return pkgPath;
}
currentDir = path.dirname(currentDir);
}
// Strategy 3: Try common global installation paths relative to process.argv[1] (the script path)
if (process.argv[1]) {
let scriptDir = path.dirname(process.argv[1]);
// Go up from the script location to find package.json
while (scriptDir !== path.dirname(scriptDir)) {
const pkgPath = path.join(scriptDir, "package.json");
if (fs.existsSync(pkgPath)) {
return pkgPath;
}
scriptDir = path.dirname(scriptDir);
}
}
// Fallback: Use hardcoded values if package.json cannot be found
throw new Error("package.json not found - using fallback values");
}
export function getPackageInfo() {
try {
const pkgJsonPath = findPackageJson();
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
// Return only name and version, fall back to defaults if missing
if (!pkg.name || !pkg.version) {
return {
name: "@foundrole/ai-job-search-mcp",
version: "1.0.0",
};
}
return {
name: pkg.name,
version: pkg.version,
};
}
catch {
// Fallback to hardcoded values when package.json cannot be found
return {
name: "@foundrole/ai-job-search-mcp",
version: "1.0.0",
};
}
}
const pkg = getPackageInfo();
export const PROXY_NAME = pkg.name;
export const PROXY_VERSION = pkg.version;
export const USER_AGENT = `${PROXY_NAME}/${PROXY_VERSION}`;
// Informational only — the @modelcontextprotocol/sdk Client/Server negotiate
// the actual protocol version on connect. Kept current with what the FoundRole
// server (jobs-back) supports: 2025-11-25, 2025-06-18, 2025-03-26.
export const MCP_PROTOCOL_VERSION = "2025-06-18";
//# sourceMappingURL=constants.js.map