Evan X. Merz

Programmer / Master Gardener / Doctor of Music / Curious Person

How to add agentic WebMCP search to a static site (like an 11ty blog)

In this post, I'm going to show how to add a WebMCP search feature to your static site so that agents can easily search it.

WebMCP + 11ty

What is WebMCP?

WebMCP is a web browser specification that defines a way for websites to create MCP tools using JavaScript. MCP is a standard for describing tools that can be used by AI agents. So, for example, an ecommerce site might define several tools relating to the shopping experience. A search tool might allow an agent to search for products, a product tool might allow an agent to get the details for an individual product, an addToCart tool might add a product to an agent's cart, and a checkout tool might allow an agent to finalize a purchase.

WebMCP is an alternative to forcing agents to click buttons in your user interface. WebMCP allows agents to interact with your website in a way that is defined for agent use, rather than human use.

The WebMCP spec was defined by W3C, but the GitHub page is a good source for learning more about WebMCP.

Adding WebMCP to a static website

To add WebMCP to your static site, you need to do a few things.

  1. Determine the actions that an agent could take on your website. These will become tools.
  2. Write JavaScript functions that execute those actions.
  3. Write WebMCP compliant JavaScript that describes the tools and calls the JavaScript functions for the tools.

On a static website like a blog, there aren't a lot of actions that an agent could take. If an agent wants to read an article on your blog, then the article should be listed in llms.txt so the agent can find the article and read it. The only possible action I could define for my blog is a search feature. The remainder of this article will show how I added the search feature to this blog, including WebMCP support, but hypothetically you could follow this tutorial to add any action that your website supports.

The first thing to do to add support for agentic searching is to create a search feature. Search is not native to static websites because they lack the backend that would typically support a mature search feature. However, the PageFind JavaScript library enables post-build support for searching static sites using a pre-built static search index.

To add search functionality to your static site using PageFind, I suggest following the tutorial by Robb Knight. After you do that, come back here, and we will layer in agentic search.

Enabling agentic search using PageFind is incredibly easy. All you need to do is add JavaScript to define the search tool. Any WebMCP tool is defined by its name, description, inputSchema, and what to do when an agent calls it. All you have to do is call document.modelContext.registerTool. The first argument takes a json object with the name, description, and inputSchema parameters. The second argument defines the execute function. Notice the definition of the parameters; in this case there is only a term parameter that passes the search term into the execute function. Then there is a small bit of JavaScript that says how to run the actual tool.

The code for enabling WebMCP for static sites that use pagefind should be exactly the same for every site. Pagefind generates the search index by scanning your generated html files in a post-build step, as shown in the tutorial linked above. So the code to define a search tool should work with any static pagefind site, even if you aren't using 11ty like me.


<script type="text/javascript">
  async function registerTools() {
    const pagefind = await import("/pagefind/pagefind.js");

    await document.modelContext.registerTool({
      name: "search",
      description: "Returns an array of articles that include the search term.",
      inputSchema: {
        type: "object",
        properties: {
          term: { type: "string", description: "What you are searching for." },
        }
      },
      async execute({ term }) {
        const search = await pagefind.search(term);
        return search.results;
      }
    });
  }
  registerTools();
</script>

After you create the search feature and add the code to define the search tool, you can validate that it's working using the WebMCP Inspector Chrome extension. Just install the extension in Chrome, and enable the experimental WebMCP for testing feature in Chrome by visiting chrome://flags/#enable-webmcp-testing.

That extension will allow you to see the tools defined on a page, execute them, and inspect the output.

My WebMCP enabled blog search feature can be used at https://evanxmerz.com/search/.

how-to-add-webmcp-search-to-a-static-website

Replacing human code with AI slop is a mistake

AI slop is the latest hot framework. It's the latest trend in software development that is eating an entire industry. Every executive in tech bought into the hype from people heavily invested in AI, and they have, at this point, fully swapped out a beautiful, hand-crafted codebase in favor of poorly written AI slop code bloat that is much more difficult to maintain.

A man looking at a list of web development trends and the one for 2026 is AI slop and he is skeptical. This illustration was drawn using a Supernote Nomad and colored using GIMP with a wacom tablet.

Replacing carefully engineered systems with ai generated code that looks correct is a net negative for a business. It results in more downtime, harder to fix issues, code bloat, poor user experience, and poor performance. Furthermore, using AI coding agents trains your engineers to be lazy and rely on AI, which compounds the problem.

The AI slop hype train reminds me most of the trend in the 2010s toward noSQL databases such as MongoDB. The hype was so strong that smart, well-educated tech leaders were building companies from scratch based on noSQL databases. Of course a few years into the hype, the research showed that noSQL databases are outperformed at their own game by mature relational databases with json blobs. Many tech startups died because they realized too late that a traditional database would fit their use cases better than their massive noSQL cluster.

In short, tech companies jumped way too quickly on the noSQL hype train, and some of them paid the price. The same thing happened with nodejs, cryptocurrency, and even apps to some degree (is it really worth it for your company to have an app?). Companies that jumped on the hype train too quickly were punished for it. Companies that continued to rely on traditional engineering continued operating reliably.

The companies that have so quickly swapped out their human crafted codebase for AI slop are going to pay for it. It reflects bad leadership. If a company can't see that AI slop is not engineering, then the leadership doesn't understand the industry that they are leading.

I don't have the numbers to back this up yet. I only have the experience of watching this trend unfold at two of the biggest tech companies in the world. But the Microsoft outage reflects poor engineering culture that is too heavily reliant on AI. The quick enshittification of various Amazon products reflects their overly quick adoption of AI slop.

It might not be obvious now, but the numbers will soon show that traditional engineering is better for a company's bottom line than AI slop.

replacing-human-code-with-ai-slop-is-a-mistake

What happened when I implemented llms.txt?

I've been a blogger since the early 2000s because blogging is one of my favorite ways to express myself. I like the casual tone where I can share pretty much anything I'm creating at the moment or interested in writing about. So I'm pretty distressed with all the discussion online about how blogging is dead due to the rise of AI.

A month ago I gave into my fear and decided to add llms.txt to my website. This new text file at the site root is basically a sitemap for LLMs. It presents your blog posts in a markdown format that is easy for AI agents to ingest so that they can navigate your site. If people are going to use LLMs rather than search engines, then I want my blog posts to appear there as well.

But how did that change the performance of my blog? How did that change search traffic? How did it change site visitors? How did it change social sharing?

In this post I'm going to share the way traffic to my site changed in the first month since adding llms.txt, then I'm going to use those results to drive a discussion about whether blogging is actually dead or not.

Results of adding llms.txt

I added llms.txt to my static eleventy blog on October, 5, 2026. The pattern of traffic to my site changed almost immediately. Here's a screenshot from Google Search console that compares the first month of search traffic with llms.txt against the last month of search traffic with no llms.txt.

Chart showing search traffic changes after adding llms.txt

The results are crystal clear. Impressions went way down. Clicks went way up. In the month after adding llms.txt I had 16.8k search impressions, while in the month prior I had 26.6k search impressions. That's a 37% drop in traffic! I lost nearly 10k impressions because I added llms.txt! This may seem awful at first, but it's balanced out by a change in clicks. In the month since adding llms.txt I've had 487 clicks, while in the month prior I had only 381. That's only a 27% increase in visitors, but visitors are what count. This means I'm getting more visitors to my site even though I'm appearing in Google search results less frequently.

When we look at pageviews, the story is a little more confusing. Here's what Google Analytics shows for my pageviews.

Chart showing page views after adding llms.txt

The lines before and after the change are difficult to read at this scale due to the spike at the end. The only significant difference is that there is a massive spike in pageviews later in the month after adding llms.txt. When we dig into the traffic source, we see that that is coming from social media.

Well, it turns out that someone found one of my recent blog posts about the fragility of agentic codebases and shared it on Hacker News. In fact, one of my coworkers reached out to me to inform me that it was on the front page of Hacker News. The highest I saw it was link number 22, but I was pretty happy to see one of my articles gaining traction because that happens so rarely. The next day it was posted on Reddit, so it continued to boost traffic to my site for a few days.

Screenshot showing my article on the front page of Hacker News

In fact, the number of people visiting my site was up 827% month over month! In the month prior to adding llms.txt I had 2,086 visitors to my blog. In the month since adding llms.txt, I had 19,353 visitors to my blog.

NOTE: The number of users arriving from search and the number of visitors overall are two different metrics, hence the difference between Google Search Console and Google Analytics.

Blogging is even more important in the age of AI

The results of adding llms.txt to my site are pretty clear. After adding llms.txt my site saw more visitors from search and from social media. One of my posts went viral and was shared on several high profile social media sites. Adding llms.txt to my site has been a great boost to traffic.

It seems like a lot of people really are using AI chat to find content on the web. After all, I didn't share that blog post to Hacker News. Someone discovered it by chatting with AI, shared it to Hacker News, and then it climbed the ranks. That resulted in more traffic than my blog has seen in years.

So is blogging dead because people are using chat bots? No. Quite the opposite.

Chatbots need sources and references in order to be able to talk about anything. The sources that they need can't be generic, low quality AI slop. They need to find authoritative articles written by people with strong non-AI voices. In order for AI chatbots to present good answers to readers, AI chatbots have to be able to find good writers and leverage their writing in the response.

As long as the chatbots are citing sources, then this should result in increased traffic to the creators who are sharing good content on the internet. Chatbots are a net positive thing writers.

In fact, I think that AI is separating the wheat from the chaff. I think AI is putting a spotlight on the people who are making the highest quality content. Why is that?

People who don't like writing are now using AI to do their writing. They were never good writers, and their skills are decaying because they're offloading their work to AI. People who like writing are still writing by hand. They are still honing their craft. The difference between the two groups is growing more and more stark, and AI can see it. AI isn't linking to other AI slop. It's linking to the best work.

I don't think this is unique to writing either. I think we are seeing this happen in all fields impacted by AI. The bad programmers are becoming worse. The good programmers continue to separate from the pack. The lazy artists are generating slop with AI, while the most skilled artisans stand out even more.

In short, AI usage is a net benefit to those who really enjoy what they are doing. It's a net positive for my blog since adding llms.txt, and I suspect it's a net positive to any other creator who is doing high quality work.

The impacts on the lower end of the market are less clear, and may be less positive. The lowest paid art work is probably going to AI now. The lowest paid writing work is probably also going to AI. Is AI benefiting the people at the bottom? Probably not, but I don't have data that reflects that.

So for now I'm going to keep blogging. In fact, I'm going to redouble my efforts to bring traffic to my site using AI. I am glad that there is a new traffic source beyond search and social media.

what-happened-when-i-implemented-llms.txt

Jensen Huang is not the first victim of spying in tech

2026-11-10  Evan X. Merz
programming , spy , ai , history , silicon valley , ai assisted
AI was used in writing or researching this post.

Everyone on the planet seems to think that Jensen Huang is some kind of fool for falling for a Chinese spy. Huang's story is embarrassing, but it's hardly new. Huang is just the latest victim of international spycraft in American tech.

Here's a reminder of some of the other times when spies infiltrated Silicon Valley.

1. Linwei Ding at Google

Linwei Ding was an AI engineer at Google. Between May 2022 and April 2023 he stole more than 2,000 pages of confidential AI trade secrets and uploaded them to a personal cloud account. A jury in January 2026 convicted him on seven counts of economic espionage and seven counts of trade-secret theft. Later, a judge threw out the economic-espionage counts, saying there was not enough evidence Ding knew or intended his conduct to benefit the Chinese government, but left the trade-secret convictions standing.

2. Xiaolang Zhang at Apple

Apple's secret car project, Project Titan, was supposed to be locked down. Then Xiaolang Zhang, a hardware engineer on the project, allegedly downloaded a 25-page circuit-board schematic for a self-driving car, plus manuals and prototype material, before trying to leave for Chinese EV startup XPeng. Apple flagged the activity, alerted the FBI, and Zhang was stopped at San Jose airport before boarding a last-minute flight to China. He later pled guilty to theft of trade secrets.

3. Abdulrahman Alfozan at OpenAI

In September 2026, OpenAI staff found a recording device plugged into the back of a TV in an executive conference room, wrapped in toilet paper to hide it. The FBI arrested Abdulrahman Alfozan, a 35-year-old Saudi national who had joined OpenAI in July 2025. Prosecutors allege he planted the device to capture sensitive conversations, and that he used an internal tool to figure out when and where executives were meeting. He pled not guilty, and the FBI has explored whether to add an economic-espionage charge.

4. Yanjun Xu at GE

Yanjun Xu, a career officer in China's Ministry of State Security, was convicted in 2021 of trying to steal aviation trade secrets, including technology related to GE Aviation's composite engine fan module. Prosecutors said he used aliases, front companies, and university invitations to recruit aviation employees, pay their travel, and then ask for proprietary files. He was sentenced to 20 years in prison in 2022, the first Chinese intelligence officer ever extradited to the U.S. to stand trial.

A sneaky spy sneaking a peak at a programmer's laptop

Why is Silicon Valley a target for spycraft?

Washington is where government secrets live. Spies target the US government if they want to know what the government knows. Silicon Valley is where the future gets built. Spies target American tech because they want to know what is coming and sell it to the highest bidder.

Each year, Silicon Valley becomes a bigger target for international espionage, and the intelligence world has been saying this for years. In October 2023, the spy chiefs of the U.S., Britain, Australia, Canada, and New Zealand met at Stanford and warned that China's espionage had shifted from government buildings in Washington to innovation hubs in the Bay Area. They said Beijing was especially interested in AI and urged private companies to protect their intellectual property.

FBI officials have estimated that more than half of Chinese espionage focused on stealing American technology takes place in the Bay Area. And one former intelligence official told journalist Zach Dorfman that at one point, a full 20 percent of all the FBI's active counterintelligence-related intellectual-property cases had originated in the Bay Area.

Silicon Valley also makes the job easier. The culture is open by design. People job-hop. People share. Startups brag about what they are building to raise money. Engineers go to the same conferences, the same coffee shops, the same meetups. A stranger asking smart questions does not stand out, because asking smart questions is the whole vibe.

Not to mention the fact that us nerdy engineer types are easy targets. Most of us are lonely guys on the spectrum. It's not that difficult for a pretty girl to show the smallest bit of interest in us and get whatever she wants.

So, was Huang naive, or was he just part of an ongoing attack on American innovation?

Nvidia said Huang's interactions with Alice Huang were not unusual, that meetings with customers are part of a CEO's job, and that regional cloud customers get ordinary business information, not sensitive trade secrets, but that sounds a lot like double-speak to me. Espionage is rarely about one meeting where someone hands over the crown jewels. It is about learning what the CEO cares about, what he is trying to get done, who he trusts, and what is coming next. A person close to the CEO does not need a smoking gun to do their job.

Jensen Huang isn't the first powerful tech executive to be targeted. He won't be the last. He is just the latest in a long line that includes engineers at Google and Apple, OpenAI, GE, IBM, and more.

jensen-huang-is-not-the-first-tech-exec-to-be-targeted-by-a-spy

AI usage generates a fragile codebase

I can only speculate as to the reasons why I was laid off from Meta in May, but I suspect that one of the reasons is that I was a little bit more resistant to adopting AI/LLMs as coding tools than some of my peers. Don't get me wrong, I generated at least 90% of my code using AI in my last few months there, which was the minimum for a decent rating. But AI didn't 10X the amount of code I was writing. It didn't even 2X it.

I was focused on code quality. I saw the code being pushed by some of my peers who were heavily reliant on AI, and I saw that it was brittle code. There were many subtle issues that would lead to tech debt in the long term, and even some glaring issues were ignored by very good programmers. For instance, I saw one of the best programmers on my team try to merge code that used javascript events for mouseover CSS effects rather than using the :hover selector, which is a totally unscalable way of writing mouseovers.

Now I'm employed at another large tech company and I've fully made the switch to generating 100% of my code using AI because that's the expectation today. Still, I can see lots of people becoming aware that this isn't a sustainable way to continue development of a large scale SaaS product. AI tends to solve the problems that can fit within its context window very well, but it's totally oblivious to the long term issues that can't be understood in that relatively small frame.

In this post I'm going to list four ways that AI usage results in a fragile codebase that isn't resilient to the demands of highly available and highly scalable SaaS applications.

By the way, every word of this article was written by a human. Even though the following image was generated by AI, this article isn't AI slop.

A worried robot places another piece of code into a codebase portrayed as a wobbly house of cards.

Four ways AI makes codebases fragile

Here are the four most common ways that I have seen AI generating a fragile codebase.

1. AI writes shallow tests

One of the most obvious failures of modern LLMs is that they tend to write simplistic automated test cases that don't cover the things that matter to humans. Frequently I see AI agents writing lots of tests of get/set methods which are trivial and don't typically require much testing. When AI writes e2e tests, they tend to only cover the cases which are already covered in the codebase. In other words, the AI writes tests only covering one type of user, or only covering surface level interactions. This creates massive gaps in the test coverage that are invisible to developers because they aren't captured by the line level coverage metric.

2. AI writes overly complex ccode

AI also tends to write overly complex code. It frequently uses two or three helper methods when a single one would suffice. It tries to follow coding guidelines, such as DRY, to a fault, without realizing that the added complexity of that rigidity makes the code more difficult for human developers to debug or understand.

3. Reliance on AI decreases human understanding

And that's the third issue with AI codebases: Humans don't understand them. The longer a company relies on AI agents to generate the code, the fewer developers are going to understand the codebase. This means that developers can't do the things that are necessary to build a resilient codebase. They don't understand the data structures and algorithms well enough to see when a pull request contains a new abstraction that doesn't work with the pre-existing structures.

4. AI moves too quickly to maintain a high quality bar

AI moves too quickly for human developers to maintain a high quality bar. Each pull request comes faster than the prior one and has to be reviewed in even less time. This leads to developers skimming the code and missing crucial details that result in long term tech debt. Small quality issues like testing gaps and poorly named variables accrue in the codebase until it becomes a morass of spaghetti code.

Four signs that you have a fragile codebase

If you're unsure whether coding agents are harming your codebase or not, then you might look for the following symptoms of a fragile, AI-generated codebase.

1. AI generated codebases have more incidents

When you switched the department over to agentic coding did the number of incidents slowly start rising? At first when we were all using agents to generate massive amounts of code, it didn't seem that different from traditional coding. The PRs came and were merged and everything seemed alright. But oh, there was that one p0 that came in at the end of the month, then there were two SEVs the following month. Then even more the next month. Now, after a year or two of agentic coding, it seems like there's an incident every weekend. AI coding agents are the reason why there are more incidents impacting customers.

2. Recovery from incidents takes longer in AI codebases

Not only are there more incidents, but the incidents take longer to be mitigated. The fact is that the human developers on your team now have a more shallow understanding of the codebase. If your coding agent can't find the issue that your customers are facing, then humans are going to have to dig through a codebase that is highly complex and poorly tested. They will essentially be entering unfamiliar territory, so it takes longer for them to figure out what is going wrong. Hence, companies lose more and more money to incidents that take longer to resolve.

3. AI generated codebases create errors that are only visible to users

When humans don't spend time in the code, they fail to see all of the use cases. They fail to understand how actual humans are using the code because they aren't ensuring that the AI is instrumenting analytics and catching all the errors properly. Hence, invisible errors start appearing in the codebase. Errors are uncaught and only visible to real world users, as opposed to the types of users that are being tested in automated tests or in developer manual testing.

4. AI results in a poor user experience

And that leads to the ultimate problem with AI codebases: they weren't made for humans. AI codebases are software made by AI for AI. They aren't being tailored to the way that human users use the product, and they aren't being tailored for the way human developers need to maintain the product. The experience degrades on both the user and the developer side, leading to a vicious cycle of enshittification.

Products made for humans require a human touch

The fact of the matter is that for a product to satisfy human customers, it has to be informed by a human perspective. Nobody likes ordering from machines at a restaurant. Shopping for clothes from a website always results in worse fits than shopping in person. The same is true of SaaS products. Any time you leave your SaaS product in the hands of a machine, you are losing the human touch that is valuable to your users and your developers. This may work for the cheapest products that only compete on price, but high quality software products will continue to have a human touch. The best, most expensive products will be tailored for human users by human developers. They will be charming and enjoyable to use. They won't be fragile because they won't be primarily developed by AI.

ai-usage-generates-a-fragile-codebase