|
@@ -327,6 +327,14 @@ const RemoveCollaboratorSchema = z.object({
|
|
|
username: z.string().describe('Username to remove as collaborator'),
|
|
username: z.string().describe('Username to remove as collaborator'),
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const AddUserEmailsSchema = z.object({
|
|
|
|
|
+ emails: z.array(z.string()).describe('Array of email addresses to add'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const DeleteUserEmailsSchema = z.object({
|
|
|
|
|
+ emails: z.array(z.string()).describe('Array of email addresses to delete'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Create and configure an MCP server with all tools and handlers
|
|
* Create and configure an MCP server with all tools and handlers
|
|
|
*/
|
|
*/
|
|
@@ -1535,6 +1543,48 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
required: ['owner', 'repo', 'username'],
|
|
required: ['owner', 'repo', 'username'],
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'list_user_emails',
|
|
|
|
|
+ description: 'List email addresses for the authenticated user',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {},
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'add_user_emails',
|
|
|
|
|
+ description: 'Add email address(es) to the authenticated user account',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ emails: {
|
|
|
|
|
+ type: 'array',
|
|
|
|
|
+ items: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ },
|
|
|
|
|
+ description: 'Array of email addresses to add',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['emails'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'delete_user_emails',
|
|
|
|
|
+ description: 'Delete email address(es) from the authenticated user account',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ emails: {
|
|
|
|
|
+ type: 'array',
|
|
|
|
|
+ items: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ },
|
|
|
|
|
+ description: 'Array of email addresses to delete',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['emails'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
@@ -2266,6 +2316,48 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ case 'list_user_emails': {
|
|
|
|
|
+ const emails = await gogsClient.listUserEmails();
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(emails, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'add_user_emails': {
|
|
|
|
|
+ const { emails } = AddUserEmailsSchema.parse(args);
|
|
|
|
|
+ const addedEmails = await gogsClient.addUserEmails(emails);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(addedEmails, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'delete_user_emails': {
|
|
|
|
|
+ const { emails } = DeleteUserEmailsSchema.parse(args);
|
|
|
|
|
+ await gogsClient.deleteUserEmails(emails);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify({
|
|
|
|
|
+ success: true,
|
|
|
|
|
+ message: `Successfully deleted ${emails.length} email address(es)`,
|
|
|
|
|
+ emails
|
|
|
|
|
+ }, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
default:
|
|
default:
|
|
|
throw new Error(`Unknown tool: ${name}`);
|
|
throw new Error(`Unknown tool: ${name}`);
|
|
|
}
|
|
}
|