Now I'm not going to use this because that would be the most expensive clicker ever. The point is at the time we wanted to use MCP, but I was still pretty skeptical because what do you do with an MCP for a framework? You can inject docs. And so that was the initial line of thinking. So Scott Spence, which by the way, if you are interested in AI, you should absolutely follow because he's always on the bleeding edge of AI. He started experimenting with this MCP Svelte docs to feed the Svelte docs to the LLM through the MCP. For his own admission, it didn't go as far as he wanted. So Stanislav Koromov took actually the mantle and started developing something that actually more people started to work with, which is the Svelte LLM MCP. And it was just basically feeding the Svelte docs the same LLM.txt that you can read through the MCP protocol. And this was actually kind of working and we actually started from this to build the official Svelte MCP server.
But if we go back to this slide here, you can see that other than we can use the MCP, there's also another idea hanging around. And this idea is the fact that we could run a script of some sort, some deterministic way to determine if the code is correct. So this is the normal like agentic workflow, right? You the user write to an LLM, the LLM write the code, then verifies the code, then write the code, then verifies the code. When he's happy about it, it will go back to you. Now what we did was basically add another part of this agentic workflow. So you write the code like to the LLM, the LLM writes the code before actually going back to the LLM, it goes through the Svelte MCP. And the Svelte MCP, what it does is that it runs static analysis on the code to find out if the LLM generated some common mistake, like the fact that it's using .update, the fact that it's using .$ to read a variable. We have a list, basically, of common mistakes.
And every time we find a new common mistake, we just fix it with static analysis. The nice thing about this is that not only you can return stuff that you would never return to a user because you will never tell a user, hey, maybe you are doing $, like .$. Are you sure that's actually a property on that object and not something else? Like you would never tell this to a user. But most importantly, since we are talking to an LLM, we can return information in natural language. Like we don't have to fix the code for the LLM. We can just return some suggestions and then let the LLM figure out. So let's play a small game, and let's say that we are the LLM. This is an editor that's actually connected to the actual MCP server. So if I do stuff like this, and I have to look at that. So let's say that I do, I don't know, on call on click, for example. Here on call on click, you will see that the LLM is saying, hey, using on click to listen to the click event is deprecated. If I do stuff like this, for example, .$, even if this is technically correct Svelte code, I'm saying you're trying to read the stateful variable count using $. Stateful variables should just be accessed at runtime just like normal variables.
Comments