@ldraney/github-mcp 0.1.0
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 +131 -0
- package/dist/auth/local-server.d.ts +16 -0
- package/dist/auth/local-server.js +146 -0
- package/dist/auth/oauth-device-flow.d.ts +20 -0
- package/dist/auth/oauth-device-flow.d.ts.map +1 -0
- package/dist/auth/oauth-device-flow.js +141 -0
- package/dist/auth/oauth-device-flow.js.map +1 -0
- package/dist/auth/oauth-flow.d.ts +20 -0
- package/dist/auth/oauth-flow.js +95 -0
- package/dist/auth/token-storage.d.ts +16 -0
- package/dist/auth/token-storage.d.ts.map +1 -0
- package/dist/auth/token-storage.js +33 -0
- package/dist/auth/token-storage.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/webhooks.d.ts +15 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +194 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +247 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/categories/actions.d.ts +5 -0
- package/dist/tools/categories/actions.d.ts.map +1 -0
- package/dist/tools/categories/actions.js +395 -0
- package/dist/tools/categories/actions.js.map +1 -0
- package/dist/tools/categories/gists.d.ts +5 -0
- package/dist/tools/categories/gists.d.ts.map +1 -0
- package/dist/tools/categories/gists.js +315 -0
- package/dist/tools/categories/gists.js.map +1 -0
- package/dist/tools/categories/issues.d.ts +5 -0
- package/dist/tools/categories/issues.d.ts.map +1 -0
- package/dist/tools/categories/issues.js +425 -0
- package/dist/tools/categories/issues.js.map +1 -0
- package/dist/tools/categories/orgs.d.ts +5 -0
- package/dist/tools/categories/orgs.d.ts.map +1 -0
- package/dist/tools/categories/orgs.js +452 -0
- package/dist/tools/categories/orgs.js.map +1 -0
- package/dist/tools/categories/pulls.d.ts +5 -0
- package/dist/tools/categories/pulls.d.ts.map +1 -0
- package/dist/tools/categories/pulls.js +370 -0
- package/dist/tools/categories/pulls.js.map +1 -0
- package/dist/tools/categories/repos.d.ts +5 -0
- package/dist/tools/categories/repos.d.ts.map +1 -0
- package/dist/tools/categories/repos.js +392 -0
- package/dist/tools/categories/repos.js.map +1 -0
- package/dist/tools/categories/search.d.ts +5 -0
- package/dist/tools/categories/search.d.ts.map +1 -0
- package/dist/tools/categories/search.js +217 -0
- package/dist/tools/categories/search.js.map +1 -0
- package/dist/tools/categories/users.d.ts +5 -0
- package/dist/tools/categories/users.d.ts.map +1 -0
- package/dist/tools/categories/users.js +247 -0
- package/dist/tools/categories/users.js.map +1 -0
- package/dist/tools/generator.d.ts +19 -0
- package/dist/tools/generator.d.ts.map +1 -0
- package/dist/tools/generator.js +69 -0
- package/dist/tools/generator.js.map +1 -0
- package/dist/webhooks/event-queue.d.ts +54 -0
- package/dist/webhooks/event-queue.d.ts.map +1 -0
- package/dist/webhooks/event-queue.js +117 -0
- package/dist/webhooks/event-queue.js.map +1 -0
- package/dist/webhooks/smee-client.d.ts +27 -0
- package/dist/webhooks/smee-client.d.ts.map +1 -0
- package/dist/webhooks/smee-client.js +153 -0
- package/dist/webhooks/smee-client.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
export const usersTools = [
|
|
2
|
+
{
|
|
3
|
+
name: 'github_users_getAuthenticated',
|
|
4
|
+
description: 'Get the authenticated user',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {},
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'github_users_get',
|
|
12
|
+
description: 'Get a user by username',
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
username: { type: 'string', description: 'GitHub username' },
|
|
17
|
+
},
|
|
18
|
+
required: ['username'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'github_users_updateAuthenticated',
|
|
23
|
+
description: 'Update the authenticated user profile',
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
name: { type: 'string', description: 'Display name' },
|
|
28
|
+
email: { type: 'string', description: 'Public email' },
|
|
29
|
+
blog: { type: 'string', description: 'Blog URL' },
|
|
30
|
+
twitter_username: { type: 'string', description: 'Twitter username' },
|
|
31
|
+
company: { type: 'string', description: 'Company name' },
|
|
32
|
+
location: { type: 'string', description: 'Location' },
|
|
33
|
+
hireable: { type: 'boolean', description: 'Available for hire' },
|
|
34
|
+
bio: { type: 'string', description: 'Bio text' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'github_users_listFollowers',
|
|
40
|
+
description: 'List followers of a user',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
username: { type: 'string', description: 'GitHub username (omit for authenticated user)' },
|
|
45
|
+
per_page: { type: 'number' },
|
|
46
|
+
page: { type: 'number' },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'github_users_listFollowing',
|
|
52
|
+
description: 'List users that a user is following',
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
username: { type: 'string', description: 'GitHub username (omit for authenticated user)' },
|
|
57
|
+
per_page: { type: 'number' },
|
|
58
|
+
page: { type: 'number' },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'github_users_checkFollowing',
|
|
64
|
+
description: 'Check if a user follows another user',
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
username: { type: 'string', description: 'User to check' },
|
|
69
|
+
target_user: { type: 'string', description: 'Target user to check if followed' },
|
|
70
|
+
},
|
|
71
|
+
required: ['username', 'target_user'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'github_users_follow',
|
|
76
|
+
description: 'Follow a user',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
username: { type: 'string', description: 'User to follow' },
|
|
81
|
+
},
|
|
82
|
+
required: ['username'],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'github_users_unfollow',
|
|
87
|
+
description: 'Unfollow a user',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
username: { type: 'string', description: 'User to unfollow' },
|
|
92
|
+
},
|
|
93
|
+
required: ['username'],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'github_users_listEmails',
|
|
98
|
+
description: 'List email addresses for the authenticated user',
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: 'object',
|
|
101
|
+
properties: {
|
|
102
|
+
per_page: { type: 'number' },
|
|
103
|
+
page: { type: 'number' },
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'github_users_addEmails',
|
|
109
|
+
description: 'Add email addresses for the authenticated user',
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
emails: {
|
|
114
|
+
type: 'array',
|
|
115
|
+
items: { type: 'string' },
|
|
116
|
+
description: 'Email addresses to add',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
required: ['emails'],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'github_users_listPublicKeys',
|
|
124
|
+
description: 'List public SSH keys for a user',
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
username: { type: 'string', description: 'GitHub username (omit for authenticated user)' },
|
|
129
|
+
per_page: { type: 'number' },
|
|
130
|
+
page: { type: 'number' },
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'github_users_createPublicKey',
|
|
136
|
+
description: 'Create a public SSH key for the authenticated user',
|
|
137
|
+
inputSchema: {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: {
|
|
140
|
+
title: { type: 'string', description: 'Key title' },
|
|
141
|
+
key: { type: 'string', description: 'Public key content' },
|
|
142
|
+
},
|
|
143
|
+
required: ['title', 'key'],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'github_users_listGpgKeys',
|
|
148
|
+
description: 'List GPG keys for a user',
|
|
149
|
+
inputSchema: {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: {
|
|
152
|
+
username: { type: 'string', description: 'GitHub username (omit for authenticated user)' },
|
|
153
|
+
per_page: { type: 'number' },
|
|
154
|
+
page: { type: 'number' },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'github_users_listBlocked',
|
|
160
|
+
description: 'List users blocked by the authenticated user',
|
|
161
|
+
inputSchema: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
properties: {
|
|
164
|
+
per_page: { type: 'number' },
|
|
165
|
+
page: { type: 'number' },
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'github_users_block',
|
|
171
|
+
description: 'Block a user',
|
|
172
|
+
inputSchema: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {
|
|
175
|
+
username: { type: 'string', description: 'User to block' },
|
|
176
|
+
},
|
|
177
|
+
required: ['username'],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'github_users_unblock',
|
|
182
|
+
description: 'Unblock a user',
|
|
183
|
+
inputSchema: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
properties: {
|
|
186
|
+
username: { type: 'string', description: 'User to unblock' },
|
|
187
|
+
},
|
|
188
|
+
required: ['username'],
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
export async function handleUsersTool(octokit, args) {
|
|
193
|
+
const username = args.username;
|
|
194
|
+
// Get authenticated user
|
|
195
|
+
if (Object.keys(args).length === 0) {
|
|
196
|
+
const { data } = await octokit.users.getAuthenticated();
|
|
197
|
+
return data;
|
|
198
|
+
}
|
|
199
|
+
// Get user by username (simple get)
|
|
200
|
+
if (username && Object.keys(args).filter(k => k !== 'username').length === 0) {
|
|
201
|
+
const { data } = await octokit.users.getByUsername({ username });
|
|
202
|
+
return data;
|
|
203
|
+
}
|
|
204
|
+
// Update authenticated user
|
|
205
|
+
if ('name' in args || 'email' in args || 'blog' in args || 'bio' in args || 'company' in args || 'location' in args || 'hireable' in args || 'twitter_username' in args) {
|
|
206
|
+
const { data } = await octokit.users.updateAuthenticated(args);
|
|
207
|
+
return data;
|
|
208
|
+
}
|
|
209
|
+
// List followers
|
|
210
|
+
if ('per_page' in args || 'page' in args) {
|
|
211
|
+
if (username) {
|
|
212
|
+
const { data } = await octokit.users.listFollowersForUser({ username, ...args });
|
|
213
|
+
return data;
|
|
214
|
+
}
|
|
215
|
+
const { data } = await octokit.users.listFollowersForAuthenticatedUser(args);
|
|
216
|
+
return data;
|
|
217
|
+
}
|
|
218
|
+
// Check following
|
|
219
|
+
if ('target_user' in args && username) {
|
|
220
|
+
try {
|
|
221
|
+
await octokit.users.checkFollowingForUser({ username, target_user: args.target_user });
|
|
222
|
+
return { following: true };
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return { following: false };
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// Follow user
|
|
229
|
+
if (username && !('target_user' in args) && !('emails' in args) && !('key' in args)) {
|
|
230
|
+
await octokit.users.follow({ username });
|
|
231
|
+
return { success: true, message: `Now following ${username}` };
|
|
232
|
+
}
|
|
233
|
+
// List emails
|
|
234
|
+
if ('emails' in args && Array.isArray(args.emails)) {
|
|
235
|
+
const { data } = await octokit.users.addEmailForAuthenticatedUser({ emails: args.emails });
|
|
236
|
+
return data;
|
|
237
|
+
}
|
|
238
|
+
// Create public key
|
|
239
|
+
if ('title' in args && 'key' in args) {
|
|
240
|
+
const { data } = await octokit.users.createPublicSshKeyForAuthenticatedUser(args);
|
|
241
|
+
return data;
|
|
242
|
+
}
|
|
243
|
+
// Default: get authenticated user
|
|
244
|
+
const { data } = await octokit.users.getAuthenticated();
|
|
245
|
+
return data;
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../src/tools/categories/users.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC;QACE,IAAI,EAAE,+BAA+B;QACrC,WAAW,EAAE,4BAA4B;QACzC,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,wBAAwB;QACrC,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE;aAC7D;YACD,QAAQ,EAAE,CAAC,UAAU,CAAC;SACvB;KACF;IACD;QACE,IAAI,EAAE,kCAAkC;QACxC,WAAW,EAAE,uCAAuC;QACpD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;gBACrD,KAAK,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C,EAAE,CAAC;QACpF,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,QAAQ,EAAE,EAAE,CAAC;IACjE,CAAC;IAED,cAAc;IACd,IAAI,QAAQ,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAkB,EAAE,CAAC,CAAC;QACvG,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oBAAoB;IACpB,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,IAAkF,CAAC,CAAC;QAChK,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kCAAkC;IAClC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;IACxD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Octokit } from '@octokit/rest';
|
|
2
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Register tools with optional category filtering
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerTools(octokit: Octokit, enabledCategories?: string[]): void;
|
|
7
|
+
/**
|
|
8
|
+
* Get all registered tool definitions
|
|
9
|
+
*/
|
|
10
|
+
export declare function getToolDefinitions(): Tool[];
|
|
11
|
+
/**
|
|
12
|
+
* Handle a tool call
|
|
13
|
+
*/
|
|
14
|
+
export declare function handleToolCall(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* Get list of available categories
|
|
17
|
+
*/
|
|
18
|
+
export declare function getAvailableCategories(): string[];
|
|
19
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/tools/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AA+B1D;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAmBlF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,EAAE,CAE3C;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAWlG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { reposTools, handleReposTool } from './categories/repos.js';
|
|
2
|
+
import { issuesTools, handleIssuesTool } from './categories/issues.js';
|
|
3
|
+
import { pullsTools, handlePullsTool } from './categories/pulls.js';
|
|
4
|
+
import { usersTools, handleUsersTool } from './categories/users.js';
|
|
5
|
+
import { actionsTools, handleActionsTool } from './categories/actions.js';
|
|
6
|
+
import { gistsTools, handleGistsTool } from './categories/gists.js';
|
|
7
|
+
import { orgsTools, handleOrgsTool } from './categories/orgs.js';
|
|
8
|
+
import { searchTools, handleSearchTool } from './categories/search.js';
|
|
9
|
+
// Store octokit instance for tool handlers
|
|
10
|
+
let octokitInstance = null;
|
|
11
|
+
// All available tool categories
|
|
12
|
+
const CATEGORIES = {
|
|
13
|
+
repos: { tools: reposTools, handler: handleReposTool },
|
|
14
|
+
issues: { tools: issuesTools, handler: handleIssuesTool },
|
|
15
|
+
pulls: { tools: pullsTools, handler: handlePullsTool },
|
|
16
|
+
users: { tools: usersTools, handler: handleUsersTool },
|
|
17
|
+
actions: { tools: actionsTools, handler: handleActionsTool },
|
|
18
|
+
gists: { tools: gistsTools, handler: handleGistsTool },
|
|
19
|
+
orgs: { tools: orgsTools, handler: handleOrgsTool },
|
|
20
|
+
search: { tools: searchTools, handler: handleSearchTool },
|
|
21
|
+
};
|
|
22
|
+
// Active tools after filtering by enabled categories
|
|
23
|
+
let activeTools = [];
|
|
24
|
+
let activeHandlers = new Map();
|
|
25
|
+
/**
|
|
26
|
+
* Register tools with optional category filtering
|
|
27
|
+
*/
|
|
28
|
+
export function registerTools(octokit, enabledCategories) {
|
|
29
|
+
octokitInstance = octokit;
|
|
30
|
+
activeTools = [];
|
|
31
|
+
activeHandlers.clear();
|
|
32
|
+
const categoriesToLoad = enabledCategories
|
|
33
|
+
? enabledCategories.filter((c) => c in CATEGORIES)
|
|
34
|
+
: Object.keys(CATEGORIES);
|
|
35
|
+
for (const category of categoriesToLoad) {
|
|
36
|
+
const { tools, handler } = CATEGORIES[category];
|
|
37
|
+
for (const tool of tools) {
|
|
38
|
+
activeTools.push(tool);
|
|
39
|
+
activeHandlers.set(tool.name, handler);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
console.error(`Registered ${activeTools.length} tools from ${categoriesToLoad.length} categories`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get all registered tool definitions
|
|
46
|
+
*/
|
|
47
|
+
export function getToolDefinitions() {
|
|
48
|
+
return activeTools;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Handle a tool call
|
|
52
|
+
*/
|
|
53
|
+
export async function handleToolCall(name, args) {
|
|
54
|
+
if (!octokitInstance) {
|
|
55
|
+
throw new Error('Tools not initialized. Call registerTools first.');
|
|
56
|
+
}
|
|
57
|
+
const handler = activeHandlers.get(name);
|
|
58
|
+
if (!handler) {
|
|
59
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
60
|
+
}
|
|
61
|
+
return handler(octokitInstance, args);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get list of available categories
|
|
65
|
+
*/
|
|
66
|
+
export function getAvailableCategories() {
|
|
67
|
+
return Object.keys(CATEGORIES);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/tools/generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,2CAA2C;AAC3C,IAAI,eAAe,GAAmB,IAAI,CAAC;AAE3C,gCAAgC;AAChC,MAAM,UAAU,GAAG;IACjB,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE;IACtD,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE;IACzD,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE;IACtD,KAAK,E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aAAa,CAAC,CAAC;AACrG,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY,EAAE,IAA6B;IAC9E,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
export interface WebhookEvent {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
action?: string;
|
|
6
|
+
payload: Record<string, unknown>;
|
|
7
|
+
receivedAt: Date;
|
|
8
|
+
repository?: {
|
|
9
|
+
owner: string;
|
|
10
|
+
name: string;
|
|
11
|
+
full_name: string;
|
|
12
|
+
};
|
|
13
|
+
sender?: {
|
|
14
|
+
login: string;
|
|
15
|
+
id: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
declare class EventQueue extends EventEmitter {
|
|
19
|
+
private events;
|
|
20
|
+
private allEvents;
|
|
21
|
+
/**
|
|
22
|
+
* Add an event to the queue
|
|
23
|
+
*/
|
|
24
|
+
push(event: WebhookEvent): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get events by type
|
|
27
|
+
*/
|
|
28
|
+
getByType(type: string, limit?: number): WebhookEvent[];
|
|
29
|
+
/**
|
|
30
|
+
* Get all events
|
|
31
|
+
*/
|
|
32
|
+
getAll(limit?: number): WebhookEvent[];
|
|
33
|
+
/**
|
|
34
|
+
* Get events by repository
|
|
35
|
+
*/
|
|
36
|
+
getByRepo(owner: string, repo: string, limit?: number): WebhookEvent[];
|
|
37
|
+
/**
|
|
38
|
+
* Get available event types
|
|
39
|
+
*/
|
|
40
|
+
getEventTypes(): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Clear all events
|
|
43
|
+
*/
|
|
44
|
+
clear(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get event counts by type
|
|
47
|
+
*/
|
|
48
|
+
getCounts(): Record<string, number>;
|
|
49
|
+
}
|
|
50
|
+
export declare const eventQueue: EventQueue;
|
|
51
|
+
export declare const EVENT_TYPES: readonly ["push", "pull_request", "pull_request_review", "pull_request_review_comment", "issues", "issue_comment", "create", "delete", "fork", "release", "workflow_run", "workflow_job", "check_run", "check_suite", "deployment", "deployment_status", "discussion", "discussion_comment", "label", "milestone", "project", "project_card", "project_column", "public", "star", "watch", "repository", "team", "team_add", "member", "membership", "organization", "org_block", "package", "page_build", "ping", "sponsorship", "status", "commit_comment", "gollum", "meta"];
|
|
52
|
+
export type EventType = typeof EVENT_TYPES[number];
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=event-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue.d.ts","sourceRoot":"","sources":["../../src/webhooks/event-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,CAAC,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH;AAID,cAAM,UAAW,SAAQ,YAAY;IACnC,OAAO,CAAC,MAAM,CAA0C;IACxD,OAAO,CAAC,SAAS,CAAsB;IAEvC;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAoB/B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,YAAY,EAAE;IAKnD;;OAEG;IACH,MAAM,CAAC,KAAK,SAAK,GAAG,YAAY,EAAE;IAIlC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,YAAY,EAAE;IAMlE;;OAEG;IACH,aAAa,IAAI,MAAM,EAAE;IAIzB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAOpC;AAGD,eAAO,MAAM,UAAU,YAAmB,CAAC;AAG3C,eAAO,MAAM,WAAW,ijBA0Cd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
const MAX_EVENTS_PER_TYPE = 100;
|
|
3
|
+
class EventQueue extends EventEmitter {
|
|
4
|
+
events = new Map();
|
|
5
|
+
allEvents = [];
|
|
6
|
+
/**
|
|
7
|
+
* Add an event to the queue
|
|
8
|
+
*/
|
|
9
|
+
push(event) {
|
|
10
|
+
// Add to all events
|
|
11
|
+
this.allEvents.unshift(event);
|
|
12
|
+
if (this.allEvents.length > MAX_EVENTS_PER_TYPE * 10) {
|
|
13
|
+
this.allEvents = this.allEvents.slice(0, MAX_EVENTS_PER_TYPE * 10);
|
|
14
|
+
}
|
|
15
|
+
// Add to type-specific queue
|
|
16
|
+
const typeEvents = this.events.get(event.type) || [];
|
|
17
|
+
typeEvents.unshift(event);
|
|
18
|
+
if (typeEvents.length > MAX_EVENTS_PER_TYPE) {
|
|
19
|
+
typeEvents.pop();
|
|
20
|
+
}
|
|
21
|
+
this.events.set(event.type, typeEvents);
|
|
22
|
+
// Emit event for subscribers
|
|
23
|
+
this.emit('event', event);
|
|
24
|
+
this.emit(event.type, event);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get events by type
|
|
28
|
+
*/
|
|
29
|
+
getByType(type, limit = 50) {
|
|
30
|
+
const events = this.events.get(type) || [];
|
|
31
|
+
return events.slice(0, limit);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get all events
|
|
35
|
+
*/
|
|
36
|
+
getAll(limit = 50) {
|
|
37
|
+
return this.allEvents.slice(0, limit);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get events by repository
|
|
41
|
+
*/
|
|
42
|
+
getByRepo(owner, repo, limit = 50) {
|
|
43
|
+
return this.allEvents
|
|
44
|
+
.filter(e => e.repository?.owner === owner && e.repository?.name === repo)
|
|
45
|
+
.slice(0, limit);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get available event types
|
|
49
|
+
*/
|
|
50
|
+
getEventTypes() {
|
|
51
|
+
return Array.from(this.events.keys());
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Clear all events
|
|
55
|
+
*/
|
|
56
|
+
clear() {
|
|
57
|
+
this.events.clear();
|
|
58
|
+
this.allEvents = [];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get event counts by type
|
|
62
|
+
*/
|
|
63
|
+
getCounts() {
|
|
64
|
+
const counts = {};
|
|
65
|
+
for (const [type, events] of this.events) {
|
|
66
|
+
counts[type] = events.length;
|
|
67
|
+
}
|
|
68
|
+
return counts;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Singleton instance
|
|
72
|
+
export const eventQueue = new EventQueue();
|
|
73
|
+
// Common webhook event types
|
|
74
|
+
export const EVENT_TYPES = [
|
|
75
|
+
'push',
|
|
76
|
+
'pull_request',
|
|
77
|
+
'pull_request_review',
|
|
78
|
+
'pull_request_review_comment',
|
|
79
|
+
'issues',
|
|
80
|
+
'issue_comment',
|
|
81
|
+
'create',
|
|
82
|
+
'delete',
|
|
83
|
+
'fork',
|
|
84
|
+
'release',
|
|
85
|
+
'workflow_run',
|
|
86
|
+
'workflow_job',
|
|
87
|
+
'check_run',
|
|
88
|
+
'check_suite',
|
|
89
|
+
'deployment',
|
|
90
|
+
'deployment_status',
|
|
91
|
+
'discussion',
|
|
92
|
+
'discussion_comment',
|
|
93
|
+
'label',
|
|
94
|
+
'milestone',
|
|
95
|
+
'project',
|
|
96
|
+
'project_card',
|
|
97
|
+
'project_column',
|
|
98
|
+
'public',
|
|
99
|
+
'star',
|
|
100
|
+
'watch',
|
|
101
|
+
'repository',
|
|
102
|
+
'team',
|
|
103
|
+
'team_add',
|
|
104
|
+
'member',
|
|
105
|
+
'membership',
|
|
106
|
+
'organization',
|
|
107
|
+
'org_block',
|
|
108
|
+
'package',
|
|
109
|
+
'page_build',
|
|
110
|
+
'ping',
|
|
111
|
+
'sponsorship',
|
|
112
|
+
'status',
|
|
113
|
+
'commit_comment',
|
|
114
|
+
'gollum', // wiki events
|
|
115
|
+
'meta',
|
|
116
|
+
];
|
|
117
|
+
//# sourceMappingURL=event-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue.js","sourceRoot":"","sources":["../../src/webhooks/event-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAmBtC,MAAM,mBAA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oBAAoB;IACpB,OAAO;IACP,WAAW;IACX,SAAS;IACT,cAAc;IACd,gBAAgB;IAChB,QAAQ;IACR,MAAM;IACN,OAAO;IACP,YAAY;IACZ,MAAM;IACN,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,cAAc;IACd,WAAW;IACX,SAAS;IACT,YAAY;IACZ,MAAM;IACN,aAAa;IACb,QAAQ;IACR,gBAAgB;IAChB,QAAQ,EAAE,cAAc;IACxB,MAAM;CACE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WebhookEvent } from './event-queue.js';
|
|
2
|
+
import { Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Start the smee.io webhook client
|
|
5
|
+
*/
|
|
6
|
+
export declare function startWebhookClient(url: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* Stop the webhook client
|
|
9
|
+
*/
|
|
10
|
+
export declare function stopWebhookClient(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Get the current smee URL
|
|
13
|
+
*/
|
|
14
|
+
export declare function getSmeeUrl(): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Get webhook resources for MCP
|
|
17
|
+
*/
|
|
18
|
+
export declare function getWebhookResources(): Resource[];
|
|
19
|
+
/**
|
|
20
|
+
* Get webhook events for a resource URI
|
|
21
|
+
*/
|
|
22
|
+
export declare function getWebhookEvents(uri: string): WebhookEvent[] | Record<string, unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Generate a new smee.io channel URL
|
|
25
|
+
*/
|
|
26
|
+
export declare function createSmeeChannel(): Promise<string>;
|
|
27
|
+
//# sourceMappingURL=smee-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smee-client.d.ts","sourceRoot":"","sources":["../../src/webhooks/smee-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAK9D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAiCpD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAOxC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAE1C;AAwCD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,EAAE,CAmChD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAatF;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAYzD"}
|