惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
V
V2EX
博客园 - 【当耐特】
Vercel News
Vercel News
雷峰网
雷峰网
爱范儿
爱范儿
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Azure Blog
Microsoft Azure Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
NISL@THU
NISL@THU
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
P
Proofpoint News Feed
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
K
Kaspersky official blog
I
InfoQ
Google Online Security Blog
Google Online Security Blog
L
LINUX DO - 最新话题
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
V
Visual Studio Blog
AI
AI
Schneier on Security
Schneier on Security
B
Blog RSS Feed
T
Tor Project blog
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Cyber Attacks, Cyber Crime and Cyber Security
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
V2EX - 技术
V2EX - 技术
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
Arctic Wolf
Webroot Blog
Webroot Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Building an MCP server — lessons from thunderbit-mcp
Ethan Cole · 2026-05-11 · via DEV Community

When we started building thunderbit-mcp, the plan sounded straightforward: expose Thunderbit's web extraction API to AI coding agents through the Model Context Protocol.

In practice, the hard parts were not the SDK calls. The hard parts were product-shaped:

  • How many tools should the server expose?
  • What should a tool return when a page is blocked, slow, or only partially extracted?
  • Should the server run locally over stdio, remotely over HTTP, or both?
  • How much should the LLM decide, and how much should the tool force into a schema?
  • What makes an MCP server feel dependable instead of magical?

This post is a field guide from shipping an MCP server for web data extraction. The examples use Thunderbit because that is the system we were working on, but the lessons apply to most MCP servers that wrap an existing API.

MCP is small. The product surface is not.

MCP gives you a clean frame: a host application talks to an MCP server; the server exposes tools, resources, prompts, and capabilities; messages move over JSON-RPC; the connection goes through initialization, operation, and shutdown.

That sounds tiny, which is part of the appeal.

But the minute you ship a server to real users, you are no longer only designing a protocol adapter. You are designing an interface for an AI agent.

That changes the questions.

A REST API can assume the caller is a developer who read the docs. An MCP tool is often called by a model that inferred intent from one sentence:

"Grab the pricing tables from these competitor pages and give me a CSV."

The model may not know whether to fetch raw HTML, render JavaScript, extract structured fields, paginate, or retry with a different region. A good MCP server turns that ambiguity into a small number of safe, predictable decisions.

For thunderbit-mcp, we treated the MCP layer as a product API, not a thin wrapper around every internal endpoint.

Lesson 1: Fewer tools are usually better

The first temptation is to expose everything:

  • distill
  • extract
  • batchDistill
  • batchExtract
  • getJob
  • cancelJob
  • listJobs
  • render
  • screenshot
  • proxyDebug
  • credits
  • schemaInfer

That looks complete, but it creates decision fatigue for the model. Tool descriptions start overlapping. The agent has to decide between five similar verbs before it has even helped the user.

We had better results when tools mapped to user intent instead of internal API shape:

fetch_page_content(url, options)
extract_structured_data(url, schema, options)
extract_many_pages(urls, schema_or_mode, webhook?)
check_extraction_job(job_id)

Enter fullscreen mode Exit fullscreen mode

The important detail is not the exact names. It is that each tool answers a distinct question:

  • "I need readable page content."
  • "I need fields that match a schema."
  • "I need to run this across many URLs."
  • "I need to check async progress."

If two tools are hard for you to explain in one sentence without using implementation words, merge them or make one an option.

Lesson 2: Tool descriptions are part of the runtime

In normal API design, descriptions are documentation. In MCP, descriptions are also model steering.

This means vague descriptions are expensive.

Bad:

Extract data from a URL.

Enter fullscreen mode Exit fullscreen mode

Better:

Extract structured data from a public web page using a JSON Schema.
Use this when the user asks for specific fields such as prices, names,
emails, dates, reviews, listings, tables, or product attributes.
Returns JSON that conforms to the provided schema when possible.

Enter fullscreen mode Exit fullscreen mode

That description teaches the agent when to call the tool. It also prevents the common mistake of using extraction when the user only needs a readable summary.

We also learned to include negative guidance:

Do not use this tool for private pages that require the user's logged-in
browser session. Do not use it for actions such as clicking buttons,
submitting forms, or making purchases.

Enter fullscreen mode Exit fullscreen mode

Negative guidance matters because web automation is a broad mental category. If your server only reads pages, say so. If it can act on pages, be even more explicit.

Lesson 3: Schemas beat clever prompts

For web extraction, a natural first version is:

{
  "url": "https://example.com/product",
  "prompt": "Get the product name, price, rating, and availability."
}

Enter fullscreen mode Exit fullscreen mode

That works for demos. It is less fun in production.

We moved toward JSON Schema as the primary contract:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The product name as shown on the page"
    },
    "price": {
      "type": "number",
      "description": "Current listed price in USD, excluding shipping"
    },
    "inStock": {
      "type": "boolean",
      "description": "Whether the product appears available to buy"
    }
  },
  "required": ["name", "price"]
}

Enter fullscreen mode Exit fullscreen mode

This did three useful things:

  1. It made the user's expected output machine-checkable.
  2. It let the model create or refine the schema before calling the tool.
  3. It reduced downstream cleanup because the result already had shape.

The funny thing about agents is that they are often better at writing a schema than at remembering all the implicit constraints in a prose prompt. Use that.

Lesson 4: Return boring errors

AI agents do not need poetic error messages. They need errors they can act on.

For thunderbit-mcp, we tried to keep tool failures in a small set of categories:

  • INVALID_INPUT
  • AUTH_REQUIRED
  • RATE_LIMITED
  • FETCH_FAILED
  • EXTRACTION_FAILED
  • PARTIAL_RESULT
  • JOB_PENDING

Each error includes:

  • a short human-readable message
  • whether retrying makes sense
  • any safe next action
  • the request or job ID for debugging

Example:

{
  "code": "RATE_LIMITED",
  "message": "The request hit the current account rate limit.",
  "retryable": true,
  "retryAfterSeconds": 60
}

Enter fullscreen mode Exit fullscreen mode

The goal is not to hide complexity. It is to keep the agent from improvising. A model that sees retryAfterSeconds is much more likely to wait or explain the limit than to spam the same tool call five times.

Lesson 5: stdio is the best first transport

The MCP spec currently defines two standard transports: stdio and Streamable HTTP.

For a first server, stdio is usually the calmest path:

  • The client launches your server as a subprocess.
  • You read JSON-RPC messages from stdin.
  • You write protocol messages to stdout.
  • You write logs to stderr.

That last point is worth underlining. Do not log to stdout. In stdio MCP, stdout is protocol space. A single stray console.log("debug") can break the client connection.

stdio is a good fit when:

  • users run the server locally
  • configuration is mostly environment variables
  • the server is a wrapper around an API
  • you want broad compatibility with desktop agents and coding tools

Streamable HTTP becomes attractive when:

  • you want a hosted server
  • auth is browser-based or OAuth-based
  • multiple clients need to connect
  • you need resumability, session management, or server-to-client notifications

For Thunderbit, stdio made the initial developer workflow simple: install, add config to the MCP client, pass an API key, and start using tools. A remote HTTP server is a better second step once the auth and tenancy story are mature.

Lesson 6: Treat authentication as UX

Auth is not just a security feature. In MCP, auth is often the first moment of truth.

If setup requires five steps, three dashboards, and a mystery config file, many users will assume the server is broken.

The local stdio version should make the happy path obvious:

npx thunderbit-mcp

Enter fullscreen mode Exit fullscreen mode

And the MCP client config should be boring:

{
  "mcpServers": {
    "thunderbit": {
      "command": "npx",
      "args": ["thunderbit-mcp"],
      "env": {
        "THUNDERBIT_API_KEY": "your_api_key"
      }
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

For hosted transports, use real auth. The MCP transport docs call out important security protections for HTTP servers, including origin validation, localhost binding for local servers, and proper authentication. Do not treat "it is just an agent tool" as a reason to relax security. Agent tools are exactly where you want clean boundaries.

Lesson 7: Make the model ask less often

A good MCP server should reduce clarification loops.

For web extraction, the model often needs to know:

  • Should JavaScript be rendered?
  • Should the server follow pagination?
  • Should it return Markdown or JSON?
  • Should it run one URL or many?
  • Is partial data acceptable?

You can force the model to ask the user every time, but that makes the workflow feel brittle. Instead, set defaults that match the common case and expose options for the edge cases.

For example:

{
  "url": "https://example.com",
  "renderMode": "auto",
  "countryCode": "US",
  "maxPages": 1,
  "includeLinks": false
}

Enter fullscreen mode Exit fullscreen mode

The model can still override these when the user says "include all pagination" or "check the German version." But the default path stays short.

Lesson 8: Async jobs need a narrative

Batch extraction is not instant. That is fine, as long as the tool gives the agent a narrative it can relay to the user.

Bad async response:

{
  "id": "job_123"
}

Enter fullscreen mode Exit fullscreen mode

Better:

{
  "jobId": "job_123",
  "status": "queued",
  "submittedUrls": 80,
  "estimatedCompletionSeconds": 120,
  "nextAction": "Call check_extraction_job with this jobId."
}

Enter fullscreen mode Exit fullscreen mode

Agents are very literal. If there is a next action, put it in the result. If there is no next action, say that too.

Lesson 9: Registry submission is packaging work

The MCP Registry is now the official centralized metadata repository for publicly accessible MCP servers, currently in preview. That is good news for discovery, but it also raises the bar for packaging.

Before submitting, check the unglamorous parts:

  • Is the package name stable?
  • Is the README installation flow tested from scratch?
  • Are required environment variables documented?
  • Does the server expose a useful version?
  • Are tool names stable enough to avoid breaking users?
  • Does the server fail gracefully without credentials?
  • Is there a minimal example for at least one popular MCP client?

Registry metadata is not a substitute for a good first run. If the first command fails silently, discovery will not save you.

Lesson 10: An MCP server should have opinions

The best MCP servers are not neutral pipes. They encode judgment.

For thunderbit-mcp, those opinions were:

  • Prefer structured output when the user asks for fields.
  • Prefer cleaned Markdown when the user asks to read, summarize, or compare pages.
  • Prefer batch tools when the user provides many URLs.
  • Avoid browser actions unless the capability is explicitly supported.
  • Return partial results clearly instead of pretending everything succeeded.
  • Keep credentials out of prompts and tool outputs.

Your opinions will be different. The point is to have them.

An MCP server that exposes every knob equally forces the model to become your product manager at runtime. That is rarely what you want.

A small implementation checklist

If I were starting another MCP server tomorrow, I would use this checklist:

  1. Start with three to five tools.
  2. Write tool descriptions like model instructions, not API docs.
  3. Use structured inputs and outputs everywhere.
  4. Put logs on stderr for stdio servers.
  5. Add stable error codes before adding more features.
  6. Test with real agent prompts, not only direct tool calls.
  7. Include one copy-paste client config in the README.
  8. Document auth failure, rate limits, retries, and partial results.
  9. Decide which transport is primary before designing auth.
  10. Treat registry submission as part of the release, not an afterthought.

Where Thunderbit fits

Thunderbit is an AI web scraper and web extraction platform. The API is designed to turn web pages into clean Markdown or structured JSON while handling common scraping problems like JavaScript rendering, noisy HTML, anti-bot friction, geo-routing, batch jobs, and webhooks.

That makes it a natural fit for MCP: agents often need fresh web data, but they should not have to manage a browser cluster or maintain brittle CSS selectors just to answer a question.

The weakness is also clear: Thunderbit is not the right tool for every MCP job. If you only need to read local files, query your own database, or call a simple internal API, a tiny custom MCP server will be cheaper and more direct. Thunderbit makes sense when the hard part is the public web.

That distinction matters. MCP works best when each server has a sharp job.

Final thought

Building an MCP server is easy in the same way building a CLI is easy: the first command can work in an afternoon.

Shipping one people trust takes longer.

You have to design the verbs, the defaults, the errors, the auth flow, the packaging, and the story the agent tells when something goes wrong. The protocol gives you the rail. The product work is deciding where the rail should go.

That was the biggest lesson from thunderbit-mcp: the server is not just how an AI calls your API. It is how your API becomes part of somebody's thinking loop.