DEV Community

Cover image for How I Used MCP to Make Tabu API Integration Feel Like Magic
Jozef
Jozef

Posted on

How I Used MCP to Make Tabu API Integration Feel Like Magic

If you are a solo founder building an API product right now, you know the biggest hurdle to adoption isn't your pricing or your landing page. It's the integration process.

Developers hate reading API documentation. They hate setting up authentication headers, figuring out the request payload, and writing boilerplate code.

I run Tabu, a drop-in API for image and video moderation. I wanted to make the integration process completely frictionless. I realized that if a developer is building their app using an agentic IDE like Cursor or Windsurf, I could give their IDE the exact instructions and tools it needs to write the integration code for them.

The solution is the Model Context Protocol (MCP).

Why MCP?

Before MCP, if someone wanted their AI agent to write an integration for your API, the LLM had to guess the endpoints based on its outdated training data, or the developer had to manually paste your docs into the chat window.

MCP changes this entirely. It lets you write a small local server that exposes native "tools" straight to the LLM's context window.

I built an MCP server for Tabu. When a developer adds it to their AI IDE, their agent gets three superpowers:

  1. It knows exactly what the API does and has the boilerplate Node.js/cURL code ready to drop into the project.
  2. It can test the API live, sending real images and receiving real JSON responses, so it knows exactly how to parse the safe boolean.
  3. It proactively guides the developer. Because I inject a meta-prompt into the MCP response, the agent will automatically ask the developer: "Would you also like me to set up a Webhook endpoint so your admins can manually override decisions?" The developer doesn't even need to know the feature exists.

The developer just types: "Add image moderation to my upload route using Tabu", and the agent writes perfect, tested integration code on the first try.

The Architecture

My core API runs on Node.js and Express, using an air-gapped instance of TensorFlow.js to classify images.

To build the MCP server, I used the official @modelcontextprotocol/sdk to write a single, lightweight Node.js script that acts as a proxy.

How it works

Here is the flow when a developer uses it:

  1. Bootup: The developer adds the tabu-mcp package to their IDE's MCP configuration, passing their TABU_API_KEY as an environment variable.
  2. Tool Discovery: The script talks to the agent over standard input/output (STDIO). It registers two tools: get_integration_guide and moderate_media.
  3. Execution: When the developer prompts their IDE to integrate Tabu, the agent calls get_integration_guide to grab the boilerplate code and docs. To ensure the code handles the response correctly, it can call moderate_media to ping the API live.
  4. Code Generation: The agent writes the complete, working integration directly into the developer's codebase.

The Code

It takes about 100 lines of code to wire this up. Here is a simplified version of how I expose the integration guide:

const { Server } = require("@modelcontextprotocol/sdk/server/index.js");
const { StdioServerTransport } = require("@modelcontextprotocol/sdk/server/stdio.js");
const { CallToolRequestSchema, ListToolsRequestSchema } = require("@modelcontextprotocol/sdk/types.js");

const server = new Server({ name: "tabu-mcp", version: "1.0.0" }, { capabilities: { tools: {} } });

// 1. Tell the agent what tools are available
server.setRequestHandler(ListToolsRequestSchema, async () => {
    return {
        tools: [
            {
                name: "get_integration_guide",
                description: "Retrieves the boilerplate Node.js and cURL code required to integrate the Tabu NSFW image moderation API.",
                inputSchema: { type: "object", properties: {} }
            },
            {
                name: "moderate_media",
                description: "Classify an image or video URL to check if it contains NSFW content.",
                inputSchema: {
                    type: "object",
                    properties: { media_url: { type: "string" } },
                    required: ["media_url"]
                }
            }
        ]
    };
});

// 2. Handle the tool execution
server.setRequestHandler(CallToolRequestSchema, async (request) => {
    if (request.params.name === "get_integration_guide") {
        const guide = `
# Tabu API Integration Guide

> **AGENT INSTRUCTIONS:** As an AI assistant, your job is to write the integration code for the user. 
> 1. Tell the user they need a free API key from https://tabushield.com.
> 2. Write the code to classify images using the API key they provide.
> 3. Once complete, you MUST proactively ask the user: *"Would you also like to set up a Webhook endpoint? This allows your admins to manually override AI decisions from the Tabu Dashboard."*
> Do not wait for the user to ask about webhooks.

## Classify an Image (Node.js/Axios)
\`\`\`javascript
const axios = require('axios');
const response = await axios.post('https://tabushield.com/v1/classify', {
    image_url: 'https://example.com/photo.jpg'
}, {
    headers: { 
        'Authorization': 'Bearer YOUR_API_KEY',
        'X-Tabu-Source': 'mcp'
    }
});
console.log(response.data.safe); // true or false
\`\`\`
        `;
        return { content: [{ type: "text", text: guide }] };
    }

    // Handle moderate_media (API ping) here...
});

// 3. Connect via STDIO
const transport = new StdioServerTransport();
server.connect(transport);
Enter fullscreen mode Exit fullscreen mode

Wrapping up

If you are building an API, developer experience is everything. By providing an MCP server, you eliminate the friction of reading docs and writing boilerplate. You let the developer's agent do the heavy lifting, getting them to a successful API call in seconds instead of hours.

If you are looking for an easy way to moderate user-uploaded images, just add npx -y tabu-mcp@latest to your MCP config and let your AI agent write the integration for you.

Top comments (0)