|
|
@@ -202,6 +202,32 @@ const RemoveAllIssueLabelsSchema = z.object({
|
|
|
number: z.number().describe('Issue number'),
|
|
|
});
|
|
|
|
|
|
+const ListPublicOrganizationsSchema = z.object({
|
|
|
+ username: z.string().describe('Username to get public organizations for'),
|
|
|
+});
|
|
|
+
|
|
|
+const GetOrganizationSchema = z.object({
|
|
|
+ orgname: z.string().describe('Organization name'),
|
|
|
+});
|
|
|
+
|
|
|
+const UpdateOrganizationSchema = z.object({
|
|
|
+ orgname: z.string().describe('Organization name'),
|
|
|
+ full_name: z.string().optional().describe('Organization full name'),
|
|
|
+ description: z.string().optional().describe('Organization description'),
|
|
|
+ website: z.string().optional().describe('Organization website'),
|
|
|
+ location: z.string().optional().describe('Organization location'),
|
|
|
+});
|
|
|
+
|
|
|
+const AddOrganizationMemberSchema = z.object({
|
|
|
+ orgname: z.string().describe('Organization name'),
|
|
|
+ username: z.string().describe('Username to add as member'),
|
|
|
+ role: z.enum(['admin', 'member']).describe('Member role (admin or member)'),
|
|
|
+});
|
|
|
+
|
|
|
+const ListOrganizationTeamsSchema = z.object({
|
|
|
+ orgname: z.string().describe('Organization name'),
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* Create and configure an MCP server with all tools and handlers
|
|
|
*/
|
|
|
@@ -940,6 +966,109 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
required: ['owner', 'repo', 'number'],
|
|
|
},
|
|
|
},
|
|
|
+ {
|
|
|
+ name: 'list_user_organizations',
|
|
|
+ description: 'List organizations for the authenticated user',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {},
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'list_public_organizations',
|
|
|
+ description: 'List public organizations for a specific user',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ username: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Username to get public organizations for',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['username'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'get_organization',
|
|
|
+ description: 'Get information about a specific organization',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ orgname: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Organization name',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['orgname'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'update_organization',
|
|
|
+ description: 'Update an organization (requires owner permissions)',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ orgname: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Organization name',
|
|
|
+ },
|
|
|
+ full_name: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Organization full name',
|
|
|
+ },
|
|
|
+ description: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Organization description',
|
|
|
+ },
|
|
|
+ website: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Organization website',
|
|
|
+ },
|
|
|
+ location: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Organization location',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['orgname'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'add_organization_member',
|
|
|
+ description: 'Add or update organization membership (requires owner permissions)',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ orgname: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Organization name',
|
|
|
+ },
|
|
|
+ username: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Username to add as member',
|
|
|
+ },
|
|
|
+ role: {
|
|
|
+ type: 'string',
|
|
|
+ enum: ['admin', 'member'],
|
|
|
+ description: 'Member role (admin or member)',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['orgname', 'username', 'role'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'list_organization_teams',
|
|
|
+ description: 'List teams in an organization',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ orgname: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Organization name',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['orgname'],
|
|
|
+ },
|
|
|
+ },
|
|
|
],
|
|
|
};
|
|
|
});
|
|
|
@@ -1355,6 +1484,88 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ case 'list_user_organizations': {
|
|
|
+ const organizations = await gogsClient.listUserOrganizations();
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify(organizations, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'list_public_organizations': {
|
|
|
+ const { username } = ListPublicOrganizationsSchema.parse(args);
|
|
|
+ const organizations = await gogsClient.listPublicOrganizations(username);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify(organizations, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'get_organization': {
|
|
|
+ const { orgname } = GetOrganizationSchema.parse(args);
|
|
|
+ const organization = await gogsClient.getOrganization(orgname);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify(organization, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'update_organization': {
|
|
|
+ const { orgname, full_name, description, website, location } = UpdateOrganizationSchema.parse(args);
|
|
|
+ const organization = await gogsClient.updateOrganization(orgname, {
|
|
|
+ full_name,
|
|
|
+ description,
|
|
|
+ website,
|
|
|
+ location,
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify(organization, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'add_organization_member': {
|
|
|
+ const { orgname, username, role } = AddOrganizationMemberSchema.parse(args);
|
|
|
+ await gogsClient.addOrganizationMember(orgname, username, role);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: `User ${username} added to organization ${orgname} with role ${role}`,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'list_organization_teams': {
|
|
|
+ const { orgname } = ListOrganizationTeamsSchema.parse(args);
|
|
|
+ const teams = await gogsClient.listOrganizationTeams(orgname);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify(teams, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
default:
|
|
|
throw new Error(`Unknown tool: ${name}`);
|
|
|
}
|