@ldraney/github-mcp 0.1.0 → 0.2.0-beta.1

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.
Files changed (84) hide show
  1. package/dist/index.js +8 -2
  2. package/dist/prompts/activity-summary.d.ts +10 -0
  3. package/dist/prompts/activity-summary.js +154 -0
  4. package/dist/prompts/code-review.d.ts +9 -0
  5. package/dist/prompts/code-review.js +145 -0
  6. package/dist/prompts/issue-triage.d.ts +9 -0
  7. package/dist/prompts/issue-triage.js +202 -0
  8. package/dist/prompts/release-notes.d.ts +9 -0
  9. package/dist/prompts/release-notes.js +236 -0
  10. package/dist/server.d.ts +8 -1
  11. package/dist/server.js +36 -210
  12. package/dist/tools/categories/actions.d.ts +2 -5
  13. package/dist/tools/categories/actions.js +640 -369
  14. package/dist/tools/categories/activity.d.ts +2 -0
  15. package/dist/tools/categories/activity.js +534 -0
  16. package/dist/tools/categories/apps.d.ts +2 -0
  17. package/dist/tools/categories/apps.js +224 -0
  18. package/dist/tools/categories/billing.d.ts +2 -0
  19. package/dist/tools/categories/billing.js +145 -0
  20. package/dist/tools/categories/checks.d.ts +2 -0
  21. package/dist/tools/categories/checks.js +554 -0
  22. package/dist/tools/categories/codeScanning.d.ts +2 -0
  23. package/dist/tools/categories/codeScanning.js +375 -0
  24. package/dist/tools/categories/codeSecurity.d.ts +2 -0
  25. package/dist/tools/categories/codeSecurity.js +463 -0
  26. package/dist/tools/categories/codesOfConduct.d.ts +2 -0
  27. package/dist/tools/categories/codesOfConduct.js +45 -0
  28. package/dist/tools/categories/codespaces.d.ts +2 -0
  29. package/dist/tools/categories/codespaces.js +259 -0
  30. package/dist/tools/categories/copilot.d.ts +2 -0
  31. package/dist/tools/categories/copilot.js +187 -0
  32. package/dist/tools/categories/dependabot.d.ts +2 -0
  33. package/dist/tools/categories/dependabot.js +454 -0
  34. package/dist/tools/categories/emojis.d.ts +2 -0
  35. package/dist/tools/categories/emojis.js +22 -0
  36. package/dist/tools/categories/gists.d.ts +2 -5
  37. package/dist/tools/categories/gists.js +474 -285
  38. package/dist/tools/categories/git.d.ts +2 -0
  39. package/dist/tools/categories/git.js +520 -0
  40. package/dist/tools/categories/gitignore.d.ts +2 -0
  41. package/dist/tools/categories/gitignore.js +45 -0
  42. package/dist/tools/categories/index.d.ts +33 -0
  43. package/dist/tools/categories/index.js +33 -0
  44. package/dist/tools/categories/interactions.d.ts +2 -0
  45. package/dist/tools/categories/interactions.js +184 -0
  46. package/dist/tools/categories/issues.d.ts +2 -5
  47. package/dist/tools/categories/issues.js +692 -390
  48. package/dist/tools/categories/licenses.d.ts +2 -0
  49. package/dist/tools/categories/licenses.js +95 -0
  50. package/dist/tools/categories/markdown.d.ts +2 -0
  51. package/dist/tools/categories/markdown.js +64 -0
  52. package/dist/tools/categories/meta.d.ts +2 -0
  53. package/dist/tools/categories/meta.js +74 -0
  54. package/dist/tools/categories/migrations.d.ts +2 -0
  55. package/dist/tools/categories/migrations.js +290 -0
  56. package/dist/tools/categories/orgs.d.ts +2 -5
  57. package/dist/tools/categories/orgs.js +585 -417
  58. package/dist/tools/categories/packages.d.ts +2 -0
  59. package/dist/tools/categories/packages.js +918 -0
  60. package/dist/tools/categories/projects.d.ts +2 -0
  61. package/dist/tools/categories/projects.js +692 -0
  62. package/dist/tools/categories/pulls.d.ts +2 -5
  63. package/dist/tools/categories/pulls.js +715 -332
  64. package/dist/tools/categories/rateLimit.d.ts +2 -0
  65. package/dist/tools/categories/rateLimit.js +22 -0
  66. package/dist/tools/categories/reactions.d.ts +2 -0
  67. package/dist/tools/categories/reactions.js +385 -0
  68. package/dist/tools/categories/repos.d.ts +2 -5
  69. package/dist/tools/categories/repos.js +844 -366
  70. package/dist/tools/categories/search.d.ts +2 -5
  71. package/dist/tools/categories/search.js +294 -196
  72. package/dist/tools/categories/secretScanning.d.ts +2 -0
  73. package/dist/tools/categories/secretScanning.js +324 -0
  74. package/dist/tools/categories/securityAdvisories.d.ts +2 -0
  75. package/dist/tools/categories/securityAdvisories.js +407 -0
  76. package/dist/tools/categories/teams.d.ts +2 -0
  77. package/dist/tools/categories/teams.js +614 -0
  78. package/dist/tools/categories/users.d.ts +2 -5
  79. package/dist/tools/categories/users.js +474 -247
  80. package/dist/tools/generator.d.ts +35 -15
  81. package/dist/tools/generator.js +113 -57
  82. package/dist/tools/types.d.ts +63 -0
  83. package/dist/tools/types.js +17 -0
  84. package/package.json +1 -1
@@ -0,0 +1,236 @@
1
+ /**
2
+ * Release notes prompt definitions
3
+ */
4
+ export const releaseNotesPrompts = [
5
+ {
6
+ name: 'release_notes',
7
+ description: 'Generate release notes from commits between two refs',
8
+ arguments: [
9
+ {
10
+ name: 'owner',
11
+ description: 'Repository owner (username or organization)',
12
+ required: true,
13
+ },
14
+ {
15
+ name: 'repo',
16
+ description: 'Repository name',
17
+ required: true,
18
+ },
19
+ {
20
+ name: 'base',
21
+ description: 'Base ref (tag, branch, or SHA) - e.g., v1.0.0',
22
+ required: true,
23
+ },
24
+ {
25
+ name: 'head',
26
+ description: 'Head ref (tag, branch, or SHA) - e.g., v1.1.0 or main',
27
+ required: true,
28
+ },
29
+ ],
30
+ },
31
+ {
32
+ name: 'changelog',
33
+ description: 'Generate a changelog from recent commits',
34
+ arguments: [
35
+ {
36
+ name: 'owner',
37
+ description: 'Repository owner (username or organization)',
38
+ required: true,
39
+ },
40
+ {
41
+ name: 'repo',
42
+ description: 'Repository name',
43
+ required: true,
44
+ },
45
+ {
46
+ name: 'since',
47
+ description: 'Number of days to look back (default: 30)',
48
+ required: false,
49
+ },
50
+ ],
51
+ },
52
+ {
53
+ name: 'whats_new',
54
+ description: 'Generate a user-friendly "What\'s New" summary for a release',
55
+ arguments: [
56
+ {
57
+ name: 'owner',
58
+ description: 'Repository owner (username or organization)',
59
+ required: true,
60
+ },
61
+ {
62
+ name: 'repo',
63
+ description: 'Repository name',
64
+ required: true,
65
+ },
66
+ {
67
+ name: 'base',
68
+ description: 'Previous release tag - e.g., v1.0.0',
69
+ required: true,
70
+ },
71
+ {
72
+ name: 'head',
73
+ description: 'New release tag - e.g., v1.1.0',
74
+ required: true,
75
+ },
76
+ ],
77
+ },
78
+ ];
79
+ /**
80
+ * Generate a prompt result for release notes
81
+ */
82
+ export function getReleaseNotesPrompt(name, args) {
83
+ const owner = args.owner;
84
+ const repo = args.repo;
85
+ switch (name) {
86
+ case 'release_notes':
87
+ const base = args.base;
88
+ const head = args.head;
89
+ return {
90
+ messages: [
91
+ {
92
+ role: 'user',
93
+ content: {
94
+ type: 'text',
95
+ text: `Please generate release notes for ${owner}/${repo} comparing ${base} to ${head}.
96
+
97
+ Use these tools:
98
+ 1. github_repos_compare_commits - Compare the two refs to get all commits
99
+ 2. github_pulls_list - Get merged PRs (state: closed) to find associated PRs
100
+ 3. github_issues_list - Get closed issues that might be referenced
101
+
102
+ Generate release notes in this format:
103
+
104
+ # Release Notes: ${head}
105
+
106
+ ## Overview
107
+ Brief summary of this release (2-3 sentences).
108
+
109
+ ## Breaking Changes
110
+ List any breaking changes that require user action.
111
+
112
+ ## New Features
113
+ - Feature descriptions from commits/PRs with conventional commit type "feat"
114
+
115
+ ## Bug Fixes
116
+ - Bug fixes from commits/PRs with conventional commit type "fix"
117
+
118
+ ## Improvements
119
+ - Enhancements, refactors, and other improvements
120
+
121
+ ## Documentation
122
+ - Documentation updates
123
+
124
+ ## Dependencies
125
+ - Dependency updates
126
+
127
+ ## Contributors
128
+ List of contributors to this release.
129
+
130
+ ---
131
+
132
+ **Full Changelog**: ${base}...${head}
133
+
134
+ Parse conventional commit messages where available (feat:, fix:, docs:, chore:, etc.).
135
+ Group commits logically and write clear, user-friendly descriptions.`,
136
+ },
137
+ },
138
+ ],
139
+ };
140
+ case 'changelog':
141
+ const days = parseInt(args.since) || 30;
142
+ return {
143
+ messages: [
144
+ {
145
+ role: 'user',
146
+ content: {
147
+ type: 'text',
148
+ text: `Please generate a changelog for ${owner}/${repo} from the last ${days} days.
149
+
150
+ Use these tools:
151
+ 1. github_repos_list_commits - Get recent commits
152
+ 2. github_pulls_list - Get recently merged PRs (state: closed)
153
+
154
+ Generate a changelog:
155
+
156
+ # Changelog
157
+
158
+ ## [Unreleased]
159
+
160
+ ### Added
161
+ - New features (feat: commits)
162
+
163
+ ### Changed
164
+ - Changes to existing functionality
165
+
166
+ ### Deprecated
167
+ - Features that will be removed
168
+
169
+ ### Removed
170
+ - Removed features
171
+
172
+ ### Fixed
173
+ - Bug fixes (fix: commits)
174
+
175
+ ### Security
176
+ - Security-related changes
177
+
178
+ ---
179
+
180
+ Group commits by type based on conventional commit prefixes.
181
+ Include PR numbers and links where applicable.
182
+ Only include commits from the last ${days} days.`,
183
+ },
184
+ },
185
+ ],
186
+ };
187
+ case 'whats_new':
188
+ const prevRelease = args.base;
189
+ const newRelease = args.head;
190
+ return {
191
+ messages: [
192
+ {
193
+ role: 'user',
194
+ content: {
195
+ type: 'text',
196
+ text: `Please generate a user-friendly "What's New" summary for ${owner}/${repo} release ${newRelease}.
197
+
198
+ Use these tools:
199
+ 1. github_repos_compare_commits - Compare ${prevRelease} to ${newRelease}
200
+ 2. github_pulls_list - Get merged PRs for context
201
+
202
+ Generate a "What's New" post suitable for users (not developers):
203
+
204
+ # What's New in ${newRelease}
205
+
206
+ ## Highlights
207
+ Top 3-5 most impactful changes in plain language.
208
+
209
+ ## New Features
210
+ User-facing features explained simply:
211
+ - **Feature Name**: What it does and why it's useful
212
+
213
+ ## Improvements
214
+ Quality of life improvements:
215
+ - What got better and how it helps users
216
+
217
+ ## Bug Fixes
218
+ Notable fixes that affected users:
219
+ - What was broken and that it's now fixed
220
+
221
+ ## Getting Started
222
+ How to update and try the new features.
223
+
224
+ ---
225
+
226
+ Write in a friendly, accessible tone.
227
+ Focus on user benefits, not technical implementation.
228
+ Avoid jargon and commit message details.`,
229
+ },
230
+ },
231
+ ],
232
+ };
233
+ default:
234
+ return null;
235
+ }
236
+ }
package/dist/server.d.ts CHANGED
@@ -1,4 +1,11 @@
1
+ /**
2
+ * Server startup options
3
+ */
4
+ export interface ServerOptions {
5
+ /** Categories to load (default: all) */
6
+ categories?: string[];
7
+ }
1
8
  /**
2
9
  * Start the MCP server with authenticated Octokit
3
10
  */
4
- export declare function startServer(token: string): Promise<void>;
11
+ export declare function startServer(token: string, options?: ServerOptions): Promise<void>;
package/dist/server.js CHANGED
@@ -1,11 +1,23 @@
1
1
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
- import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
3
+ import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
4
4
  import { Octokit } from '@octokit/rest';
5
+ import { createToolGenerator } from './tools/generator.js';
6
+ import { activityPrompts, getActivityPrompt } from './prompts/activity-summary.js';
7
+ import { codeReviewPrompts, getCodeReviewPrompt } from './prompts/code-review.js';
8
+ import { issueTriagePrompts, getIssueTriagePrompt } from './prompts/issue-triage.js';
9
+ import { releaseNotesPrompts, getReleaseNotesPrompt } from './prompts/release-notes.js';
10
+ // Combine all prompts
11
+ const allPrompts = [
12
+ ...activityPrompts,
13
+ ...codeReviewPrompts,
14
+ ...issueTriagePrompts,
15
+ ...releaseNotesPrompts,
16
+ ];
5
17
  /**
6
18
  * Start the MCP server with authenticated Octokit
7
19
  */
8
- export async function startServer(token) {
20
+ export async function startServer(token, options = {}) {
9
21
  const octokit = new Octokit({ auth: token });
10
22
  // Verify token works
11
23
  try {
@@ -15,230 +27,44 @@ export async function startServer(token) {
15
27
  catch (error) {
16
28
  throw new Error('Failed to authenticate with GitHub. Token may be invalid.');
17
29
  }
30
+ // Initialize tool generator with specified categories
31
+ const generator = createToolGenerator(options.categories);
18
32
  const server = new Server({
19
33
  name: 'github-mcp',
20
34
  version: '0.1.0',
21
35
  }, {
22
36
  capabilities: {
23
37
  tools: {},
38
+ prompts: {},
24
39
  },
25
40
  });
26
41
  // List available tools
27
42
  server.setRequestHandler(ListToolsRequestSchema, async () => {
28
43
  return {
29
- tools: [
30
- {
31
- name: 'github_repos_list',
32
- description: 'List repositories for the authenticated user',
33
- inputSchema: {
34
- type: 'object',
35
- properties: {
36
- visibility: {
37
- type: 'string',
38
- enum: ['all', 'public', 'private'],
39
- description: 'Filter by visibility',
40
- },
41
- sort: {
42
- type: 'string',
43
- enum: ['created', 'updated', 'pushed', 'full_name'],
44
- description: 'Sort field',
45
- },
46
- per_page: {
47
- type: 'number',
48
- description: 'Results per page (max 100)',
49
- },
50
- },
51
- },
52
- },
53
- {
54
- name: 'github_repos_get',
55
- description: 'Get a repository by owner and name',
56
- inputSchema: {
57
- type: 'object',
58
- properties: {
59
- owner: {
60
- type: 'string',
61
- description: 'Repository owner',
62
- },
63
- repo: {
64
- type: 'string',
65
- description: 'Repository name',
66
- },
67
- },
68
- required: ['owner', 'repo'],
69
- },
70
- },
71
- {
72
- name: 'github_issues_list',
73
- description: 'List issues for a repository',
74
- inputSchema: {
75
- type: 'object',
76
- properties: {
77
- owner: {
78
- type: 'string',
79
- description: 'Repository owner',
80
- },
81
- repo: {
82
- type: 'string',
83
- description: 'Repository name',
84
- },
85
- state: {
86
- type: 'string',
87
- enum: ['open', 'closed', 'all'],
88
- description: 'Issue state filter',
89
- },
90
- per_page: {
91
- type: 'number',
92
- description: 'Results per page (max 100)',
93
- },
94
- },
95
- required: ['owner', 'repo'],
96
- },
97
- },
98
- {
99
- name: 'github_issues_create',
100
- description: 'Create a new issue',
101
- inputSchema: {
102
- type: 'object',
103
- properties: {
104
- owner: {
105
- type: 'string',
106
- description: 'Repository owner',
107
- },
108
- repo: {
109
- type: 'string',
110
- description: 'Repository name',
111
- },
112
- title: {
113
- type: 'string',
114
- description: 'Issue title',
115
- },
116
- body: {
117
- type: 'string',
118
- description: 'Issue body',
119
- },
120
- labels: {
121
- type: 'array',
122
- items: { type: 'string' },
123
- description: 'Labels to add',
124
- },
125
- },
126
- required: ['owner', 'repo', 'title'],
127
- },
128
- },
129
- {
130
- name: 'github_pulls_list',
131
- description: 'List pull requests for a repository',
132
- inputSchema: {
133
- type: 'object',
134
- properties: {
135
- owner: {
136
- type: 'string',
137
- description: 'Repository owner',
138
- },
139
- repo: {
140
- type: 'string',
141
- description: 'Repository name',
142
- },
143
- state: {
144
- type: 'string',
145
- enum: ['open', 'closed', 'all'],
146
- description: 'PR state filter',
147
- },
148
- per_page: {
149
- type: 'number',
150
- description: 'Results per page (max 100)',
151
- },
152
- },
153
- required: ['owner', 'repo'],
154
- },
155
- },
156
- {
157
- name: 'github_user_get',
158
- description: 'Get the authenticated user',
159
- inputSchema: {
160
- type: 'object',
161
- properties: {},
162
- },
163
- },
164
- ],
44
+ tools: generator.getTools(),
165
45
  };
166
46
  });
167
47
  // Handle tool calls
168
48
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
169
49
  const { name, arguments: args } = request.params;
170
- try {
171
- switch (name) {
172
- case 'github_repos_list': {
173
- const { data } = await octokit.repos.listForAuthenticatedUser({
174
- visibility: args?.visibility,
175
- sort: args?.sort,
176
- per_page: args?.per_page,
177
- });
178
- return {
179
- content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
180
- };
181
- }
182
- case 'github_repos_get': {
183
- const { data } = await octokit.repos.get({
184
- owner: args?.owner,
185
- repo: args?.repo,
186
- });
187
- return {
188
- content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
189
- };
190
- }
191
- case 'github_issues_list': {
192
- const { data } = await octokit.issues.listForRepo({
193
- owner: args?.owner,
194
- repo: args?.repo,
195
- state: args?.state,
196
- per_page: args?.per_page,
197
- });
198
- return {
199
- content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
200
- };
201
- }
202
- case 'github_issues_create': {
203
- const { data } = await octokit.issues.create({
204
- owner: args?.owner,
205
- repo: args?.repo,
206
- title: args?.title,
207
- body: args?.body,
208
- labels: args?.labels,
209
- });
210
- return {
211
- content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
212
- };
213
- }
214
- case 'github_pulls_list': {
215
- const { data } = await octokit.pulls.list({
216
- owner: args?.owner,
217
- repo: args?.repo,
218
- state: args?.state,
219
- per_page: args?.per_page,
220
- });
221
- return {
222
- content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
223
- };
224
- }
225
- case 'github_user_get': {
226
- const { data } = await octokit.users.getAuthenticated();
227
- return {
228
- content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
229
- };
230
- }
231
- default:
232
- throw new Error(`Unknown tool: ${name}`);
233
- }
234
- }
235
- catch (error) {
236
- const message = error instanceof Error ? error.message : String(error);
237
- return {
238
- content: [{ type: 'text', text: `Error: ${message}` }],
239
- isError: true,
240
- };
241
- }
50
+ return generator.executeTool(octokit, name, args ?? {});
51
+ });
52
+ // List available prompts
53
+ server.setRequestHandler(ListPromptsRequestSchema, async () => {
54
+ return {
55
+ prompts: allPrompts,
56
+ };
57
+ });
58
+ // Handle prompt requests
59
+ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
60
+ const { name, arguments: args } = request.params;
61
+ const promptArgs = args ?? {};
62
+ // Try each prompt handler
63
+ const result = getCodeReviewPrompt(name, promptArgs) ??
64
+ getIssueTriagePrompt(name, promptArgs) ??
65
+ getReleaseNotesPrompt(name, promptArgs) ??
66
+ getActivityPrompt(name, promptArgs);
67
+ return result;
242
68
  });
243
69
  // Connect via stdio
244
70
  const transport = new StdioServerTransport();
@@ -1,5 +1,2 @@
1
- import { Octokit } from '@octokit/rest';
2
- import { Tool } from '@modelcontextprotocol/sdk/types.js';
3
- export declare const actionsTools: Tool[];
4
- export declare function handleActionsTool(octokit: Octokit, args: Record<string, unknown>): Promise<unknown>;
5
- //# sourceMappingURL=actions.d.ts.map
1
+ import type { ToolCategory } from '../types.js';
2
+ export declare const actionsCategory: ToolCategory;