@fruition/fcp-mcp-server 1.2.0 → 1.3.0
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 +74 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,6 +10,29 @@
|
|
|
10
10
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
11
11
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
12
12
|
import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
13
|
+
import { readFileSync } from 'fs';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
import { dirname, join } from 'path';
|
|
16
|
+
// Get version from package.json
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
+
const __dirname = dirname(__filename);
|
|
19
|
+
const packageJsonPath = join(__dirname, '..', 'package.json');
|
|
20
|
+
let MCP_SERVER_VERSION = '1.0.0'; // fallback
|
|
21
|
+
try {
|
|
22
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
23
|
+
MCP_SERVER_VERSION = packageJson.version;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Try one level up (for dist folder)
|
|
27
|
+
try {
|
|
28
|
+
const altPath = join(__dirname, '..', '..', 'package.json');
|
|
29
|
+
const packageJson = JSON.parse(readFileSync(altPath, 'utf-8'));
|
|
30
|
+
MCP_SERVER_VERSION = packageJson.version;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
console.error('[MCP Server] Warning: Could not read package.json version');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
13
36
|
// Configuration
|
|
14
37
|
const FCP_API_URL = process.env.FCP_API_URL || 'https://fcp.fru.io';
|
|
15
38
|
const FCP_API_TOKEN = process.env.FCP_API_TOKEN || '';
|
|
@@ -283,7 +306,7 @@ class SessionTracker {
|
|
|
283
306
|
// Create server
|
|
284
307
|
const server = new Server({
|
|
285
308
|
name: 'fcp-mcp-server',
|
|
286
|
-
version:
|
|
309
|
+
version: MCP_SERVER_VERSION,
|
|
287
310
|
}, {
|
|
288
311
|
capabilities: {
|
|
289
312
|
tools: {},
|
|
@@ -990,11 +1013,60 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
|
990
1013
|
}
|
|
991
1014
|
throw new Error(`Unknown resource: ${uri}`);
|
|
992
1015
|
});
|
|
1016
|
+
// Version comparison helper
|
|
1017
|
+
function compareVersions(v1, v2) {
|
|
1018
|
+
const parts1 = v1.split('.').map(Number);
|
|
1019
|
+
const parts2 = v2.split('.').map(Number);
|
|
1020
|
+
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
1021
|
+
const p1 = parts1[i] || 0;
|
|
1022
|
+
const p2 = parts2[i] || 0;
|
|
1023
|
+
if (p1 > p2)
|
|
1024
|
+
return 1;
|
|
1025
|
+
if (p1 < p2)
|
|
1026
|
+
return -1;
|
|
1027
|
+
}
|
|
1028
|
+
return 0;
|
|
1029
|
+
}
|
|
1030
|
+
// Check for updates on startup
|
|
1031
|
+
async function checkForUpdates() {
|
|
1032
|
+
if (!FCP_API_URL)
|
|
1033
|
+
return;
|
|
1034
|
+
try {
|
|
1035
|
+
const response = await fetch(`${FCP_API_URL}/api/mcp/version`, {
|
|
1036
|
+
headers: FCP_API_TOKEN ? { 'X-API-Key': FCP_API_TOKEN } : {},
|
|
1037
|
+
});
|
|
1038
|
+
if (!response.ok) {
|
|
1039
|
+
// Silently ignore - version endpoint may not exist on older FCP versions
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
const data = await response.json();
|
|
1043
|
+
const latestVersion = data.version;
|
|
1044
|
+
const minVersion = data.minVersion;
|
|
1045
|
+
if (compareVersions(MCP_SERVER_VERSION, minVersion) < 0) {
|
|
1046
|
+
console.error(`\n⚠️ [MCP Server] INCOMPATIBLE VERSION`);
|
|
1047
|
+
console.error(` Your version: ${MCP_SERVER_VERSION}`);
|
|
1048
|
+
console.error(` Minimum required: ${minVersion}`);
|
|
1049
|
+
console.error(` Please update: ${data.updateUrl}\n`);
|
|
1050
|
+
}
|
|
1051
|
+
else if (compareVersions(MCP_SERVER_VERSION, latestVersion) < 0) {
|
|
1052
|
+
console.error(`\n📦 [MCP Server] Update available: ${MCP_SERVER_VERSION} → ${latestVersion}`);
|
|
1053
|
+
console.error(` Update: ${data.updateUrl}\n`);
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
console.error(`[MCP Server] Version ${MCP_SERVER_VERSION} (up to date)`);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
catch {
|
|
1060
|
+
// Silently ignore network errors - don't block startup
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
993
1063
|
// Start server
|
|
994
1064
|
async function main() {
|
|
995
1065
|
const transport = new StdioServerTransport();
|
|
996
1066
|
await server.connect(transport);
|
|
997
|
-
console.error(
|
|
1067
|
+
console.error(`FCP MCP Server v${MCP_SERVER_VERSION} running on stdio`);
|
|
1068
|
+
// Check for updates (non-blocking)
|
|
1069
|
+
checkForUpdates();
|
|
998
1070
|
// Handle graceful shutdown
|
|
999
1071
|
const shutdown = async () => {
|
|
1000
1072
|
console.error('Shutting down MCP server...');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fruition/fcp-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "MCP Server for FCP Launch Coordination System - enables Claude Code to interact with FCP launches and track development time",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|