Skip to content
Draft
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"description": "MCP Server for Dumpling AI providing various Data scraping, conversion, and extraction tools",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.7.0",
"@smithery/sdk": "^1.0.3",
"zod": "^3.24.2"
},
"devDependencies": {
Expand Down
133 changes: 132 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { createTransport } from "@smithery/sdk/transport.js";
import { z } from "zod";

const NWS_API_BASE = "https://app.dumplingai.com";
Expand Down Expand Up @@ -715,7 +716,7 @@ server.tool(
prompt,
jsonMode,
requestSource: "mcp",
}), // Assuming single image for simplicity
}),
});
if (!response.ok)
throw new Error(`Failed: ${response.status} ${await response.text()}`);
Expand Down Expand Up @@ -1053,6 +1054,136 @@ server.tool(
}
);

// Smithery integration tools
server.tool(
"smithery-sequential-thinking",
"Enhance reasoning with structured sequential thinking process.",
{
prompt: z.string().describe("The problem or question to think about"),
maxSteps: z.number().optional().default(5).describe("Maximum number of thinking steps"),
format: z.enum(["markdown", "json"]).optional().default("markdown").describe("Output format"),
},
async ({ prompt, maxSteps, format }) => {
const apiKey = process.env.SMITHERY_API_KEY;
if (!apiKey) throw new Error("SMITHERY_API_KEY not set");

try {
// Create Smithery transport
const transport = createTransport(
"https://server.smithery.ai/@smithery-ai/server-sequential-thinking",
{},
apiKey
);

// Call the sequential thinking tool
const response = await transport.callTool("sequential-thinking", {
prompt,
max_steps: maxSteps,
format,
});

return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
} catch (error) {
throw new Error(`Smithery API error: ${error.message}`);
}
}
);

server.tool(
"smithery-brave-search",
"Perform web searches using Brave Search via Smithery.",
{
query: z.string().describe("Search query"),
count: z.number().optional().default(10).describe("Number of results to return"),
country: z.string().optional().describe("Country code (e.g., 'us')"),
language: z.string().optional().describe("Language code (e.g., 'en')"),
},
async ({ query, count, country, language }) => {
const apiKey = process.env.SMITHERY_API_KEY;
if (!apiKey) throw new Error("SMITHERY_API_KEY not set");

try {
// Create Smithery transport
const transport = createTransport(
"https://server.smithery.ai/brave-search",
{},
apiKey
);

// Call the Brave search tool
const response = await transport.callTool("search", {
query,
count,
country,
language,
});

return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
} catch (error) {
throw new Error(`Smithery API error: ${error.message}`);
}
}
);

server.tool(
"smithery-browserbase",
"Automate browser interactions using Browserbase via Smithery.",
{
url: z.string().url().describe("URL to navigate to"),
action: z.enum(["navigate", "screenshot", "extract", "click", "type"]).describe("Action to perform"),
selector: z.string().optional().describe("CSS selector for click or type actions"),
text: z.string().optional().describe("Text to type"),
waitForSelector: z.string().optional().describe("Selector to wait for before action"),
},
async ({ url, action, selector, text, waitForSelector }) => {
const apiKey = process.env.SMITHERY_API_KEY;
if (!apiKey) throw new Error("SMITHERY_API_KEY not set");

try {
// Create Smithery transport
const transport = createTransport(
"https://server.smithery.ai/browserbase",
{},
apiKey
);

// Map actions to appropriate Browserbase tools
let toolName = "";
let params = {};

switch (action) {
case "navigate":
toolName = "navigate";
params = { url, waitForSelector };
break;
case "screenshot":
toolName = "screenshot";
params = { waitForSelector };
break;
case "extract":
toolName = "extract-page-content";
params = { waitForSelector };
break;
case "click":
toolName = "click";
params = { selector, waitForSelector };
break;
case "type":
toolName = "type";
params = { selector, text, waitForSelector };
break;
}

// Call the appropriate Browserbase tool
const response = await transport.callTool(toolName, params);

return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
} catch (error) {
throw new Error(`Smithery API error: ${error.message}`);
}
}
);

async function main() {
const transport = new StdioServerTransport();
await server.connect(transport);
Expand Down