@ldraney/github-mcp 0.2.0-beta.3 → 0.2.3
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/LICENSE +21 -0
- package/README.md +43 -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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ldraney
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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:
|
|
@@ -126,6 +163,11 @@ npm run build
|
|
|
126
163
|
npm start
|
|
127
164
|
```
|
|
128
165
|
|
|
166
|
+
## Contact
|
|
167
|
+
|
|
168
|
+
- [LinkedIn](https://www.linkedin.com/in/lucas-draney-904457133/)
|
|
169
|
+
- [GitHub Issues](https://github.com/ldraney/github-mcp/issues)
|
|
170
|
+
|
|
129
171
|
## License
|
|
130
172
|
|
|
131
173
|
MIT
|
|
@@ -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.3",
|
|
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": {
|