Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/http/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import 'dotenv/config';
import { program } from 'commander';
import { PACKAGE_VERSION } from '../shared/version.js';

// ============================================================================
// Command Line Arguments
// ============================================================================

program
.name('insforge-mcp-server')
.description('HTTP MCP server for Insforge backend-as-a-service')
.version(PACKAGE_VERSION, '-v, --version')
.option('--port <number>', 'Port to run HTTP server on', '3000')
.option('--host <string>', 'Host to bind to', '127.0.0.1');
program.parse(process.argv);
Expand Down
3 changes: 2 additions & 1 deletion src/http/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from './config.js';
import { renderProjectSelectionPage } from './templates/project-selection.js';
import { getAnalyticsService, extractClientInfo } from './analytics.js';
import { PACKAGE_VERSION } from '../shared/version.js';

// ============================================================================
// Express App Setup
Expand Down Expand Up @@ -134,7 +135,7 @@ app.get(API_ENDPOINTS.health, async (_req: Request, res: Response) => {
res.json({
status: 'ok',
server: 'insforge-mcp',
version: '1.0.0',
version: PACKAGE_VERSION,
protocols: {
streamableHttp: '2025-03-26',
sse: '2024-11-05 (deprecated)',
Expand Down
7 changes: 4 additions & 3 deletions src/http/session-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
import { getRedisClient } from './redis.js';
import { registerInsforgeTools } from '../shared/tools/index.js';
import { PACKAGE_VERSION } from '../shared/version.js';

/**
* Session data stored in Redis
Expand Down Expand Up @@ -72,7 +73,7 @@ export class SessionManager {
// Create MCP server and register tools first
const server = new McpServer({
name: 'insforge-mcp',
version: '1.0.0',
version: PACKAGE_VERSION,
});

const toolsConfig = await registerInsforgeTools(server, {
Expand Down Expand Up @@ -191,7 +192,7 @@ export class SessionManager {
// Create new MCP server with stored configuration
const server = new McpServer({
name: 'insforge-mcp',
version: '1.0.0',
version: PACKAGE_VERSION,
});

await registerInsforgeTools(server, {
Expand Down Expand Up @@ -231,7 +232,7 @@ export class SessionManager {
// Create MCP server and register tools first
const server = new McpServer({
name: 'insforge-mcp',
version: '1.0.0',
version: PACKAGE_VERSION,
});

const toolsConfig = await registerInsforgeTools(server, {
Expand Down
18 changes: 18 additions & 0 deletions src/shared/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const packageJson = loadPackageJson();

export const PACKAGE_VERSION = packageJson.version ?? '0.0.0';

function loadPackageJson(): { version?: string } {
try {
return require('../../package.json') as { version?: string };
} catch {
try {
return require('../package.json') as { version?: string };
} catch {
return { version: '0.0.0' };
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
13 changes: 9 additions & 4 deletions src/stdio/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { program } from 'commander';
import { PACKAGE_VERSION } from '../shared/version.js';
import { registerInsforgeTools } from '../shared/tools/index.js';

// Parse command line arguments
program.option('--api_key <value>', 'API Key');
program.option('--api_base_url <value>', 'API Base URL');
program
.name('insforge-mcp')
.description('MCP server for Insforge backend-as-a-service')
.version(PACKAGE_VERSION, '-v, --version')
.option('--api_key <value>', 'API Key')
.option('--api_base_url <value>', 'API Base URL');
program.parse(process.argv);
const options = program.opts();
const { api_key, api_base_url } = options;
Expand All @@ -15,7 +20,7 @@ async function main() {
// Create MCP server
const server = new McpServer({
name: 'insforge-mcp',
version: '1.0.0',
version: PACKAGE_VERSION,
});

// Register all Insforge tools with the server (async to support dynamic version-based registration)
Expand Down Expand Up @@ -45,4 +50,4 @@ async function main() {
console.error(`Tools registered: ${toolsConfig.toolCount}`);
}

main().catch(console.error);
main().catch(console.error);
Loading