copilot-mcp-server
Version:
MCP server that integrates with GitHub Copilot to provide code assistance
47 lines • 1.6 kB
JavaScript
import { config } from 'dotenv';
import { CopilotMCPServer } from './server.js';
config();
function loadConfig() {
const githubConfig = {
token: process.env.GITHUB_TOKEN,
appId: process.env.GITHUB_APP_ID,
privateKeyPath: process.env.GITHUB_APP_PRIVATE_KEY_PATH,
installationId: process.env.GITHUB_INSTALLATION_ID,
org: process.env.GITHUB_ORG,
};
// Note: We don't check for authentication here as the CopilotClient will auto-detect
// GitHub Copilot tokens from the standard config files
return {
github: githubConfig,
logLevel: process.env.LOG_LEVEL || 'info',
debug: process.env.DEBUG === 'true',
maxRequestsPerMinute: parseInt(process.env.MAX_REQUESTS_PER_MINUTE || '60'),
};
}
async function main() {
try {
const serverConfig = loadConfig();
const server = new CopilotMCPServer(serverConfig);
process.on('SIGINT', () => {
console.error('Received SIGINT, shutting down gracefully...');
process.exit(0);
});
process.on('SIGTERM', () => {
console.error('Received SIGTERM, shutting down gracefully...');
process.exit(0);
});
await server.start();
}
catch (error) {
console.error('Failed to start Copilot MCP Server:', error);
process.exit(1);
}
}
if (import.meta.url === `file://${process.argv[1]}`) {
main().catch((error) => {
console.error('Unhandled error:', error);
process.exit(1);
});
}
//# sourceMappingURL=index.js.map