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.

feat: add MCP add_job e2e tests and update README with access note

Khuram Niazbb29afca426a
diff --git a/.gitignore b/.gitignore
index 3390a73..07ad816 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,9 @@ yarn-error.log*
# vercel
.vercel
+# local scripts
+release.sh
+
# typescript
*.tsbuildinfo
next-env.d.ts
diff --git a/README.md b/README.md
index 5a638b8..ab580ac 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,8 @@ cd jobsync
docker compose up
```
+> **Note:** If app is unreachable after container starts, wait for a few minutes before accessing the app in browser.
+
Open [http://localhost:3737](http://localhost:3737) and create your account. That's it!
API keys for AI providers can be configured in **Settings** after signing in.
diff --git a/e2e/fixtures.ts b/e2e/fixtures.ts
index 0edda8c..208092f 100644
--- a/e2e/fixtures.ts
+++ b/e2e/fixtures.ts
@@ -123,6 +123,7 @@ export type CleanupRegistry = {
location: (name: string) => void;
activityType: (name: string) => void;
tag: (name: string) => void;
+ mcpToken: (name: string) => void;
};
type Fixtures = {
@@ -146,6 +147,7 @@ export const test = base.extend<Fixtures>({
const locations: string[] = [];
const activityTypes: string[] = [];
const tags: string[] = [];
+ const mcpTokens: string[] = [];
await use({
job: (id) => jobIds.push(id),
resume: (title) => resumes.push(title),
@@ -155,6 +157,7 @@ export const test = base.extend<Fixtures>({
location: (name) => locations.push(name),
activityType: (name) => activityTypes.push(name),
tag: (name) => tags.push(name),
+ mcpToken: (name) => mcpTokens.push(name),
});
// page.request carries the session cookie; page is still alive here
// because cleanup tears down before the page fixture.
@@ -168,6 +171,7 @@ export const test = base.extend<Fixtures>({
locations,
activityTypes,
tags,
+ mcpTokens,
},
});
if (!res.ok()) {
diff --git a/e2e/mcp-add-job.spec.ts b/e2e/mcp-add-job.spec.ts
new file mode 100644
index 0000000..de7d447
--- /dev/null
+++ b/e2e/mcp-add-job.spec.ts
@@ -0,0 +1,71 @@
+import { Client } from "@modelcontextprotocol/sdk/client/index.js";
+import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
+import { test, expect, uniqueName } from "./fixtures";
+
+// Drives the real MCP protocol: creates a token through the Settings UI,
+// then calls add_job over actual HTTP (JSON-RPC via the MCP SDK client)
+// against the running dev server — exercising auth, routing, and
+// handleAddJob end to end, not just the unit-tested function in isolation.
+test.describe("MCP add_job", () => {
+ test("creates a job via a real MCP tool call", async ({ page, baseURL, cleanup }) => {
+ const tokenName = uniqueName("e2e mcp token");
+ const jobTitle = uniqueName("mcp job title");
+ const company = uniqueName("mcp company");
+
+ await page.goto("/dashboard/settings");
+ await page.getByText("MCP Access").click();
+ await page.getByRole("button", { name: "Generate" }).click();
+ await page.getByPlaceholder("e.g. Claude Desktop").fill(tokenName);
+ await page.getByRole("button", { name: "Generate" }).click();
+ cleanup.mcpToken(tokenName);
+
+ const revealDialog = page.getByRole("dialog", { name: "Token Created" });
+ await expect(revealDialog).toBeVisible();
+ const token = await revealDialog.getByRole("textbox").inputValue();
+ expect(token).toMatch(/^jsync_/);
+ await page.getByRole("button", { name: "I saved my token" }).click();
+
+ const transport = new StreamableHTTPClientTransport(
+ new URL("/api/mcp", baseURL),
+ { requestInit: { headers: { Authorization: `Bearer ${token}` } } },
+ );
+ const client = new Client({ name: "e2e-test-client", version: "1.0.0" });
+ await client.connect(transport);
+
+ const result = await client.callTool({
+ name: "add_job",
+ arguments: {
+ company,
+ jobTitle,
+ jobDescription:
+ "We are hiring a software engineer to build and maintain our core platform, work closely with product and design, and ship features end to end.",
+ location: "Remote",
+ },
+ });
+ await client.close();
+
+ const text = (result.content as Array<{ type: string; text?: string }>)
+ .map((c) => c.text ?? "")
+ .join("\n");
+ expect(text).toContain("Job created");
+
+ const jobId = text.match(/Job created \(id: ([^)]+)\)/)?.[1];
+ expect(jobId).toBeTruthy();
+ cleanup.job(jobId!);
+ cleanup.title(jobTitle);
+ cleanup.company(company);
+
+ await page.goto("/dashboard/myjobs");
+ await expect(page.getByRole("row", { name: jobTitle }).first()).toBeVisible();
+ });
+
+ test("rejects a tool call with an invalid token", async ({ baseURL }) => {
+ const transport = new StreamableHTTPClientTransport(
+ new URL("/api/mcp", baseURL),
+ { requestInit: { headers: { Authorization: "Bearer jsync_not-a-real-token" } } },
+ );
+ const client = new Client({ name: "e2e-test-client", version: "1.0.0" });
+
+ await expect(client.connect(transport)).rejects.toThrow();
+ });
+});
diff --git a/src/app/api/test/cleanup/route.ts b/src/app/api/test/cleanup/route.ts
index 79c61e3..111d92f 100644
--- a/src/app/api/test/cleanup/route.ts
+++ b/src/app/api/test/cleanup/route.ts
@@ -27,6 +27,7 @@ export async function POST(req: NextRequest) {
locations = [],
activityTypes = [],
tags = [],
+ mcpTokens = [],
}: {
jobIds?: string[];
resumes?: string[];
@@ -36,6 +37,7 @@ export async function POST(req: NextRequest) {
locations?: string[];
activityTypes?: string[];
tags?: string[];
+ mcpTokens?: string[];
} = await req.json();
// Delete jobs, resumes and tasks first (they/their sections reference the
@@ -73,6 +75,11 @@ export async function POST(req: NextRequest) {
await deleteLibraryByName("location", locations, userId);
await deleteLibraryByName("activityType", activityTypes, userId);
await deleteTagsByName(tags, userId);
+ if (mcpTokens.length > 0) {
+ await prisma.mcpAccessToken.deleteMany({
+ where: { name: { in: mcpTokens }, userId },
+ });
+ }
return NextResponse.json({ success: true });
}
diff --git a/src/components/automations/RunHistoryList.tsx b/src/components/automations/RunHistoryList.tsx
index 03a0aa7..e278ced 100644
--- a/src/components/automations/RunHistoryList.tsx
+++ b/src/components/automations/RunHistoryList.tsx
@@ -237,23 +237,12 @@ export function RunHistoryList({
</TableCell>
<TableCell>
{(run.errorMessage || run.blockedReason) && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger>
- <Badge
- variant="outline"
- className="max-w-[150px] truncate"
- >
- {run.blockedReason || run.errorMessage}
- </Badge>
- </TooltipTrigger>
- <TooltipContent>
- <p className="max-w-xs">
- {run.blockedReason || run.errorMessage}
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <Badge
+ variant="outline"
+ className="max-w-md whitespace-normal"
+ >
+ {run.blockedReason || run.errorMessage}
+ </Badge>
)}
</TableCell>
<TableCell>
diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsx
index 8a80720..e30a406 100644
--- a/src/components/myjobs/JobDetails.tsx
+++ b/src/components/myjobs/JobDetails.tsx
@@ -270,7 +270,7 @@ function JobDetails({
: null}
</div>
</CardHeader>
- <h3 className="ml-4">
+ <h3 className="ml-4 flex flex-wrap items-center gap-2">
{job.dueDate && new Date() > job.dueDate && currentStatus?.value === "draft" ? (
<StatusBadge
label="Expired"
@@ -284,9 +284,15 @@ function JobDetails({
className="w-[70px] justify-center"
/>
)}
- <span className="ml-2">
- {job?.appliedDate ? format(new Date(job?.appliedDate), "PP") : ""}
- </span>
+ {job?.appliedDate && (
+ <span>{format(new Date(job.appliedDate), "PP")}</span>
+ )}
+ {job.createdVia && (
+ <Badge className="gap-1 bg-violet-500 dark:bg-violet-400">
+ <Sparkles className="h-3.5 w-3.5" />
+ via {job.createdVia}
+ </Badge>
+ )}
</h3>
{job.tags && job.tags.length > 0 && (
<div className="my-3 ml-4 flex flex-wrap gap-1">
@@ -297,13 +303,6 @@ function JobDetails({
))}
</div>
)}
- {job.createdVia && (
- <div className="my-1 ml-4">
- <Badge variant="outline" className="text-xs text-muted-foreground">
- via {job.createdVia}
- </Badge>
- </div>
- )}
{job.jobUrl && (
<div className="my-3 ml-4">
<span className="font-semibold mr-2">Job URL:</span>