|
|
@@ -401,6 +401,26 @@ const DeleteHookSchema = z.object({
|
|
|
hookId: z.number().describe('Webhook ID to delete'),
|
|
|
});
|
|
|
|
|
|
+const ListFollowersSchema = z.object({
|
|
|
+ username: z.string().describe('Username to list followers for'),
|
|
|
+});
|
|
|
+
|
|
|
+const ListFollowingSchema = z.object({
|
|
|
+ username: z.string().describe('Username to list following for'),
|
|
|
+});
|
|
|
+
|
|
|
+const CheckFollowingSchema = z.object({
|
|
|
+ username: z.string().describe('Username to check if authenticated user is following'),
|
|
|
+});
|
|
|
+
|
|
|
+const FollowUserSchema = z.object({
|
|
|
+ username: z.string().describe('Username to follow'),
|
|
|
+});
|
|
|
+
|
|
|
+const UnfollowUserSchema = z.object({
|
|
|
+ username: z.string().describe('Username to unfollow'),
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* Create and configure an MCP server with all tools and handlers
|
|
|
*/
|
|
|
@@ -1900,6 +1920,76 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
required: ['owner', 'repo', 'hookId'],
|
|
|
},
|
|
|
},
|
|
|
+ {
|
|
|
+ name: 'list_followers',
|
|
|
+ description: 'List followers of a specific user',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ username: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Username to list followers for',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['username'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'list_following',
|
|
|
+ description: 'List users that a specific user is following',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ username: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Username to list following for',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['username'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'check_following',
|
|
|
+ description: 'Check if the authenticated user is following a target user',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ username: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Username to check if authenticated user is following',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['username'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'follow_user',
|
|
|
+ description: 'Follow a user (authenticated user follows the target user)',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ username: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Username to follow',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['username'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'unfollow_user',
|
|
|
+ description: 'Unfollow a user (authenticated user unfollows the target user)',
|
|
|
+ inputSchema: {
|
|
|
+ type: 'object',
|
|
|
+ properties: {
|
|
|
+ username: {
|
|
|
+ type: 'string',
|
|
|
+ description: 'Username to unfollow',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ required: ['username'],
|
|
|
+ },
|
|
|
+ },
|
|
|
],
|
|
|
};
|
|
|
});
|
|
|
@@ -2807,6 +2897,85 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ case 'list_followers': {
|
|
|
+ const { username } = ListFollowersSchema.parse(args);
|
|
|
+ const followers = await gogsClient.listFollowers(username);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify(followers, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'list_following': {
|
|
|
+ const { username } = ListFollowingSchema.parse(args);
|
|
|
+ const following = await gogsClient.listFollowing(username);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify(following, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'check_following': {
|
|
|
+ const { username } = CheckFollowingSchema.parse(args);
|
|
|
+ const isFollowing = await gogsClient.checkFollowing(username);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify({
|
|
|
+ isFollowing,
|
|
|
+ username,
|
|
|
+ message: isFollowing
|
|
|
+ ? `You are following ${username}`
|
|
|
+ : `You are not following ${username}`
|
|
|
+ }, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'follow_user': {
|
|
|
+ const { username } = FollowUserSchema.parse(args);
|
|
|
+ await gogsClient.followUser(username);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify({
|
|
|
+ success: true,
|
|
|
+ message: `Successfully followed user ${username}`,
|
|
|
+ username
|
|
|
+ }, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ case 'unfollow_user': {
|
|
|
+ const { username } = UnfollowUserSchema.parse(args);
|
|
|
+ await gogsClient.unfollowUser(username);
|
|
|
+ return {
|
|
|
+ content: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ text: JSON.stringify({
|
|
|
+ success: true,
|
|
|
+ message: `Successfully unfollowed user ${username}`,
|
|
|
+ username
|
|
|
+ }, null, 2),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
default:
|
|
|
throw new Error(`Unknown tool: ${name}`);
|
|
|
}
|