Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions app/mcp/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { registerGetRandomNumberTool } from "@/lib/mcp/registerGetRandomNumberTool";
import { registerAddTool } from "@/lib/mcp/registerAddTool";
import { registerHelloRemoteTool } from "@/lib/mcp/registerHelloRemoteTool";
import { registerAllTools } from "@/lib/mcp/tools";
import { createMcpHandler } from "mcp-handler";

let handler: ReturnType<typeof createMcpHandler> | null = null;
Expand All @@ -14,9 +12,7 @@ async function getHandler(): Promise<ReturnType<typeof createMcpHandler>> {
if (!handler) {
handler = createMcpHandler(
server => {
registerGetRandomNumberTool(server);
registerAddTool(server);
registerHelloRemoteTool(server);
registerAllTools(server);
},
{
serverInfo: {
Expand Down
24 changes: 0 additions & 24 deletions lib/mcp/registerAddTool.ts

This file was deleted.

23 changes: 0 additions & 23 deletions lib/mcp/registerHelloRemoteTool.ts

This file was deleted.

14 changes: 14 additions & 0 deletions lib/mcp/tools/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { registerGetRandomNumberTool } from "./registerGetRandomNumberTool";
import { registerGetArtistSocialsTool } from "./registerGetArtistSocialsTool";

/**
* Registers all MCP tools on the server.
* Add new tools here to automatically register them.
*
* @param server - The MCP server instance to register tools on.
*/
export const registerAllTools = (server: McpServer): void => {
registerGetRandomNumberTool(server);
registerGetArtistSocialsTool(server);
};
28 changes: 28 additions & 0 deletions lib/mcp/tools/registerGetArtistSocialsTool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { getArtistSocials } from "@/lib/artist/getArtistSocials";
import {
ArtistSocialsQuery,
artistSocialsQuerySchema,
} from "@/lib/artist/validateArtistSocialsQuery";
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";

/**
* Registers the "get_artist_socials" tool on the MCP server.
* Retrieves all social profiles associated with an artist account.
*
* @param server - The MCP server instance to register the tool on.
*/
export function registerGetArtistSocialsTool(server: McpServer): void {
server.registerTool(
"get_artist_socials",
{
description:
"Retrieve all socials (handle, avatar, profile url, bio, follower count, following count) associated with an artist.",
inputSchema: artistSocialsQuerySchema,
},
async (args: ArtistSocialsQuery) => {
const result = await getArtistSocials(args);
return result as unknown as CallToolResult;
},
);
}