chore: run npm run format
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { FastMCP } from "fastmcp";
|
||||
import path from "path";
|
||||
import dotenv from "dotenv";
|
||||
import { fileURLToPath } from "url";
|
||||
import fs from "fs";
|
||||
import logger from "./logger.js";
|
||||
import { registerTaskMasterTools } from "./tools/index.js";
|
||||
import { FastMCP } from 'fastmcp';
|
||||
import path from 'path';
|
||||
import dotenv from 'dotenv';
|
||||
import { fileURLToPath } from 'url';
|
||||
import fs from 'fs';
|
||||
import logger from './logger.js';
|
||||
import { registerTaskMasterTools } from './tools/index.js';
|
||||
import { asyncOperationManager } from './core/utils/async-manager.js';
|
||||
|
||||
// Load environment variables
|
||||
@@ -18,74 +18,74 @@ const __dirname = path.dirname(__filename);
|
||||
* Main MCP server class that integrates with Task Master
|
||||
*/
|
||||
class TaskMasterMCPServer {
|
||||
constructor() {
|
||||
// Get version from package.json using synchronous fs
|
||||
const packagePath = path.join(__dirname, "../../package.json");
|
||||
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
|
||||
constructor() {
|
||||
// Get version from package.json using synchronous fs
|
||||
const packagePath = path.join(__dirname, '../../package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
||||
|
||||
this.options = {
|
||||
name: "Task Master MCP Server",
|
||||
version: packageJson.version,
|
||||
};
|
||||
this.options = {
|
||||
name: 'Task Master MCP Server',
|
||||
version: packageJson.version
|
||||
};
|
||||
|
||||
this.server = new FastMCP(this.options);
|
||||
this.initialized = false;
|
||||
this.server = new FastMCP(this.options);
|
||||
this.initialized = false;
|
||||
|
||||
this.server.addResource({});
|
||||
this.server.addResource({});
|
||||
|
||||
this.server.addResourceTemplate({});
|
||||
this.server.addResourceTemplate({});
|
||||
|
||||
// Make the manager accessible (e.g., pass it to tool registration)
|
||||
this.asyncManager = asyncOperationManager;
|
||||
// Make the manager accessible (e.g., pass it to tool registration)
|
||||
this.asyncManager = asyncOperationManager;
|
||||
|
||||
// Bind methods
|
||||
this.init = this.init.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
this.stop = this.stop.bind(this);
|
||||
// Bind methods
|
||||
this.init = this.init.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
this.stop = this.stop.bind(this);
|
||||
|
||||
// Setup logging
|
||||
this.logger = logger;
|
||||
}
|
||||
// Setup logging
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the MCP server with necessary tools and routes
|
||||
*/
|
||||
async init() {
|
||||
if (this.initialized) return;
|
||||
/**
|
||||
* Initialize the MCP server with necessary tools and routes
|
||||
*/
|
||||
async init() {
|
||||
if (this.initialized) return;
|
||||
|
||||
// Pass the manager instance to the tool registration function
|
||||
registerTaskMasterTools(this.server, this.asyncManager);
|
||||
// Pass the manager instance to the tool registration function
|
||||
registerTaskMasterTools(this.server, this.asyncManager);
|
||||
|
||||
this.initialized = true;
|
||||
this.initialized = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the MCP server
|
||||
*/
|
||||
async start() {
|
||||
if (!this.initialized) {
|
||||
await this.init();
|
||||
}
|
||||
/**
|
||||
* Start the MCP server
|
||||
*/
|
||||
async start() {
|
||||
if (!this.initialized) {
|
||||
await this.init();
|
||||
}
|
||||
|
||||
// Start the FastMCP server with increased timeout
|
||||
await this.server.start({
|
||||
transportType: "stdio",
|
||||
timeout: 120000 // 2 minutes timeout (in milliseconds)
|
||||
});
|
||||
// Start the FastMCP server with increased timeout
|
||||
await this.server.start({
|
||||
transportType: 'stdio',
|
||||
timeout: 120000 // 2 minutes timeout (in milliseconds)
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the MCP server
|
||||
*/
|
||||
async stop() {
|
||||
if (this.server) {
|
||||
await this.server.stop();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Stop the MCP server
|
||||
*/
|
||||
async stop() {
|
||||
if (this.server) {
|
||||
await this.server.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Export the manager from here as well, if needed elsewhere
|
||||
|
||||
Reference in New Issue
Block a user