Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

fix: MCP issues related to homelab & missing details

Khuram Niaz154c39803100
diff --git a/README.md b/README.md
index 4840efc..0b98034 100644
--- a/README.md
+++ b/README.md
@@ -79,6 +79,76 @@ curl -fsSL https://raw.githubusercontent.com/Gsync/jobsync/main/deploy.sh | sudo
>Note: If you are updating in a homelab environment, edit `NEXTAUTH_URL` in your `.env` file to use your server IP address instead of `localhost`. See `.env.example` for the expected format.
+## MCP Server (AI Agent Integration)
+
+JobSync exposes an [MCP](https://modelcontextprotocol.io) server so AI agents (Claude Desktop, Hermes, OpenClaw, etc.) can add job applications and Question Bank entries directly, with your approval.
+
+### Use Case
+
+Browsing a job posting or reading an interview question elsewhere and don't want to break your flow to log it manually? Just ask your connected AI agent, for example:
+
+- *"Add this job to JobSync (copy/paste the complete job details or try providing a link): Senior Backend Engineer at Acme Corp, JobType, location, Job description... "*
+- *"I just got asked this in an interview — add it to my Question Bank: 'How would you design a rate limiter?' with my answer: ..."*
+
+The agent resolves or creates the company, title, location, and tags by name, and reports back what it matched versus created — so your data stays de-duplicated without you having to switch to the app.
+
+### 1. Generate a token
+
+1. Sign in to JobSync and go to **Settings > MCP Access**.
+2. Click **Generate**, give it a name (e.g. the client you'll connect, like "Claude Desktop"), and pick an expiry.
+3. Copy the token and config snippets shown — the full token is only displayed once.
+
+### 2. Add it to your MCP client
+
+<details>
+<summary><strong>Claude Desktop</strong></summary>
+
+1. Open Claude Desktop → **Settings > Developer > Edit Config**. This opens `claude_desktop_config.json` in your default editor.
+2. Paste the "Claude Desktop (via mcp-remote)" snippet from the reveal dialog into `mcpServers`, e.g.:
+
+```json
+{
+ "mcpServers": {
+ "jobsync": {
+ "command": "npx",
+ "args": [
+ "mcp-remote",
+ "http://<your-jobsync-url>/api/mcp",
+ "--header",
+ "Authorization: Bearer <your-token>"
+ ]
+ }
+ }
+}
+```
+
+3. Save and fully restart Claude Desktop (quit, not just close the window).
+
+> **Note:** Claude Desktop only supports local (stdio) MCP servers directly, so `mcp-remote` is required as a bridge to JobSync's remote endpoint.
+
+</details>
+
+<details>
+<summary><strong>Other clients (OpenClaw, Hermes, etc.)</strong></summary>
+
+Clients that support `streamable-http` natively can connect directly without `mcp-remote`:
+
+```json
+{
+ "mcpServers": {
+ "jobsync": {
+ "type": "streamable-http",
+ "url": "http://<your-jobsync-url>/api/mcp",
+ "headers": { "Authorization": "Bearer <your-token>" }
+ }
+ }
+}
+```
+
+</details>
+
+> **Self-hosting on a home network?** If your JobSync URL is a plain `http://` LAN address (not `localhost` or HTTPS), add `--allow-http` to the `mcp-remote` args — it refuses non-HTTPS URLs by default. The Settings page adds this flag automatically when it detects a non-localhost HTTP URL.
+
## Contributing
We welcome contributions! Please read our [Contributing Guidelines](./CONTRIBUTING.md) to get started. This project follows a [Code of Conduct](./CODE_OF_CONDUCT.md) — by participating, you agree to uphold its standards.
diff --git a/docker-compose.yml b/docker-compose.yml
index a9268ba..503f881 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -6,6 +6,7 @@ services:
- "3737:3737"
environment:
- NODE_ENV=production
+ - MCP_ENABLED=${MCP_ENABLED:-true}
- DATABASE_URL=file:/data/dev.db
- AUTH_SECRET=${AUTH_SECRET:-your-auth-secret}
- ENCRYPTION_KEY=${ENCRYPTION_KEY:-you-encryption-key-here}
diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsx
index 8da78e3..87b103e 100644
--- a/src/components/myjobs/JobDetails.tsx
+++ b/src/components/myjobs/JobDetails.tsx
@@ -267,7 +267,7 @@ function JobDetails({
</div>
</CardHeader>
<h3 className="ml-4">
- {new Date() > job.dueDate && currentStatus?.value === "draft" ? (
+ {job.dueDate && new Date() > job.dueDate && currentStatus?.value === "draft" ? (
<StatusBadge
label="Expired"
color="amber"
diff --git a/src/components/myjobs/MyJobsTable.tsx b/src/components/myjobs/MyJobsTable.tsx
index 007e832..f263bd8 100644
--- a/src/components/myjobs/MyJobsTable.tsx
+++ b/src/components/myjobs/MyJobsTable.tsx
@@ -134,7 +134,7 @@ function MyJobsTable({
>
Dismissed
</Badge>
- ) : new Date() > job.dueDate && job.Status?.value === "draft" ? (
+ ) : job.dueDate && new Date() > job.dueDate && job.Status?.value === "draft" ? (
<StatusBadge
label="Expired"
color="amber"
diff --git a/src/components/settings/McpAccessSettings.tsx b/src/components/settings/McpAccessSettings.tsx
index 6998ff8..5edecde 100644
--- a/src/components/settings/McpAccessSettings.tsx
+++ b/src/components/settings/McpAccessSettings.tsx
@@ -45,10 +45,18 @@ import { format } from "date-fns";
function CopyButton({ text }: { text: string }) {
const [copied, setCopied] = useState(false);
- const copy = () => {
- navigator.clipboard.writeText(text);
- setCopied(true);
- setTimeout(() => setCopied(false), 2000);
+ const copy = async () => {
+ try {
+ await navigator.clipboard.writeText(text);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ } catch {
+ toast({
+ title: "Copy failed",
+ description: "Couldn't copy to clipboard. Please copy the text manually.",
+ variant: "destructive",
+ });
+ }
};
return (
<Button variant="outline" size="sm" onClick={copy} className="shrink-0">
@@ -94,7 +102,18 @@ function TokenRevealDialog({
2,
);
- const claudeSnippet = `npx mcp-remote ${mcpUrl} --header "Authorization: Bearer ${token}"`;
+ const isInsecureNonLocalhost = (() => {
+ try {
+ const { protocol, hostname } = new URL(mcpUrl);
+ return protocol === "http:" && hostname !== "localhost" && hostname !== "127.0.0.1";
+ } catch {
+ return false;
+ }
+ })();
+
+ const claudeSnippet = `npx mcp-remote ${mcpUrl} --header "Authorization: Bearer ${token}"${
+ isInsecureNonLocalhost ? " --allow-http" : ""
+ }`;
return (
<Dialog open onOpenChange={(open) => !open && onClose()}>
diff --git a/src/lib/jobs/resolve.ts b/src/lib/jobs/resolve.ts
index 71503d8..cc2cdd3 100644
--- a/src/lib/jobs/resolve.ts
+++ b/src/lib/jobs/resolve.ts
@@ -122,10 +122,15 @@ export async function resolveTags(
// Bucket B — resolve-ONLY, never create
export function resolveJobType(input?: string): string {
- if (!input) return "Full-time";
- const valid = Object.values(JOB_TYPES) as string[];
- const match = valid.find((v) => v.toLowerCase() === input.toLowerCase());
- if (match) return match;
+ const entries = Object.entries(JOB_TYPES) as [string, string][];
+ if (!input) return entries[0][0];
+ const match = entries.find(
+ ([key, value]) =>
+ key.toLowerCase() === input.toLowerCase() ||
+ value.toLowerCase() === input.toLowerCase(),
+ );
+ if (match) return match[0];
+ const valid = entries.map(([, value]) => value);
throw new Error(`Invalid jobType "${input}". Valid values: ${valid.join(", ")}`);
}