@ldraney/github-mcp 0.2.0-beta.3 ā 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -1
- package/dist/auth/token-storage.js +34 -8
- package/dist/index.js +29 -6
- package/dist/tools/generator.d.ts +24 -0
- package/dist/tools/generator.js +59 -9
- package/package.json +2 -2
- package/dist/auth/oauth-device-flow.d.ts +0 -20
- package/dist/auth/oauth-device-flow.d.ts.map +0 -1
- package/dist/auth/oauth-device-flow.js +0 -141
- package/dist/auth/oauth-device-flow.js.map +0 -1
- package/dist/auth/token-storage.d.ts.map +0 -1
- package/dist/auth/token-storage.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/resources/webhooks.d.ts +0 -15
- package/dist/resources/webhooks.d.ts.map +0 -1
- package/dist/resources/webhooks.js +0 -194
- package/dist/resources/webhooks.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/tools/categories/actions.d.ts.map +0 -1
- package/dist/tools/categories/actions.js.map +0 -1
- package/dist/tools/categories/gists.d.ts.map +0 -1
- package/dist/tools/categories/gists.js.map +0 -1
- package/dist/tools/categories/issues.d.ts.map +0 -1
- package/dist/tools/categories/issues.js.map +0 -1
- package/dist/tools/categories/orgs.d.ts.map +0 -1
- package/dist/tools/categories/orgs.js.map +0 -1
- package/dist/tools/categories/pulls.d.ts.map +0 -1
- package/dist/tools/categories/pulls.js.map +0 -1
- package/dist/tools/categories/repos.d.ts.map +0 -1
- package/dist/tools/categories/repos.js.map +0 -1
- package/dist/tools/categories/search.d.ts.map +0 -1
- package/dist/tools/categories/search.js.map +0 -1
- package/dist/tools/categories/users.d.ts.map +0 -1
- package/dist/tools/categories/users.js.map +0 -1
- package/dist/tools/generator.d.ts.map +0 -1
- package/dist/tools/generator.js.map +0 -1
- package/dist/webhooks/event-queue.d.ts +0 -54
- package/dist/webhooks/event-queue.d.ts.map +0 -1
- package/dist/webhooks/event-queue.js +0 -117
- package/dist/webhooks/event-queue.js.map +0 -1
- package/dist/webhooks/smee-client.d.ts +0 -27
- package/dist/webhooks/smee-client.d.ts.map +0 -1
- package/dist/webhooks/smee-client.js +0 -153
- package/dist/webhooks/smee-client.js.map +0 -1
package/README.md
CHANGED
|
@@ -45,7 +45,20 @@ Add to your Claude Desktop config:
|
|
|
45
45
|
"mcpServers": {
|
|
46
46
|
"github": {
|
|
47
47
|
"command": "npx",
|
|
48
|
-
"args": ["github-mcp"]
|
|
48
|
+
"args": ["@ldraney/github-mcp", "--preset", "core"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For security-focused work:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"github": {
|
|
60
|
+
"command": "npx",
|
|
61
|
+
"args": ["@ldraney/github-mcp", "--preset", "security"]
|
|
49
62
|
}
|
|
50
63
|
}
|
|
51
64
|
}
|
|
@@ -66,6 +79,30 @@ github-mcp auth status # Check auth status
|
|
|
66
79
|
GITHUB_TOKEN=ghp_xxx github-mcp
|
|
67
80
|
```
|
|
68
81
|
|
|
82
|
+
### Presets
|
|
83
|
+
|
|
84
|
+
Claude Desktop has a ~100 tool limit. Use presets to load only what you need:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
github-mcp --preset core # Daily dev work (~95 tools)
|
|
88
|
+
github-mcp --preset security # Security audits (~50 tools)
|
|
89
|
+
github-mcp --preset org-admin # Org management (~70 tools)
|
|
90
|
+
github-mcp --preset cicd # CI/CD automation (~60 tools)
|
|
91
|
+
github-mcp --preset full # All 327 tools (Claude Code only)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
| Preset | Categories | Use Case |
|
|
95
|
+
|--------|-----------|----------|
|
|
96
|
+
| `core` (default) | repos, issues, pulls, search, users, actions, gists | Daily development |
|
|
97
|
+
| `security` | dependabot, secretScanning, codeScanning, codeSecurity, securityAdvisories | Security audits |
|
|
98
|
+
| `org-admin` | orgs, teams, projects, activity, users, apps | Organization management |
|
|
99
|
+
| `cicd` | actions, checks, repos, packages | CI/CD pipelines |
|
|
100
|
+
| `full` | all 32 categories | Claude Code with tool search |
|
|
101
|
+
|
|
102
|
+
List presets: `github-mcp --list-presets`
|
|
103
|
+
|
|
104
|
+
Override with custom categories: `github-mcp --categories repos,issues,pulls`
|
|
105
|
+
|
|
69
106
|
## Available Tools
|
|
70
107
|
|
|
71
108
|
Tools are organized by GitHub API category:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Entry } from '@napi-rs/keyring';
|
|
2
2
|
const SERVICE_NAME = 'github-mcp';
|
|
3
3
|
const ACCOUNT_NAME = 'oauth-token';
|
|
4
4
|
const SCOPE_ACCOUNT = 'oauth-scopes';
|
|
@@ -6,28 +6,54 @@ const SCOPE_ACCOUNT = 'oauth-scopes';
|
|
|
6
6
|
* Store token securely in OS keychain
|
|
7
7
|
*/
|
|
8
8
|
export async function storeToken(token, scopes) {
|
|
9
|
-
|
|
9
|
+
const tokenEntry = new Entry(SERVICE_NAME, ACCOUNT_NAME);
|
|
10
|
+
tokenEntry.setPassword(token);
|
|
10
11
|
if (scopes) {
|
|
11
|
-
|
|
12
|
+
const scopeEntry = new Entry(SERVICE_NAME, SCOPE_ACCOUNT);
|
|
13
|
+
scopeEntry.setPassword(scopes);
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Retrieve token from OS keychain
|
|
16
18
|
*/
|
|
17
19
|
export async function retrieveToken() {
|
|
18
|
-
|
|
20
|
+
try {
|
|
21
|
+
const entry = new Entry(SERVICE_NAME, ACCOUNT_NAME);
|
|
22
|
+
return entry.getPassword();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
29
|
* Retrieve stored scopes
|
|
22
30
|
*/
|
|
23
31
|
export async function retrieveScopes() {
|
|
24
|
-
|
|
32
|
+
try {
|
|
33
|
+
const entry = new Entry(SERVICE_NAME, SCOPE_ACCOUNT);
|
|
34
|
+
return entry.getPassword();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
25
39
|
}
|
|
26
40
|
/**
|
|
27
41
|
* Delete token from OS keychain
|
|
28
42
|
*/
|
|
29
43
|
export async function deleteToken() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
try {
|
|
45
|
+
const tokenEntry = new Entry(SERVICE_NAME, ACCOUNT_NAME);
|
|
46
|
+
tokenEntry.deletePassword();
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Token didn't exist
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const scopeEntry = new Entry(SERVICE_NAME, SCOPE_ACCOUNT);
|
|
53
|
+
scopeEntry.deletePassword();
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Scopes didn't exist
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
33
59
|
}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import { getToken, login, logout, getAuthStatus } from './auth/oauth-flow.js';
|
|
4
4
|
import { startServer } from './server.js';
|
|
5
|
-
import { ToolGenerator } from './tools/generator.js';
|
|
5
|
+
import { ToolGenerator, PRESETS, DEFAULT_PRESET } from './tools/generator.js';
|
|
6
6
|
const program = new Command();
|
|
7
7
|
program
|
|
8
8
|
.name('github-mcp')
|
|
@@ -10,8 +10,19 @@ program
|
|
|
10
10
|
.version('0.1.0');
|
|
11
11
|
// Default command: start server
|
|
12
12
|
program
|
|
13
|
-
.option('-
|
|
13
|
+
.option('-p, --preset <preset>', `Tool preset to load (${Object.keys(PRESETS).join(', ')})`, DEFAULT_PRESET)
|
|
14
|
+
.option('-c, --categories <categories>', `Comma-separated list of tool categories (overrides preset)`)
|
|
15
|
+
.option('--list-presets', 'Show available presets and exit')
|
|
14
16
|
.action(async (options) => {
|
|
17
|
+
// Handle --list-presets
|
|
18
|
+
if (options.listPresets) {
|
|
19
|
+
console.log('Available presets:\n');
|
|
20
|
+
console.log(ToolGenerator.getPresetDescriptions());
|
|
21
|
+
console.log('\nUsage: npx @ldraney/github-mcp --preset <preset>');
|
|
22
|
+
console.log('\nFor Claude Desktop, use "core" (default) to stay under 100 tools.');
|
|
23
|
+
console.log('For Claude Code, use "full" for all 327 tools.');
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
15
26
|
try {
|
|
16
27
|
let token = await getToken();
|
|
17
28
|
if (!token) {
|
|
@@ -22,10 +33,22 @@ program
|
|
|
22
33
|
console.error('Authentication failed. Cannot start server.');
|
|
23
34
|
process.exit(1);
|
|
24
35
|
}
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
// Determine categories: explicit categories override preset
|
|
37
|
+
let categories;
|
|
38
|
+
if (options.categories) {
|
|
39
|
+
categories = options.categories.split(',').map((c) => c.trim());
|
|
40
|
+
console.error(`Using custom categories: ${categories.join(', ')}`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const preset = options.preset || DEFAULT_PRESET;
|
|
44
|
+
categories = ToolGenerator.getPresetCategories(preset);
|
|
45
|
+
if (!categories) {
|
|
46
|
+
console.error(`Unknown preset: ${preset}`);
|
|
47
|
+
console.error(`Available presets: ${ToolGenerator.getAvailablePresets().join(', ')}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
console.error(`Using preset: ${preset}`);
|
|
51
|
+
}
|
|
29
52
|
await startServer(token, { categories });
|
|
30
53
|
}
|
|
31
54
|
catch (error) {
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import type { Octokit } from '@octokit/rest';
|
|
2
2
|
import type { MCPToolDefinition, ToolResult } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Preset configurations for different use cases
|
|
5
|
+
* Each preset stays under ~100 tools for Claude Desktop compatibility
|
|
6
|
+
*/
|
|
7
|
+
export declare const PRESETS: Record<string, {
|
|
8
|
+
description: string;
|
|
9
|
+
categories: string[];
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Default preset for Claude Desktop compatibility
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_PRESET = "core";
|
|
3
15
|
/**
|
|
4
16
|
* Tool generator that manages tool loading and execution
|
|
5
17
|
*/
|
|
@@ -27,6 +39,18 @@ export declare class ToolGenerator {
|
|
|
27
39
|
* Get list of available category names
|
|
28
40
|
*/
|
|
29
41
|
static getAvailableCategories(): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Get list of available preset names
|
|
44
|
+
*/
|
|
45
|
+
static getAvailablePresets(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Get categories for a preset
|
|
48
|
+
*/
|
|
49
|
+
static getPresetCategories(preset: string): string[] | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Get preset descriptions for help text
|
|
52
|
+
*/
|
|
53
|
+
static getPresetDescriptions(): string;
|
|
30
54
|
/**
|
|
31
55
|
* Get count of loaded tools
|
|
32
56
|
*/
|
package/dist/tools/generator.js
CHANGED
|
@@ -39,16 +39,46 @@ const ALL_CATEGORIES = {
|
|
|
39
39
|
codesOfConduct: codesOfConductCategory,
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Preset configurations for different use cases
|
|
43
|
+
* Each preset stays under ~100 tools for Claude Desktop compatibility
|
|
43
44
|
*/
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
]
|
|
45
|
+
export const PRESETS = {
|
|
46
|
+
core: {
|
|
47
|
+
description: 'Essential tools for daily development (~95 tools)',
|
|
48
|
+
categories: ['repos', 'issues', 'pulls', 'search', 'users', 'actions', 'gists'],
|
|
49
|
+
},
|
|
50
|
+
security: {
|
|
51
|
+
description: 'Security scanning and vulnerability management (~50 tools)',
|
|
52
|
+
categories: ['dependabot', 'secretScanning', 'codeScanning', 'codeSecurity', 'securityAdvisories'],
|
|
53
|
+
},
|
|
54
|
+
'org-admin': {
|
|
55
|
+
description: 'Organization and team management (~70 tools)',
|
|
56
|
+
categories: ['orgs', 'teams', 'projects', 'activity', 'users', 'apps'],
|
|
57
|
+
},
|
|
58
|
+
cicd: {
|
|
59
|
+
description: 'CI/CD and automation tools (~60 tools)',
|
|
60
|
+
categories: ['actions', 'checks', 'repos', 'packages'],
|
|
61
|
+
},
|
|
62
|
+
full: {
|
|
63
|
+
description: 'All 327 tools - recommended for Claude Code only',
|
|
64
|
+
categories: [
|
|
65
|
+
'repos', 'issues', 'pulls', 'users', 'actions', 'search', 'orgs',
|
|
66
|
+
'gists', 'checks', 'projects', 'teams', 'activity', 'git',
|
|
67
|
+
'reactions', 'packages', 'dependabot', 'secretScanning', 'codeScanning',
|
|
68
|
+
'codeSecurity', 'securityAdvisories', 'apps', 'billing', 'codespaces',
|
|
69
|
+
'copilot', 'migrations', 'interactions', 'rateLimit', 'markdown',
|
|
70
|
+
'meta', 'emojis', 'gitignore', 'licenses', 'codesOfConduct',
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Default preset for Claude Desktop compatibility
|
|
76
|
+
*/
|
|
77
|
+
export const DEFAULT_PRESET = 'core';
|
|
78
|
+
/**
|
|
79
|
+
* Default categories to load if none specified (uses core preset)
|
|
80
|
+
*/
|
|
81
|
+
const DEFAULT_CATEGORIES = PRESETS[DEFAULT_PRESET].categories;
|
|
52
82
|
/**
|
|
53
83
|
* Tool generator that manages tool loading and execution
|
|
54
84
|
*/
|
|
@@ -107,6 +137,26 @@ export class ToolGenerator {
|
|
|
107
137
|
static getAvailableCategories() {
|
|
108
138
|
return Object.keys(ALL_CATEGORIES);
|
|
109
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Get list of available preset names
|
|
142
|
+
*/
|
|
143
|
+
static getAvailablePresets() {
|
|
144
|
+
return Object.keys(PRESETS);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get categories for a preset
|
|
148
|
+
*/
|
|
149
|
+
static getPresetCategories(preset) {
|
|
150
|
+
return PRESETS[preset]?.categories;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get preset descriptions for help text
|
|
154
|
+
*/
|
|
155
|
+
static getPresetDescriptions() {
|
|
156
|
+
return Object.entries(PRESETS)
|
|
157
|
+
.map(([name, config]) => ` ${name}: ${config.description}`)
|
|
158
|
+
.join('\n');
|
|
159
|
+
}
|
|
110
160
|
/**
|
|
111
161
|
* Get count of loaded tools
|
|
112
162
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldraney/github-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "GitHub MCP server with OAuth and 800+ API endpoints",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
40
40
|
"@octokit/rest": "^21.0.0",
|
|
41
41
|
"commander": "^12.1.0",
|
|
42
|
-
"
|
|
42
|
+
"@napi-rs/keyring": "^1.2.0",
|
|
43
43
|
"open": "^10.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface DeviceFlowVerification {
|
|
2
|
-
device_code: string;
|
|
3
|
-
user_code: string;
|
|
4
|
-
verification_uri: string;
|
|
5
|
-
expires_in: number;
|
|
6
|
-
interval: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Perform OAuth Device Flow authentication
|
|
10
|
-
*/
|
|
11
|
-
export declare function login(): Promise<string | null>;
|
|
12
|
-
/**
|
|
13
|
-
* Remove stored credentials
|
|
14
|
-
*/
|
|
15
|
-
export declare function logout(): Promise<void>;
|
|
16
|
-
/**
|
|
17
|
-
* Check and display authentication status
|
|
18
|
-
*/
|
|
19
|
-
export declare function getAuthStatus(): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=oauth-device-flow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-device-flow.d.ts","sourceRoot":"","sources":["../../src/auth/oauth-device-flow.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4DpD;AAED;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ5C;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA2BnD"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { createOAuthDeviceAuth } from '@octokit/auth-oauth-device';
|
|
2
|
-
import { Octokit } from '@octokit/rest';
|
|
3
|
-
import { setToken, getToken, deleteToken } from './token-storage.js';
|
|
4
|
-
// Default GitHub OAuth App client ID
|
|
5
|
-
// Users should register their own OAuth App for production use
|
|
6
|
-
const DEFAULT_CLIENT_ID = process.env.GITHUB_CLIENT_ID || 'Ov23liXXXXXXXXXXXXXX';
|
|
7
|
-
// Scopes needed for full GitHub API access
|
|
8
|
-
const SCOPES = [
|
|
9
|
-
'repo',
|
|
10
|
-
'read:org',
|
|
11
|
-
'read:user',
|
|
12
|
-
'user:email',
|
|
13
|
-
'read:project',
|
|
14
|
-
'write:discussion',
|
|
15
|
-
'gist',
|
|
16
|
-
'notifications',
|
|
17
|
-
'workflow',
|
|
18
|
-
'read:packages',
|
|
19
|
-
'admin:repo_hook',
|
|
20
|
-
'admin:org_hook',
|
|
21
|
-
];
|
|
22
|
-
/**
|
|
23
|
-
* Perform OAuth Device Flow authentication
|
|
24
|
-
*/
|
|
25
|
-
export async function login() {
|
|
26
|
-
const clientId = process.env.GITHUB_CLIENT_ID || DEFAULT_CLIENT_ID;
|
|
27
|
-
if (clientId === DEFAULT_CLIENT_ID || clientId.startsWith('Ov23liXXXX')) {
|
|
28
|
-
console.error('\nā ļø No GITHUB_CLIENT_ID set. Please register an OAuth App:');
|
|
29
|
-
console.error(' 1. Go to https://github.com/settings/developers');
|
|
30
|
-
console.error(' 2. Click "New OAuth App"');
|
|
31
|
-
console.error(' 3. Set callback URL to: http://localhost/callback');
|
|
32
|
-
console.error(' 4. Enable "Device Flow" in the app settings');
|
|
33
|
-
console.error(' 5. Set GITHUB_CLIENT_ID environment variable\n');
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
console.error('\nš Starting GitHub OAuth Device Flow...\n');
|
|
37
|
-
try {
|
|
38
|
-
const auth = createOAuthDeviceAuth({
|
|
39
|
-
clientType: 'oauth-app',
|
|
40
|
-
clientId,
|
|
41
|
-
scopes: SCOPES,
|
|
42
|
-
onVerification: (verification) => {
|
|
43
|
-
console.error('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
44
|
-
console.error('');
|
|
45
|
-
console.error(' š Your verification code:');
|
|
46
|
-
console.error('');
|
|
47
|
-
console.error(` ${verification.user_code}`);
|
|
48
|
-
console.error('');
|
|
49
|
-
console.error(' š Open this URL in your browser:');
|
|
50
|
-
console.error('');
|
|
51
|
-
console.error(` ${verification.verification_uri}`);
|
|
52
|
-
console.error('');
|
|
53
|
-
console.error(' ā³ Waiting for authorization...');
|
|
54
|
-
console.error('');
|
|
55
|
-
console.error('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
56
|
-
// Try to open browser automatically
|
|
57
|
-
openBrowser(verification.verification_uri);
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
const { token } = await auth({ type: 'oauth' });
|
|
61
|
-
// Store token securely
|
|
62
|
-
await setToken(token);
|
|
63
|
-
// Verify token works
|
|
64
|
-
const octokit = new Octokit({ auth: token });
|
|
65
|
-
const { data: user } = await octokit.users.getAuthenticated();
|
|
66
|
-
console.error('');
|
|
67
|
-
console.error(`ā
Successfully authenticated as: ${user.login}`);
|
|
68
|
-
console.error(' Token stored securely in OS keychain');
|
|
69
|
-
console.error('');
|
|
70
|
-
return token;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
74
|
-
console.error(`\nā Authentication failed: ${message}\n`);
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Remove stored credentials
|
|
80
|
-
*/
|
|
81
|
-
export async function logout() {
|
|
82
|
-
const deleted = await deleteToken();
|
|
83
|
-
if (deleted) {
|
|
84
|
-
console.error('ā
Logged out. Token removed from keychain.');
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
console.error('ā¹ļø No stored credentials found.');
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Check and display authentication status
|
|
92
|
-
*/
|
|
93
|
-
export async function getAuthStatus() {
|
|
94
|
-
const token = process.env.GITHUB_TOKEN || await getToken();
|
|
95
|
-
if (!token) {
|
|
96
|
-
console.error('ā Not authenticated');
|
|
97
|
-
console.error(' Run: github-mcp auth login');
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
try {
|
|
101
|
-
const octokit = new Octokit({ auth: token });
|
|
102
|
-
const { data: user } = await octokit.users.getAuthenticated();
|
|
103
|
-
console.error('ā
Authenticated');
|
|
104
|
-
console.error(` User: ${user.login}`);
|
|
105
|
-
console.error(` Name: ${user.name || 'Not set'}`);
|
|
106
|
-
console.error(` Email: ${user.email || 'Not public'}`);
|
|
107
|
-
if (process.env.GITHUB_TOKEN) {
|
|
108
|
-
console.error(' Source: GITHUB_TOKEN environment variable');
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
console.error(' Source: OS keychain');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
console.error('ā Token is invalid or expired');
|
|
116
|
-
console.error(' Run: github-mcp auth login');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Open URL in default browser (cross-platform)
|
|
121
|
-
*/
|
|
122
|
-
function openBrowser(url) {
|
|
123
|
-
const { exec } = require('child_process');
|
|
124
|
-
const platform = process.platform;
|
|
125
|
-
let command;
|
|
126
|
-
if (platform === 'darwin') {
|
|
127
|
-
command = `open "${url}"`;
|
|
128
|
-
}
|
|
129
|
-
else if (platform === 'win32') {
|
|
130
|
-
command = `start "${url}"`;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
command = `xdg-open "${url}"`;
|
|
134
|
-
}
|
|
135
|
-
exec(command, (error) => {
|
|
136
|
-
if (error) {
|
|
137
|
-
// Silent fail - user can manually open the URL
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
//# sourceMappingURL=oauth-device-flow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-device-flow.js","sourceRoot":"","sources":["../../src/auth/oauth-device-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe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":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3D;AAED;;GAEG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAEvD;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAEpD;AAED;;GAEG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAGjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-storage.js","sourceRoot":"","sources":["../../src/auth/token-storage.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,YAAY,GAAG,YAAY,CAAC;AAClC,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAAa;IAC1C,MAAM,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,OAAO,MAAM,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,OAAO,MAAM,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,MAAM,KAAK,GAAG,MAAM,QAAQ,EAAE,CAAC;IAC/B,OAAO,KAAK,KAAK,IAAI,CAAC;AACxB,CAAC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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C;KAClB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,aAAa,EAAE,CAAC;AACxB,CAAC,CAAC,CACL,CAAC;AAEJ,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
export interface WebhookResourceContents {
|
|
3
|
-
uri: string;
|
|
4
|
-
mimeType: string;
|
|
5
|
-
text: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Get all webhook-related resources
|
|
9
|
-
*/
|
|
10
|
-
export declare function getWebhookResources(): Resource[];
|
|
11
|
-
/**
|
|
12
|
-
* Read a webhook resource
|
|
13
|
-
*/
|
|
14
|
-
export declare function readWebhookResource(uri: string): WebhookResourceContents;
|
|
15
|
-
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAG9D,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAGD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,EAAE,CA4ChD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAiExE"}
|