trackly-cli 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/lib/client.js +3 -3
- package/mcp/server.js +11 -9
- package/package.json +2 -1
package/lib/client.js
CHANGED
|
@@ -63,7 +63,7 @@ async function refreshAccessToken() {
|
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
function apiRequest(method, endpoint, data = null, skipAuth = false, _isRetry = false) {
|
|
66
|
+
function apiRequest(method, endpoint, data = null, skipAuth = false, _isRetry = false, userAgent = null) {
|
|
67
67
|
return new Promise((resolve, reject) => {
|
|
68
68
|
const baseUrl = getBaseUrl();
|
|
69
69
|
const url = new URL(endpoint, baseUrl);
|
|
@@ -73,7 +73,7 @@ function apiRequest(method, endpoint, data = null, skipAuth = false, _isRetry =
|
|
|
73
73
|
const headers = {
|
|
74
74
|
'Content-Type': 'application/json',
|
|
75
75
|
'Accept': 'application/json',
|
|
76
|
-
'User-Agent': 'trackly-cli/0.1.
|
|
76
|
+
'User-Agent': userAgent || 'trackly-cli/0.1.3',
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
if (!skipAuth) {
|
|
@@ -101,7 +101,7 @@ function apiRequest(method, endpoint, data = null, skipAuth = false, _isRetry =
|
|
|
101
101
|
const newToken = await refreshAccessToken();
|
|
102
102
|
if (newToken) {
|
|
103
103
|
try {
|
|
104
|
-
const retried = await apiRequest(method, endpoint, data, false, true);
|
|
104
|
+
const retried = await apiRequest(method, endpoint, data, false, true, userAgent);
|
|
105
105
|
return resolve(retried);
|
|
106
106
|
} catch (e) { return reject(e); }
|
|
107
107
|
}
|
package/mcp/server.js
CHANGED
|
@@ -5,9 +5,11 @@ const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio
|
|
|
5
5
|
const { z } = require('zod');
|
|
6
6
|
const { apiRequest, getToken } = require('../lib/client');
|
|
7
7
|
|
|
8
|
+
const MCP_USER_AGENT = 'trackly-mcp/0.1.3';
|
|
9
|
+
|
|
8
10
|
const server = new McpServer({
|
|
9
11
|
name: 'trackly',
|
|
10
|
-
version: '0.1.
|
|
12
|
+
version: '0.1.3',
|
|
11
13
|
});
|
|
12
14
|
|
|
13
15
|
// Tool: Search/filter jobs
|
|
@@ -30,7 +32,7 @@ server.tool(
|
|
|
30
32
|
if (v !== undefined && v !== null) qs.set(k, String(v));
|
|
31
33
|
}
|
|
32
34
|
try {
|
|
33
|
-
const result = await apiRequest('GET', `/api/jobscout/jobs?${qs.toString()}
|
|
35
|
+
const result = await apiRequest('GET', `/api/jobscout/jobs?${qs.toString()}`, null, false, false, MCP_USER_AGENT);
|
|
34
36
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
35
37
|
} catch (e) {
|
|
36
38
|
return { content: [{ type: 'text', text: JSON.stringify({ error: e.error || e.message }) }], isError: true };
|
|
@@ -47,7 +49,7 @@ server.tool(
|
|
|
47
49
|
},
|
|
48
50
|
async ({ id }) => {
|
|
49
51
|
try {
|
|
50
|
-
const result = await apiRequest('GET', `/api/jobscout/jobs/${id}
|
|
52
|
+
const result = await apiRequest('GET', `/api/jobscout/jobs/${id}`, null, false, false, MCP_USER_AGENT);
|
|
51
53
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
52
54
|
} catch (e) {
|
|
53
55
|
return { content: [{ type: 'text', text: JSON.stringify({ error: e.error || e.message }) }], isError: true };
|
|
@@ -67,7 +69,7 @@ server.tool(
|
|
|
67
69
|
const qs = new URLSearchParams({ q: query });
|
|
68
70
|
if (limit) qs.set('limit', String(limit));
|
|
69
71
|
try {
|
|
70
|
-
const result = await apiRequest('GET', `/api/jobscout/companies/search?${qs.toString()}
|
|
72
|
+
const result = await apiRequest('GET', `/api/jobscout/companies/search?${qs.toString()}`, null, false, false, MCP_USER_AGENT);
|
|
71
73
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
72
74
|
} catch (e) {
|
|
73
75
|
return { content: [{ type: 'text', text: JSON.stringify({ error: e.error || e.message }) }], isError: true };
|
|
@@ -88,7 +90,7 @@ server.tool(
|
|
|
88
90
|
if (limit) qs.set('limit', String(limit));
|
|
89
91
|
if (offset) qs.set('offset', String(offset));
|
|
90
92
|
try {
|
|
91
|
-
const result = await apiRequest('GET', `/api/jobscout/companies?${qs.toString()}
|
|
93
|
+
const result = await apiRequest('GET', `/api/jobscout/companies?${qs.toString()}`, null, false, false, MCP_USER_AGENT);
|
|
92
94
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
93
95
|
} catch (e) {
|
|
94
96
|
return { content: [{ type: 'text', text: JSON.stringify({ error: e.error || e.message }) }], isError: true };
|
|
@@ -103,7 +105,7 @@ server.tool(
|
|
|
103
105
|
{},
|
|
104
106
|
async () => {
|
|
105
107
|
try {
|
|
106
|
-
const result = await apiRequest('GET', '/api/jobscout/me');
|
|
108
|
+
const result = await apiRequest('GET', '/api/jobscout/me', null, false, false, MCP_USER_AGENT);
|
|
107
109
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
108
110
|
} catch (e) {
|
|
109
111
|
return { content: [{ type: 'text', text: JSON.stringify({ error: e.error || e.message }) }], isError: true };
|
|
@@ -121,7 +123,7 @@ server.tool(
|
|
|
121
123
|
},
|
|
122
124
|
async ({ id, action }) => {
|
|
123
125
|
try {
|
|
124
|
-
const result = await apiRequest('POST', '/api/jobscout-tracker/status', { jobId: id, action });
|
|
126
|
+
const result = await apiRequest('POST', '/api/jobscout-tracker/status', { jobId: id, action }, false, false, MCP_USER_AGENT);
|
|
125
127
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
126
128
|
} catch (e) {
|
|
127
129
|
return { content: [{ type: 'text', text: JSON.stringify({ error: e.error || e.message }) }], isError: true };
|
|
@@ -138,10 +140,10 @@ server.tool(
|
|
|
138
140
|
},
|
|
139
141
|
async ({ query }) => {
|
|
140
142
|
try {
|
|
141
|
-
const askResult = await apiRequest('GET', `/api/jobscout/ask?q=${encodeURIComponent(query)}
|
|
143
|
+
const askResult = await apiRequest('GET', `/api/jobscout/ask?q=${encodeURIComponent(query)}`, null, false, false, MCP_USER_AGENT);
|
|
142
144
|
// Auto-fetch jobs with parsed filters
|
|
143
145
|
if (askResult.jobsUrl && askResult.jobsUrl.startsWith('/api/')) {
|
|
144
|
-
const jobsResult = await apiRequest('GET', askResult.jobsUrl);
|
|
146
|
+
const jobsResult = await apiRequest('GET', askResult.jobsUrl, null, false, false, MCP_USER_AGENT);
|
|
145
147
|
return { content: [{ type: 'text', text: JSON.stringify({ ...askResult, jobs: jobsResult.jobs || jobsResult.data || [] }, null, 2) }] };
|
|
146
148
|
}
|
|
147
149
|
return { content: [{ type: 'text', text: JSON.stringify(askResult, null, 2) }] };
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trackly-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"mcpName": "io.github.kevinastuhuaman/trackly",
|
|
4
5
|
"description": "CLI + MCP server for job tracking — search, apply, and manage applications from terminal or AI agents",
|
|
5
6
|
"bin": {
|
|
6
7
|
"trackly": "./bin/trackly"
|