DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to build your first MCP tool server in TypeScript with TypeScript SDK

Expose a function as an MCP tool over stdio so Claude Code, Cursor or any MCP client can call it.

Short answer: Install the server package with npm install @modelcontextprotocol/server; then create an McpServer with a name and version, as in the README Getting Started example; register a tool with server.registerTool, giving it a description and a zod inputSchema, like the greet example. All steps.

  • Top pick
  • Software and DevOps
  • Intermediate
  • 45 minutes
  • From the README
  • Claude Code
  • Codex
  • Cursor
  • Gemini CLI

permissions. Any tool you register can be called by the connected agent, so do not expose functions that delete data or spend money without your own checks.

Who it is forA developer who wants an AI agent to use one of their own functions.

The problemAgents cannot call your internal logic until it is wrapped in a protocol they speak.

The outcomeA running stdio MCP server with one registered tool that any MCP client can list and call.

What you need first

  • Node.js with npm, or Bun or Deno as the README shows
  • The server package from `npm install @modelcontextprotocol/server`, or the client package from `npm install @modelcontextprotocol/client`
  • zod for tool input schemas, as in the README example

Steps

  1. Install the server package with npm install @modelcontextprotocol/server
  2. Create an McpServer with a name and version, as in the README Getting Started example
  3. Register a tool with server.registerTool, giving it a description and a zod inputSchema, like the greet example
  4. Connect a StdioServerTransport with server.connect and add the server to your MCP client

Prompt for your agent

Using modelcontextprotocol/typescript-sdk, install it with `npm install @modelcontextprotocol/server` and build a stdio MCP server that exposes <my function> as a tool with registerTool and a zod inputSchema, following the greet example.

Caveat. The README points to the docs tutorials for a full weather alert server; the snippet is a minimal greet tool.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for modelcontextprotocol/typescript-sdk and "Build your first MCP tool server in TypeScript"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer