DEV Community

gentic news
gentic news

Posted on • Originally published at gentic.news

How to Build and Publish an MCP Server

Build an MCP server in ~600 lines of TypeScript with @modelcontextprotocol/sdk, using the X syndication endpoint trick, and publish to npm, Anthropic Registry, and Glama for maximum AI tool discoverability.

What Changed — The MCP Server as a Distribution Channel

A developer wrapped 14 X (Twitter) creator tools into an MCP server in ~600 lines of TypeScript. Two weeks after publishing, it had 500+ npm downloads — versus zero traffic from AI assistants after months of promoting the same functionality as a REST API.

The lesson: MCP isn't just a protocol. It's a distribution primitive for tools that AI assistants should call directly. For Claude Code users, this means every useful API or data source you rely on should be wrapped as an MCP server.

What It Means For You — MCP vs REST API for AI Workflows

If you've been thinking "I'll just document my REST API and let Claude Code call it" — reconsider. The problem: Claude Code has to know your API exists and be prompted to use it. With MCP, the client discovers your tools once, and from then on, whenever the LLM decides it needs your functionality, your tool is right there in its tool list.

This is especially relevant for Claude Code users who:

  • Frequently download tweets or scrape social data
  • Generate hashtags, engagement stats, or thread analyses
  • Want to integrate any third-party API into their AI workflow without manual prompting

Try It Now — Build Your Own MCP Server

The Stack (Nothing Exotic)

Cover image for I built an MCP server for X (Twitter) — 14 tools in ~600 lines, here's what I learned

npx -y xtapdown-mcp  # Runs the example server with zero setup
Enter fullscreen mode Exit fullscreen mode

Your MCP server needs:

  • TypeScript + @modelcontextprotocol/sdk
  • stdio transport for local Claude Code use
  • Streamable HTTP transport for remote clients
  • npm as primary distribution channel (npx -y your-package)

The Tool Handler Pattern

Each tool is a pure function, 20-40 lines:

server.tool(
  'download_tweet',
  {
    url: z.string().url().describe('X/Twitter post URL'),
    include_media: z.boolean().optional(),
  },
  async ({ url, include_media }) => {
    const tweet = await fetchTweet(url);
    return {
      content: [{ type: 'text', text: formatTweet(tweet, include_media) }],
    };
  },
);
Enter fullscreen mode Exit fullscreen mode

No database, no session state, no auth (if your underlying data endpoints are public). This keeps the whole thing auditable and distributable.

The Syndication Endpoint Trick

The single most useful discovery: X has a public JSON endpoint that returns full tweet data with no auth and no rate limits (in practice). Search for cdn.syndication.twimg.com/tweet-result.

You get:

  • Full text with entities
  • All attached media (video with variant URLs, images with source resolutions, GIFs as MP4)
  • Author info
  • Engagement stats (likes, retweets, replies, bookmarks, quotes)
  • Reply-to metadata for thread walking

Caveat: This is an undocumented endpoint. Cache responses and have a fallback plan.

Publishing — The Real Work (90% of Effort)

1. npm — Straightforward. Include mcpName in package.json:

{
  "mcpName": "io.github.youruser/your-mcp"
}
Enter fullscreen mode Exit fullscreen mode

This is the canonical ID for the Anthropic MCP Registry. Reverse-DNS style. Get it right on first publish.

2. Anthropic MCP Registry — Use the mcp-publisher Go CLI (from GitHub releases, not npm). Create a server.json:

{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "io.github.youruser/your-mcp",
  "description": "Your tools description",
  "repository": {
    "url": "https://github.com/youruser/your-mcp",
    "source": "github"
  },
  "packages": [
    {
      "registryName": "npm",
      "name": "your-mcp",
      "version": "..."
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Then:

mcp-publisher login github
mcp-publisher publish
Enter fullscreen mode Exit fullscreen mode

Validation is strict: description over 100 chars → rejected. Schema URL wrong → rejected.

3. Glama — Auto-discovers from GitHub. Builds a Docker image to test. If build fails, badge stays red. Ensure your Dockerfile works standalone.

4. awesome-mcp-servers — Open a PR. Keep the description crisp.

Why This Matters for Claude Code Users

Claude Code's power comes from tool use. Every MCP server you install expands what Claude Code can do in a single turn. The X toolkit example shows that wrapping existing APIs as MCP servers is cheap (~600 lines for 14 tools) and the distribution channel (npm + registries) is vastly more effective than REST API documentation.

If you have a data source or API you use regularly with Claude Code, invest an afternoon in wrapping it as an MCP server. The discoverability mechanics of MCP make it a force multiplier for your workflow.


Source: dev.to

[Updated 14 Jul via devto_mcp]

The MCP ecosystem has exploded far beyond individual toolkits: as of May 2026, there are 13,000+ MCP servers on npm and GitHub, with 97 million monthly SDK downloads — a 3x increase from six months ago. New server registrations are growing 400% year-over-year, and Anthropic's official filesystem server alone reaches 48,500 downloads per month [per dev.to]. This growth underscores the distribution advantage described in the X toolkit example, but also reveals a discovery gap that tools like the new mcp-hub CLI aim to solve.

[Updated 15 Jul via devto_mcp]

A separate metadata-layer privacy gap in MCP was highlighted by Z-TEXT, a messenger on the BitcoinZ blockchain that offers shielded agent-to-agent communication via zk-SNARKs. Z-TEXT doesn't replace MCP or A2A but can sit underneath them as a private transport for payload content, hiding sender, recipient, and amount on-chain — while leaving block timestamps public [per Z-TEXT]. This addresses a structural unlinkability problem that neither protocol was designed to solve, distinct from the recent OX Security RCE vulnerability affecting 200,000 MCP instances across 7,000+ public servers.

[Updated 15 Jul via lovable_blog_gn]

The MCP protocol imposes a hidden context-window cost: every tool's full definition (name, description, JSON schema) is sent on every request, whether called or not. The vellum MCP server [per devto_mcp] sidesteps this by splitting its surface — tools for acting (writing, moving notes) and resources for reading (stable URIs like vellum://note/projects/launch.md). Resources can be attached by reference without a tool call, and clients can subscribe to URI changes. The result: less context spent on plumbing, more room for actual content.


Originally published on gentic.news

Top comments (0)