MCP is the plug that lets AI apps use your tools. Here's a working server in about 15 lines, then what changes when it goes online
Written by
Alin Geevarghese Anil
Published on
October 8, 2026
MCP (Model Context Protocol) is a standard way to give an AI app access to tools: "look up this order", "create a ticket", "search these docs". You build a server that lists the tools, and any AI app that speaks MCP can use them. One server, lots of apps
stdio for local, HTTP for a server on the internetYou need Node.js. Make a folder, then:
npm init -y
npm install @modelcontextprotocol/sdk zodSave this as server.mjs:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import { z } from "zod"
const server = new McpServer({ name: "orders", version: "1.0.0" })
server.tool(
"get_order_status",
"Look up the status of an order by its ID",
{ orderId: z.string() },
async ({ orderId }) => ({
content: [{ type: "text", text: `Order ${orderId} shipped yesterday` }],
})
)
await server.connect(new StdioServerTransport())Swap the fake answer for a real database or API call and that's an MCP server
Most desktop AI apps and code editors read an mcpServers config. Add yours:
{
"mcpServers": {
"orders": { "command": "node", "args": ["/full/path/to/server.mjs"] }
}
}Restart the app, ask "what's the status of order 123?", and it calls your tool
A local server only runs on your machine. To share it, switch to the HTTP transport and put it behind a URL. Then it needs real auth: hosted AI apps expect OAuth with PKCE, and they'll look for discovery docs at /.well-known/oauth-authorization-server