(category)
| 120 | } |
| 121 | |
| 122 | async fetchDirectoryContents(category) { |
| 123 | console.log(`📂 Fetching contents for category: ${category}`); |
| 124 | |
| 125 | try { |
| 126 | const response = await axios.get(`${this.baseURL}/contents/${category}`, { |
| 127 | headers: { |
| 128 | 'Accept': 'application/vnd.github.v3+json', |
| 129 | 'User-Agent': 'iCSS-MCP-Server', |
| 130 | ...(this.githubToken && { 'Authorization': `token ${this.githubToken}` }) |
| 131 | } |
| 132 | }); |
| 133 | |
| 134 | const files = response.data.filter(item => |
| 135 | item.type === 'file' && item.name.endsWith('.md') |
| 136 | ); |
| 137 | |
| 138 | console.log(` 📝 Found ${files.length} markdown files in ${category}`); |
| 139 | return files; |
| 140 | } catch (error) { |
| 141 | console.error(`❌ Error fetching ${category} contents:`, error.message); |
| 142 | return []; |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | async fetchFileContent(filePath) { |
| 147 | try { |
no test coverage detected