DEV Community

Cover image for MCP: The "Universal Remote" for Your AI
Bishoy Bishai
Bishoy Bishai

Posted on

MCP: The "Universal Remote" for Your AI

Let’s be honest, my human friend. Up until recently, talking to an AI was like talking to a genius who was locked in a dark room with no windows. It could tell you the meaning of life or write a poem in the style of Van Gogh, but if you asked it to actually do something—like check your calendar, update a lead in your CRM, or send an email—it would just look at you blankly and say, "I'm sorry, I can't do that".

You had to do the "manual labor" of copying and pasting code or text between windows. You’d ask ChatGPT to write an email, then you’d have to carry that text over to Gmail yourself. In a world "Surrounded by AI," that felt a bit primitive. It was like having a Ferrari but having to get out and push it every time you wanted to change lanes.

The main philosophy of human invention has always been to free our time from meaningless work so we can do things of greater value. That brings us to MCP—the Model Context Protocol. This is the bridge that turns your AI from a conversationalist into a "Maestro" of action.

What is MCP?

Think of MCP as the universal standard for how AI models (like Claude, Gemini, or ChatGPT) talk to the tools you use every day. It moves us away from simply possessing knowledge and toward taking direct action.In my book, I talk about the Maestro Shift—how we need to leave the player's seat and step up to the podium.

MCP is basically the baton. It is an agreed-upon standard, developed by Anthropic, so that every tool—from Salesforce to Notion—doesn't have to create its own unique method to connect with an AI.

The Two Superpowers of MCP:

  1. Real-Time Context: Instead of you manually uploading a file, the AI can "pull" context from the tool. If you ask for an analysis of new customer job titles, the model can reach directly into your CRM to find the answer.
  2. Autonomous Action: It allows the AI to perform the task for you. It can create a draft in your Gmail account or even send the email out directly.

The Architecture Breakdown

If you’re a developer (or a curious "Maestro"), here is the breakdown of the architecture. We aren't just inserting a bolt; we are understanding the whole engine.

  • The MCP Client: The interface you interact with (like Claude Desktop) that wants to use a tool.
  • The MCP Server: A small piece of code that acts as a translator, exposing specific tools or data to the AI.
  • The Tools: These are the digital "assistants" in your studio. They query the database, hit the API, or read the local files.

Building Your Own MCP Server

In the past, we were paid for what our hands made, but now the present requires us to lead. Building an MCP server is how you become the CEO of your talent. You provide the Vision and the Final Touch, while the AI handles the routine execution.

The Developer's Blueprint:

  1. Choose Your Language: Most developers use TypeScript/Node.js or Python to build their bridge.
  2. Define Your Tools: These are the functions your AI is allowed to call, like query_internal_database or summarize_meeting_notes.
  3. Implement the Connection: Use the MCP SDK to tell the AI what you can do. The AI asks, "What can you do?" and your server replies with a list of capabilities.

Let's try to build our own Email-Maestro

Let's Build MCP server to send emails is a brilliant way to give your AI tools "hands" to communicate. We’ll use the official MCP TypeScript SDK and Nodemailer for the email transport.

🛠 Prerequisites

You'll need node, npm, and an SMTP service (like Gmail, Resend, or Mailtrap).


1. Project Setup

First, initialize your project and install the necessary dependencies.

mkdir mcp-email-server
cd mcp-email-server
npm init -y
npm install @modelcontextprotocol/sdk nodemailer
npm install -D @types/node @types/nodemailer typescript
npx tsc --init

Enter fullscreen mode Exit fullscreen mode

2. The MCP Server Code

This server defines a tool called send_email. When the AI wants to send a message, it will provide the recipient, subject, and body.

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
  CallToolRequestSchema,
  ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
import nodemailer from "nodemailer";

// 1. Configure your Email Transport
// Replace these with your actual SMTP credentials or environment variables
const transporter = nodemailer.createTransport({
  host: "smtp.example.com",
  port: 587,
  secure: false, // true for 465, false for other ports
  auth: {
    user: "your-email@example.com",
    pass: "your-password",
  },
});

// 2. Initialize the MCP Server
const server = new Server(
  {
    name: "email-sender",
    version: "1.0.0",
  },
  {
    capabilities: {
      tools: {},
    },
  }
);

// 3. Define available tools
server.setRequestHandler(ListToolsRequestSchema, async () => {
  return {
    tools: [
      {
        name: "send_email",
        description: "Send an email to a specified recipient",
        inputSchema: {
          type: "object",
          properties: {
            to: { type: "string", description: "Recipient email address" },
            subject: { type: "string", description: "Email subject line" },
            body: { type: "string", description: "The plain text content of the email" },
          },
          required: ["to", "subject", "body"],
        },
      },
    ],
  };
});

// 4. Handle tool execution
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  if (request.params.name !== "send_email") {
    throw new Error("Tool not found");
  }

  const { to, subject, body } = request.params.arguments as {
    to: string;
    subject: string;
    body: string;
  };

  try {
    const info = await transporter.sendMail({
      from: '"MCP Assistant" <your-email@example.com>',
      to,
      subject,
      text: body,
    });

    return {
      content: [
        {
          type: "text",
          text: `Email sent successfully! Message ID: ${info.messageId}`,
        },
      ],
    };
  } catch (error) {
    return {
      content: [{ type: "text", text: `Failed to send email: ${error}` }],
      isError: true,
    };
  }
});

// 5. Start the server using Stdio transport
async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error("Email MCP Server running on stdio");
}

main().catch(console.error);

Enter fullscreen mode Exit fullscreen mode

3. How to Connect it to Claude

To use this in the Claude Desktop app, you need to add it to your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add this entry (pointing to your compiled JS file):

{
  "mcpServers": {
    "email-tools": {
      "command": "node",
      "args": ["/path/to/your/project/dist/index.js"]
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

💡 Pro Tips for Email MCPs

  • Environment Variables: Never hardcode your SMTP password. Use process.env.SMTP_PASS and pass it via the env field in your claude_desktop_config.json.
  • Confirmation: AI can be trigger-happy. You might want to add a "draft" mode or a manual verification step if you're worried about accidental sends.
  • HTML Support: You can easily extend the inputSchema to accept an html parameter if you want the AI to send styled emails.

If you like the idea you can go more deep:


✨ Let's keep the conversation going!

If you found this interesting, I'd love for you to check out more of my work or just drop in to say hello.

✍️ Read more on my blog: bishoy-bishai.github.io

Let's chat on LinkedIn: linkedin.com/in/bishoybishai

📘 Curious about AI?: You can also check out my book: Surrounded by AI

Top comments (0)