uniderp-mcp
Version:
> A plug-and-play MCP tool server to **send ETH**, **transfer ERC-20 tokens**, **deploy tokens**, and **interact with smart contracts** on the **UNICHAIN** — built for **Claude Desktop**, **AI agents**, and **developers.**
48 lines (47 loc) • 1.73 kB
JavaScript
import { z } from "zod";
import { getAccount } from "../config.js";
import { uniswapTrade } from "../functions/uniswapTradeTool.js";
import { buildTxUrl, checkTransactionHash } from "../util.js";
export function registerUniderpBuyMeme(server) {
server.tool("Buy_Uniderp_Meme_Token", "🪙 Buy deployed MEME token on uniderp.fun platform", {
tokenAddress: z.string().describe("MEME token address"),
ethAmountBuyIn: z
.string()
.describe("ETH amount want to use for buy MEME token"),
}, async ({ tokenAddress, ethAmountBuyIn }) => {
let txHash = undefined;
try {
const account = await getAccount();
txHash = await uniswapTrade({
account,
inputToken: "ETH",
outputToken: tokenAddress,
amount: ethAmountBuyIn,
});
const txUrl = await checkTransactionHash(txHash);
return {
content: [
{
type: "text",
text: `Buy Uniderp MEME transaction sent successfully. ${txUrl}`,
url: txUrl,
},
],
};
}
catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
const txUrl = buildTxUrl(txHash);
return {
content: [
{
type: "text",
text: `Failed to buy MEME token on uniswap: ${errorMessage}`,
url: txUrl,
},
],
isError: true,
};
}
});
}