<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Halil İbrahim Sayın on Medium]]></title>
        <description><![CDATA[Stories by Halil İbrahim Sayın on Medium]]></description>
        <link>https://medium.com/@sayinhalil23?source=rss-1b6597bec686------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2xn1SLl88L37PxESVRhoUQ.jpeg</url>
            <title>Stories by Halil İbrahim Sayın on Medium</title>
            <link>https://medium.com/@sayinhalil23?source=rss-1b6597bec686------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 11:27:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sayinhalil23/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Your AI Agent Keeps Breaking EF Core Migrations]]></title>
            <link>https://medium.com/@sayinhalil23/why-your-ai-agent-keeps-breaking-ef-core-migrations-0910b635636e?source=rss-1b6597bec686------2</link>
            <guid isPermaLink="false">https://medium.com/p/0910b635636e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[entity-framework-core]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Halil İbrahim Sayın]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 21:53:13 GMT</pubDate>
            <atom:updated>2026-08-06T21:55:56.484Z</atom:updated>
            <content:encoded><![CDATA[<p>A specific bug, a specific reason, and the missing piece that turns generic AI coding into something you can actually ship.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IceC2ett8SWp1F3gjpKQqw.jpeg" /></figure><h3>The bug</h3><p>I asked Claude Code to add a Type discriminator to a base entity so we could split existing orders into RegularOrder, WholesaleOrder, and SubscriptionOrder. The existing hierarchy was already there, all three subclasses were already defined, they just did not have their own tables. TPH inheritance mapping was the intended path, and adding the discriminator column was the mechanical next step.</p><p>The AI wrote this.</p><pre>public partial class AddOrderTypeDiscriminator : Migration<br>{<br>    protected override void Up(MigrationBuilder migrationBuilder)<br>    {<br>        migrationBuilder.AddColumn&lt;int&gt;(<br>            name: &quot;OrderType&quot;,<br>            table: &quot;Orders&quot;,<br>            type: &quot;int&quot;,<br>            nullable: false,<br>            defaultValue: 0);<br>    }<br><br>    protected override void Down(MigrationBuilder migrationBuilder)<br>    {<br>        migrationBuilder.DropColumn(name: &quot;OrderType&quot;, table: &quot;Orders&quot;);<br>    }<br>}</pre><p>The migration itself looked completely reasonable. The problem showed up somewhere else.</p><p>The existing model already configured OrderType = 0 as SubscriptionOrder in AppDbContext. The AI did not inspect that configuration before generating the migration. When the migration ran, EF Core applied defaultValue: 0 to every existing row in the Orders table. Two thousand production orders that were RegularOrder in the business sense were now typed as SubscriptionOrder in the database. The subscription billing job picked them up the next morning and tried to charge cards that were never subscribed. Support tickets started arriving before I had finished my coffee.</p><p>The AI did nothing wrong at the level of the file it saw. Every line was valid C#. Every EF Core call was syntactically correct. What it missed was that a discriminator column is not a normal column. It carries type identity for every existing row, and a defaultValue: 0 on a discriminator commits every legacy row to whichever type the model configuration has bound to that value.</p><h3>Why grep-based AI misses this</h3><p>I have been using AI coding assistants for a while now, and the shape of what they do is pretty clear. They read files. They grep. They match patterns. On a small project this is usually enough, because the reasoning fits in a single file or two. On a 15-project .NET solution with a real DbContext, migration history, and cross-project consumers, it stops being enough.</p><p>There are three things the AI cannot see just by reading files.</p><p><strong>It cannot see the semantic type graph.</strong> From the file’s point of view, Order is a class that has three subclasses. The AI reads that. What it does not read is the compiled type graph: which classes are actually mapped as TPH under which DbContext, how the discriminator is configured, and what integer value corresponds to which concrete type. That configuration lives in method calls inside OnModelCreating, not in something a text search can resolve. The AI has access to the file. It just does not inspect it as part of writing a migration.</p><p><strong>It cannot see the migration history.</strong> Each migration file has a Down method, an ordering, and a set of applied-versus-unapplied states relative to your database. The migration you write today depends on what the previous ones did. Reading a single migration file tells you nothing about whether a discriminator column has been added before, or whether an earlier migration renamed something the current one is trying to reference.</p><p><strong>It cannot see the runtime consumer graph.</strong> Somewhere in MyApp.Billing.dll, there is a background job that filters IQueryable&lt;SubscriptionOrder&gt; and charges cards. Changing what OrderType = 0 means in the discriminator quietly changes what that job sees. Grep finds SubscriptionOrder in eleven files and gives up. It cannot follow the type through DbContext configuration, DI registration, and LINQ expression tree construction, at least not without knowing where to look.</p><p>None of this is a bug in Claude, or Cursor, or Copilot. It is a limitation of the interface. <strong>You cannot grep a compiler.</strong></p><h3>What Roslyn actually gives you</h3><p>Roslyn is Microsoft’s C# compiler platform. It is the same compiler that runs when you type dotnet build. What most .NET developers do not fully use is that Roslyn also exposes its semantic model as an API you can call from your own code.</p><p>The semantic model knows:</p><ul><li>The full type graph after compilation, including inheritance, generics, and partial classes.</li><li>Every symbol reference: which method calls which, which type flows to which parameter, and which registration binds which interface at the syntax level.</li><li>The compilation-level view of every project in the solution, with cross-project references resolved.</li></ul><p>Roslyn on its own does not know about EF Core specifically. It gives you the raw semantic information, and you combine it with EF-Core-aware rules to answer real questions. The three problems above become tractable when you do.</p><p><strong>Which subclass does </strong><strong>OrderType = 0 map to?</strong> A tool built on Roslyn can find every HasDiscriminator&lt;int&gt; call in the codebase, resolve the type argument, read the HasValue&lt;T&gt; mappings, and tell you exactly which concrete type each integer value corresponds to under each DbContext. No grep can do this because the mapping is built through method-chain calls, not written down as text.</p><p><strong>Does the migration history already touch this column?</strong> A Roslyn-based tool can parse every migration, extract the operations, and combine them with EF Core-specific rules to reconstruct the schema changes across the migration history.</p><p><strong>Which handlers filter </strong><strong>SubscriptionOrder specifically?</strong> A Roslyn-based tool finds known LINQ consumers of the subclass and traces them through the DI registrations it can resolve. Some abstraction boundaries are harder than others — a handler that receives an already-filtered IQueryable through a repository indirection can be traced only as far as the compiler can follow the type. But the direct consumers and the DI-registered pipelines that lead to them are visible.</p><p>None of this is theoretical. Every dotnet build already produces much of the semantic information we need. The missing piece is turning that information into EF-Core-aware analysis the agent can query.</p><h3>The Model Context Protocol changes that</h3><p>Anthropic released the Model Context Protocol (MCP) in late 2024. The one-line summary is that it lets AI clients like Claude Code, Cursor, and Continue.dev call structured tools instead of only reading files. The tool defines its inputs, its outputs, and what it does. The AI decides when to call it based on the conversation.</p><p>MCP servers can do anything. Some serve HTTP APIs. Some read your Notion. Some run shell commands. The interesting ones for our case expose structured access to compiled code.</p><p>A .NET-native MCP server built on Roslyn can define tools like:</p><ul><li>list_dbcontexts(solutionPath) — returns every DbContext-derived class with their mapped entities and TPH discriminator configuration.</li><li>analyze_migration(migrationFile) — parses a migration and returns the operations, target tables, and semantic risk given the current model.</li><li>find_entity_consumers(entityName) — returns handlers, controllers, and background jobs that touch a given entity through DI or LINQ.</li><li>find_discriminator_config(dbContextName, entityName) — returns the integer-to-subclass mapping for a TPH hierarchy under a specific DbContext.</li></ul><p>Ask Claude Code “add an OrderType discriminator to Orders” with these tools available, and the interaction changes.</p><p>The AI calls list_dbcontexts first, sees that Orders is TPH-mapped under AppDbContext. It calls find_discriminator_config, and the response looks something like:</p><pre>OrderType discriminator (AppDbContext):<br>  0 → SubscriptionOrder<br>  1 → RegularOrder<br>  2 → WholesaleOrder</pre><p>It calls find_entity_consumers for SubscriptionOrder, and gets:</p><pre>Affected consumers:<br>  - SubscriptionBillingJob (MyApp.Billing)<br>  - SubscriptionRepository (MyApp.Data)<br>  - SubscriptionReportHandler (MyApp.Reports)</pre><p>Now the AI knows that defaultValue: 0 will type every existing order as SubscriptionOrder, which will feed the billing job. It flags the problem before writing a single line of migration code.</p><p>The bug I opened this article with is one the AI would have caught before touching the migration.</p><h3>What I built and why</h3><p>I started building <a href="https://www.npmjs.com/package/dotnet-context-mcp">dotnet-context-mcp</a> because I kept running into the same class of problem in real .NET codebases. Not just discriminator bugs. Nullable column additions with no default. Cascade delete rule changes that quietly cascade through relationships nobody remembered. Column renames that leave orphaned SQL views in Migrations/Scripts/.</p><p>Every time, the AI’s mistake was not stupid. It was under-informed. So I built the informant.</p><p>dotnet-context-mcp runs as a local MCP server. It exposes nine tools to Claude Code covering the semantic model, migration graph, DI registrations, and relationship analysis. Since May, I have been running my migrations through it, and it has caught several of these failure modes before they reached production.</p><p>I also built <a href="https://www.nuget.org/packages/EfMigrationSafety.Cli">ef-migration-safety</a>, a NuGet analyzer library that catches the same issues at pull-request time through Roslyn analyzers. It ships nine rules that flag known-lossy operations before code review even starts. Both are open source and both are usable today. Both are limited by the fact that they run as local processes.</p><h3>What is next</h3><p>The next step is a hosted service. Anthropic’s MCP 2026–07–28 spec, released ten days ago, introduced a stateless protocol core for MCP’s HTTP-based transport. Cloudflare and AWS Bedrock both supported it from day zero, which means hosted MCP infrastructure is no longer theoretical for a solo developer. A hosted version of dotnet-context-mcp can run on serverless infrastructure, plug into your team&#39;s Claude Code or Cursor via OAuth, and give every engineer on your team the same structured .NET context without any local setup.</p><p>I do not want to turn this into a generic Roslyn hosting service or another AI code review dashboard. The product I want to build is much narrower: give an AI agent a compiler-aware view of an EF Core codebase, specifically around migrations. That is the pain I keep running into, and it is the pain I think I can solve.</p><p>If this is a problem you have, I would like to hear from you. I am building the hosted version in public. Star and watch <a href="https://github.com/sayinbrahim/dotnet-context-mcp">github.com/sayinbrahim/dotnet-context-mcp</a> for progress updates. If you want to be part of the private beta in September or October, email me at <a href="/service/mailto:sayinhalil23@gmail.com">sayinhalil23@gmail.com</a> with “dotnet-context beta” in the subject. If you have a specific case study of an AI-written migration that broke your production, I want to see it. Real bugs shape better products.</p><h3>What to try in the meantime</h3><p>If you want the local version, npm install -g dotnet-context-mcp and run npx dotnet-context-mcp@latest init-client inside your .NET solution. It auto-detects Claude Code, Cursor, Continue.dev, or Windsurf, configures itself, and starts serving the nine tools. There is also a <a href="https://open-vsx.org/extension/sayinbrahim/dotnet-context-mcp">VS Code and Cursor extension</a> with a sidebar tree view if you prefer a UI.</p><p>For migration-safety specifically, add EfMigrationSafety.Cli to your CI pipeline. It runs nine analyzers against your migration files, flags the common data-loss and consistency patterns, and takes about 30 seconds on a mid-sized solution.</p><p>Neither of these is a substitute for understanding your codebase. They are a substitute for the AI understanding it.</p><p><em>If you have thoughts on hosted MCP infrastructure, EF Core migration workflows, or you have run into the class of bugs described above, I read every reply. The </em><a href="https://github.com/sayinbrahim/dotnet-context-mcp"><em>dotnet-context-mcp GitHub</em></a><em> is open for issues and PRs. For beta access, email </em><a href="/service/mailto:sayinhalil23@gmail.com"><em>sayinhalil23@gmail.com</em></a><em> with “dotnet-context beta” in the subject.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0910b635636e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Two Runtimes, One Protocol: Bridging TypeScript and .NET with MCP]]></title>
            <link>https://medium.com/@sayinhalil23/two-runtimes-one-protocol-bridging-typescript-and-net-with-mcp-fd4f9e06e02b?source=rss-1b6597bec686------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd4f9e06e02b</guid>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Halil İbrahim Sayın]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 21:21:32 GMT</pubDate>
            <atom:updated>2026-07-16T21:21:32.807Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cAGjoNEzh_PfM6j8Qdmh8Q.jpeg" /></figure><p>How I spent a weekend building an MCP server for .NET solutions</p><h3>The problem I did not want to solve</h3><p>I use Claude Code every day. It works well on my TypeScript projects. It works okay on my C# projects, and by “okay” I mean it opens ten files, misreads three, and gives up on the fourth. Not because the model is bad. Because the model can only see what it can grep, and grep is a poor way to understand a .NET solution with fifteen projects, seven DbContexts, and a migration history nobody has looked at in eleven months.</p><p>I wanted Claude Code to answer questions like <em>which entities does OrderDbContext own</em>, <em>what does the last migration actually do to the schema</em>, or <em>is </em><em>LegacyDbContext still registered anywhere</em>, without opening a single file. The answer had to be structured, fast, and always correct. Not a summary of some files. The real answer, computed against the real solution graph.</p><p>That means Roslyn. That specifically means MSBuildWorkspace, SymbolFinder, and the parts of the Roslyn API you cannot really run outside .NET.</p><p>Which is where the trouble starts.</p><h3>The MCP ecosystem is TypeScript-shaped</h3><p>The Model Context Protocol is Anthropic’s standard for letting language models talk to external tools. As of mid-2026 the ecosystem is heavily TypeScript. The official SDK is TypeScript-first. Most examples are TypeScript. The Claude Code documentation assumes TypeScript. When you look at real MCP servers in the wild, the ratio is roughly ninety percent TypeScript, ten percent everything else.</p><p>That is fine if your tool is a wrapper around an HTTP API. It is less fine if your tool needs to load a .NET solution, walk the semantic model, and inspect migration operations at the syntax level.</p><p>I looked at three options.</p><p><strong>Option one: rewrite Roslyn in TypeScript.</strong> No.</p><p><strong>Option two: parse </strong><strong>.csproj and </strong><strong>.cs files by hand in TypeScript, well enough to answer the questions I care about.</strong> Also no. You would spend a month building something Roslyn already does correctly, and it would be wrong about generics, partial classes, and half of the things that matter in real EF Core code.</p><p><strong>Option three: put the Roslyn code in .NET where it belongs, put the MCP protocol code in TypeScript where the SDK lives, and connect them.</strong> This is the option I picked. It felt inelegant at first. It stopped feeling inelegant about three days in, when everything actually worked.</p><h3>The bridge</h3><p>The mental model is one MCP server, two runtimes. The TypeScript layer owns the protocol. The .NET layer owns the analysis. They talk over stdio subprocess with JSON-RPC.</p><pre>Claude Code<br>    │  MCP protocol (stdio)<br>    ▼<br>TypeScript layer (src/index.ts)<br>  • MCP SDK (@modelcontextprotocol/sdk)<br>  • Zod input validation<br>  • Tool registration<br>  • Subprocess management<br>    │  spawn + JSON on stdin/stdout<br>    ▼<br>.NET 8 CLI (cli/DotnetContextMcp.Cli)<br>  • MSBuildWorkspace<br>  • Roslyn symbol + syntax analysis<br>  • System.CommandLine dispatch<br>  • Serializes results as JSON to stdout<br>    │<br>    ▼<br>Your .NET solution</pre><p>Each MCP tool call in TypeScript is a child_process.spawn of the .NET CLI with a subcommand and arguments. The .NET CLI does the Roslyn work, prints a JSON result to stdout, and exits. The TypeScript layer reads stdout, hands it back to the MCP client, and forgets the subprocess ever existed.</p><p>The TypeScript side stays under 300 lines. The .NET side is around 800 lines of Roslyn plumbing. The boundary between them is a stable JSON contract per tool.</p><p>Here is what a tool registration looks like on the TypeScript side:</p><pre>server.registerTool(<br>  &quot;list_dbcontexts&quot;,<br>  {<br>    title: &quot;List DbContexts&quot;,<br>    description: &quot;Returns every DbContext-derived class in the solution.&quot;,<br>    inputSchema: z.object({<br>      solutionPath: z.string().describe(&quot;Absolute path to the .sln file&quot;),<br>    }),<br>  },<br>  async ({ solutionPath }) =&gt; {<br>    const abs = resolvePath(solutionPath);<br>    if (!existsSync(abs)) {<br>      return {<br>        content: [{ type: &quot;text&quot;, text: `Solution not found at ${abs}` }],<br>        isError: true,<br>      };<br>    }<br>    return callCli(&quot;list-dbcontexts&quot;, [abs], &quot;list_dbcontexts&quot;);<br>  }<br>);</pre><p>And here is roughly what callCli does:</p><pre>async function callCli(command: string, args: string[], tool: string) {<br>  const cliPath = resolveCliBinary();<br>  const proc = spawn(cliPath, [command, ...args], { stdio: [&quot;pipe&quot;, &quot;pipe&quot;, &quot;pipe&quot;] });</pre><pre>  let stdout = &quot;&quot;;<br>  let stderr = &quot;&quot;;<br>  proc.stdout.on(&quot;data&quot;, (b) =&gt; (stdout += b));<br>  proc.stderr.on(&quot;data&quot;, (b) =&gt; (stderr += b));</pre><pre>  const code = await new Promise&lt;number&gt;((r) =&gt; proc.on(&quot;exit&quot;, r));</pre><pre>  if (code !== 0) {<br>    return { content: [{ type: &quot;text&quot;, text: `Error (${tool}): ${stderr}` }], isError: true };<br>  }<br>  return { content: [{ type: &quot;text&quot;, text: stdout }] };<br>}</pre><p>On the .NET side, the actual Roslyn part reads like normal Roslyn code, once you get past a specific initialization ritual (which I will complain about in a minute):</p><pre>MSBuildLocator.RegisterDefaults();  // MUST be first line of Program.cs</pre><pre>using var workspace = MSBuildWorkspace.Create();<br>var solution = await workspace.OpenSolutionAsync(slnPath);</pre><pre>var dbContextBase = &quot;Microsoft.EntityFrameworkCore.DbContext&quot;;<br>var results = new List&lt;object&gt;();</pre><pre>foreach (var project in solution.Projects)<br>{<br>    var compilation = await project.GetCompilationAsync();<br>    if (compilation is null) continue;</pre><pre>    var baseType = compilation.GetTypeByMetadataName(dbContextBase);<br>    if (baseType is null) continue;</pre><pre>    var derived = await SymbolFinder.FindDerivedClassesAsync(baseType, solution);<br>    foreach (var symbol in derived.Where(s =&gt; !s.IsAbstract))<br>    {<br>        results.Add(new<br>        {<br>            name = symbol.Name,<br>            ns = symbol.ContainingNamespace.ToDisplayString(),<br>            projectName = project.Name,<br>            filePath = symbol.Locations.FirstOrDefault()?.SourceTree?.FilePath,<br>        });<br>    }<br>}</pre><pre>Console.WriteLine(JsonSerializer.Serialize(new { dbContexts = results }));</pre><p>That is the whole idea. Protocol on one side, real work on the other, glue in the middle.</p><h3>What the bridge actually got me</h3><p>A few things I did not fully appreciate until they were done.</p><p><strong>The MCP SDK stays boring.</strong> I never had to fight it. Zod validates inputs. Tools register in a few lines. Errors go back through the SDK’s normal channel. All the interesting decisions live on the .NET side, which is exactly where I already had opinions.</p><p><strong>Roslyn stays honest.</strong> No hand-rolled .cs parser is going to correctly handle partial classes, generics with type parameter constraints, or attribute inheritance across nested types. Roslyn does. I did not want to reimplement any of that.</p><p><strong>Cross-platform shipping stopped being weird.</strong> The .NET side is published as a self-contained binary per RID (win-x64, linux-x64, osx-x64, osx-arm64). A tiny post-install script downloads the right one from a GitHub Release. The TypeScript package on npm stays small. The user runs npm install dotnet-context-mcp and does not care that there is a .NET binary under the covers.</p><p><strong>Cold start dropped from 17 seconds to about 3.</strong> The first version of the CLI opened the solution on every single tool call. That is not something you want when your users are asking eight questions in a row. Caching MSBuildWorkspace between calls is not really a thing across process boundaries, but tightening MSBuildLocator init and avoiding unnecessary GetCompilationAsync calls got most of the way there. Real solutions still dominate the wall clock, but the fixed overhead is now small.</p><h3>Five traps I fell into (so you do not have to)</h3><h3>1. MSBuildLocator has to be first, and no, it cannot go in a helper method</h3><p>Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults() has to run before any code touches MSBuild types. Not before your MSBuild usage. Before any code that even <em>references</em> an MSBuild type gets JIT-compiled. In practice this means: first line of Program.cs. If you tuck it inside a Setup() helper called from Program.cs, you will get a nasty runtime error saying MSBuild could not be found, and you will spend an evening convinced your install is broken. It is not. Move the call.</p><h3>2. PublishSingleFile and Microsoft.Build.Locator do not get along</h3><p>The whole point of a self-contained CLI is a clean deployment. dotnet publish -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true should give you one nice .exe. It does. It also gives you a hostfxr.dll P/Invoke error the first time MSBuildLocator runs, because the locator wants to poke at the runtime host in a way PublishSingleFile bundling does not allow.</p><p>Fix: give up on single-file publishing for this CLI. Directory deployment (357 files, 105 MB) works. It is bigger. It is not pretty. It ships. The zip file the post-install script downloads is around 45 MB compressed per platform, which is a fair trade.</p><h3>3. string and String are not the same node in Roslyn</h3><p>I wrote an analyzer that flagged string.Format(sql, userInput) inside migrationBuilder.Sql(...) as a potential injection risk. I tested it. It worked. Then a colleague pointed out that his codebase used String.Format(sql, userInput) with capital S, and the analyzer missed it.</p><p>The reason: string is a PredefinedTypeSyntax node (it is a C# keyword), while String is an IdentifierNameSyntax node (it is a type reference). Same semantic type, two different syntax classes. If you match one, you must match the other:</p><pre>var typeName = memberAccess.Expression switch<br>{<br>    PredefinedTypeSyntax p =&gt; p.Keyword.Text,   // &quot;string&quot;<br>    IdentifierNameSyntax i =&gt; i.Identifier.Text, // &quot;String&quot;<br>    _ =&gt; null<br>};</pre><pre>if (typeName is &quot;string&quot; or &quot;String&quot; &amp;&amp; memberAccess.Name.Identifier.Text == &quot;Format&quot;)<br>{<br>    // flag it<br>}</pre><p>Roslyn is not being difficult here. It is being precise. But it is a precision you will only notice when someone hands you a codebase written in a different style.</p><h3>4. Git Bash on Windows lies about tar</h3><p>The post-install download script calls tar -xzf archive.tar.gz. On regular PowerShell or cmd, tar resolves to C:\Windows\System32\tar.exe, which is bsdtar, which understands Windows paths. On Git Bash, tar resolves to MSYS&#39;s GNU tar, which sees C:\Users\...\archive.tar.gz and interprets the colon as a remote SSH path. The extraction silently fails with a &quot;cannot connect to C&quot; error, the post-install script catches the error, calls process.exit(0) so npm still succeeds, and the user ends up with no binary. They fall back to dotnet run on every tool call, which is slow and confusing, and they have no idea why.</p><p>Fix: on Windows, explicitly call C:\Windows\System32\tar.exe. Do not trust the PATH.</p><h3>5. npm 2FA plus a build hook is a bad combination</h3><p>npm publish with 2FA enabled prompts for a one-time password. The OTP is valid for 30 seconds. My prepublishOnly script takes about 4 seconds to run. So the effective window to type the OTP is around 20 seconds. Two wrong OTPs and npm rate-limits you for 5 to 10 minutes. Three wrong OTPs and you start to feel that whoever designed this workflow had not actually published a package under load.</p><p>Fix: switch to a <strong>Granular Access Token</strong> with <strong>Bypass 2FA</strong> enabled, scoped to the single package. Save the token to .npmrc or an environment variable and never type another OTP for that package again. This is the current industry-standard pattern for exactly this reason.</p><h3>The result</h3><p>The main package, dotnet-context-mcp, is on npm. It exposes nine tools: DbContext listing, entity discovery, migration inspection (thirteen operation types), relationship graph with cardinality inference, DI registration analysis, aggregate solution health scoring with issue detection, and a JSON-configurable custom analyzer plugin system. There is a companion VS Code and Cursor extension on the Open VSX marketplace for zero-config setup, and a dotnet-context-mcp init-client CLI command for terminal users.</p><p>If you use Claude Code or Cursor on a .NET codebase, you can try it in about one minute:</p><pre>npx dotnet-context-mcp@latest init-client</pre><p>That command detects Claude Code, Cursor, Continue.dev, or Windsurf on your system, backs up the existing MCP config, and adds dotnet-context-mcp to it. The next time you start your client, ask something like <em>what does the latest migration on OrderDbContext do</em>, and see what you get.</p><h3>What I would tell someone starting today</h3><p>The bridge pattern is not clever. It is what you land on after you try the alternatives and they are worse. If your MCP server needs Roslyn, or Java’s AST tooling, or CPython’s ast module in a way that goes beyond parsing a file, the boundary between the MCP SDK and the analysis engine is going to sit somewhere. It might as well sit at a clean subprocess line where each side speaks its native language.</p><p>The one thing I would say up front: pick your JSON contract carefully. Once real users are hitting a tool, changing the output schema is a breaking change, and the LLM prompt that was calling the old tool will confidently misinterpret the new one. Version the schema. Deprecate fields instead of removing them. Add before you subtract.</p><p>The rest is small decisions. Which side owns caching (mine: neither, per-call is fine). Which side owns retries (TypeScript). Which side owns logging (both, but the .NET side writes to stderr so it does not corrupt the JSON stdout channel). None of this is hard. But if you get any of it wrong on day one, you will spend day thirty untangling it.</p><p>The pattern has a name now, mostly because it needed one. Two runtimes, one protocol. If you build one, tell me. I want to see what other people do at the boundary.</p><p><em>The main package is </em><a href="https://www.npmjs.com/package/dotnet-context-mcp"><em>dotnet-context-mcp on npm</em></a><em>. The VS Code and Cursor extension is on </em><a href="https://open-vsx.org/extension/sayinbrahim/dotnet-context-mcp"><em>Open VSX</em></a><em>. Source is on </em><a href="https://github.com/sayinbrahim/dotnet-context-mcp"><em>GitHub</em></a><em>. Issues, ideas, and boundary-pattern arguments all welcome.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd4f9e06e02b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>