MCPcopy Create free account
hub / github.com/chokcoco/iCSS / IcssServer

Class IcssServer

MCP/server.js:28–794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26};
27
28class IcssServer {
29 constructor() {
30 debugLog('🚀 Initializing iCSS MCP Server in debug mode');
31
32 this.server = new Server(
33 {
34 name: 'icss-mcp-server',
35 version: '1.1.1',
36 },
37 {
38 capabilities: {
39 tools: {},
40 },
41 }
42 );
43
44 this.db = null;
45 this.searchEngine = null;
46 this.isReady = false;
47 this.dbInitFailed = false;
48 this.setupDatabase();
49 this.setupHandlers();
50 }
51
52 setupDatabase() {
53 debugLog('📂 Setting up database connection...');
54 // 更健壮的数据库路径
55 const __filename = fileURLToPath(import.meta.url);
56 const __dirname = path.dirname(__filename);
57 const dbPath = path.join(__dirname, 'data', 'icss.db');
58 debugLog(`📍 Database path: ${dbPath}`);
59 this.db = new Database.Database(dbPath, (err) => {
60 if (err) {
61 console.error('❌ Error opening database:', err);
62 this.dbInitFailed = true;
63 } else {
64 debugLog('✅ Connected to SQLite database');
65 this.initializeDatabase();
66 }
67 });
68 }
69
70 initializeDatabase() {
71 debugLog('🔧 Initializing database tables...');
72
73 const createTableSQL = `
74 CREATE TABLE IF NOT EXISTS issues (
75 id INTEGER PRIMARY KEY,
76 number INTEGER UNIQUE,
77 title TEXT NOT NULL,
78 body TEXT,
79 html_url TEXT,
80 labels TEXT,
81 created_at TEXT,
82 updated_at TEXT,
83 search_content TEXT
84 )
85 `;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected