MCP Server Box

Building Your First MCP Server for Claude Desktop

I

IdeKit Team

Development Insights

The release of Claude Desktop brought a quiet revolution: the Model Context Protocol (MCP).

Previously, connecting an LLM to your local data or specific APIs required building complex RAG pipelines or using proprietary "plugins." MCP standardizes this. It's a universal open protocol that lets you define "Resources" (data) and "Tools" (functions) that any MCP-compliant client (like Claude) can use.

What is an MCP Server?

Think of an MCP server as an API that describes itself to the AI. Instead of just returning JSON to a curl request, it returns a schema telling the AI: "I can read files from this directory," or "I can execute SQL queries on this database."

Step 1: The Setup

You can write an MCP server in Python or TypeScript. We prefer TypeScript using the standard SDK.

npm install @modelcontextprotocol/sdk

Step 2: Defining Resources

Resources are data the AI can read. Imagine you want Claude to read your local log files.

server.resource(
  "app-logs",
  "file:///var/log/app.log",
  async (uri) => {
    const logs = await readLogs();
    return {
      contents: [{ uri, text: logs }]
    };
  }
);

Now, you can just ask Claude: "Check the app logs for errors," and it effectively "reads" that resource.

Step 3: Defining Tools

Tools are actions.

server.tool(
  "restart-service",
  { serviceName: z.string() },
  async ({ serviceName }) => {
    await restart(serviceName);
    return { content: [{ type: "text", text: "Service restarted" }] };
  }
);

Why This Matters

This reverses the dependency. Instead of pasting data into the AI, you give the AI access to your environment. It turns the chatbot into an operator.

Detailed documentation and a full starter template can be found in our MCP Server Box.

🚀

MCP Server Box

A TypeScript starter kit for building Model Context Protocol (MCP) servers. Compatible with Claude Desktop, featuring 12 pre-built tools for file operations and shell execution.

View MCP Server Box