<?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 Varun Singh on Medium]]></title>
        <description><![CDATA[Stories by Varun Singh on Medium]]></description>
        <link>https://medium.com/@varun.singh9786?source=rss-4f317f82f194------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7WaBQ9z4bDOCFuN_vW7WpA.jpeg</url>
            <title>Stories by Varun Singh on Medium</title>
            <link>https://medium.com/@varun.singh9786?source=rss-4f317f82f194------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 00:42:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@varun.singh9786/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[Testing MCP servers — MCP Eval]]></title>
            <link>https://medium.com/@varun.singh9786/testing-mcp-servers-mcp-eval-113ca6d9b85f?source=rss-4f317f82f194------2</link>
            <guid isPermaLink="false">https://medium.com/p/113ca6d9b85f</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[evaluation]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Varun Singh]]></dc:creator>
            <pubDate>Tue, 25 Nov 2025 09:34:29 GMT</pubDate>
            <atom:updated>2025-11-25T09:34:29.378Z</atom:updated>
            <content:encoded><![CDATA[<h3>Testing MCP servers — MCP Eval</h3><h3>Introduction</h3><p>MCP servers are increasingly prevalent in the Gen-AI ecosystem and are becoming the standard. Consequently, they must undergo rigorous testing, just like any other software component.</p><p>Beyond traditional testing at the unit, component, and integration levels, MCP servers require an additional form of evaluation — MCP eval. Since their consumers are AI models rather than conventional workloads, it is essential to assess whether MCP servers are sufficiently understandable for LLMs to utilize effectively.</p><p>This emerging requirement is relatively new and well-established methodologies for MCP eval are still evolving.</p><h3>Conventional Tests</h3><p>For the sake of completeness the conventional ways of testing MCP servers are:</p><h3>Unit testing</h3><p>MCP Servers can be written in two ways:</p><pre># Decorator based implementation<br>server = FastMCP(&quot;Server to test&quot;)<br>@server.tool()<br>def get_weather_forecast(lat: float, lon: float):<br>    ...</pre><p>vs.</p><pre># Function based implementation<br>server = FastMCP(&quot;Server to test&quot;)<br>def get_weather_forecast():<br>    ...<br>server.tool(get_weather_forecast)</pre><p>The function-based style is generally easier to unit test because it separates the core service logic (get_weather_forecast()) from the MCP tooling layer. There are additional reasons to avoid decorators, which can be found <a href="https://gofastmcp.com/patterns/decorating-methods">here</a>.</p><p>An MCP unit test would look like this:</p><pre>def test_get_weather_forecast():<br>    result = get_weather_forecast(lat, lon)<br>    assert result is not None<br>    ...</pre><h3>Component and Integration testing</h3><p>Similar to REST API testing, these involve creating clients that invoke server endpoints to verify end-to-end behaviour:</p><pre>@pytest.mark.asyncio<br>async def test_get_weather_integration():<br>    async with Client(mcp_server) as client:<br>        result = await client.call_tool(&#39;get_weather_forecast&#39;, {&#39;lat&#39;: 40.7128, &#39;lon&#39;: -74.006})<br>        assert result is not None<br>        ...</pre><h3>MCP Eval — Requirements</h3><p>MCP Eval goes beyond conventional API testing because the consumers are AI models, not other workloads.</p><p>In REST APIs, the caller typically knows which endpoint to invoke and the expected contract. In contrast, an LLM must dynamically discover and understand available MCP tools and call only those it deems necessary based on context. Misdirected calls — invoking a tool when not needed — results in incorrect output; omitting necessary calls misses critical information. Sometimes multiple tools must be combined to produce a complete answer.</p><p>Thus, MCP Eval must confirm that:</p><ul><li>The tools are sufficiently documented and intuitive for LLM consumption.</li><li>Evaluation is automated, repeatable, continuous, and can integrate with CI workflows.</li></ul><h3>MCP Eval — Approach</h3><p>Two popular LLM-focused evaluation methods are:</p><ul><li>Programmatic eval: Comparing output strings (e.g., with Levenshtein distance or exact matches).</li><li>LLM-as-a-judge eval: Using an LLM to grade output by comparing actual versus expected results</li></ul><p>Since MCP Eval is a subset of LLM evaluation, these approaches can be adapted.</p><p>Many suggest OpenTelemetry-based observability tools integrated with AI evaluation providers like <a href="https://langfuse.com/docs/evaluation/overview">langfuse</a>, <a href="https://docs.lmnr.ai/evaluations/introduction">lmnr.io</a>, <a href="https://www.comet.com/docs/opik/evaluation/overview">opik</a>, <a href="https://www.braintrust.dev/docs/start/eval-sdk">braintrust</a> etc..</p><p>However, these platforms pose two challenges for MCP Eval specifically:</p><ol><li>They are generic AI evaluation tools, not tailored to MCP server evaluation</li><li>Their evaluation reports are UI-based and remote, complicating inclusion in Continuous Integration pipelines that require local, automated verdicts.</li></ol><h3>MCP Eval with mcp-use and paydantic-eval</h3><p>A practical MCP Eval framework can be built combining mcp-use and pydantic-eval:</p><ul><li><a href="https://github.com/mcp-use/mcp-use/tree/main">mcp-use</a> is the open source way to connect any LLM to any MCP server and build custom MCP agents</li><li><a href="https://ai.pydantic.dev/evals/#code-first-evaluation">pydantic-eval</a> follows a code-first approach where you define all evaluation components (datasets, experiments, tasks, cases and evaluators) in Python code.</li></ul><p><strong>Step 1</strong>: Define the MCP agent to execute the prompt</p><p>Configure the mcp-use MCPAgent to interact with your MCP server:</p><pre>async def run_llm_prompt(prompt: str):<br>    agent = MCPAgent(<br>        llm=ChatOpenAI(<br>            model=&#39;gpt-oss-20b:free&#39;,<br>        ), client=MCPClient.from_dict({<br>            &quot;mcpServers&quot;: {&quot;weather&quot;: {&quot;transport&quot;: &quot;http&quot;, &quot;url&quot;: &quot;http://localhost:9000/mcp&quot;}}<br>        }, sandbox=True), max_steps=10)<br>    result = await agent.run(prompt)<br>    return QueryResult(tools_used=set(agent.tools_used_names), llm_output=result)</pre><p>It takes an LLM Model and an MCP client pointing to an MCP server as input and creates an agent. The agent runs with the given prompt and returns the result.</p><p>Note the agent.tools_used_names set — this tracks which MCP tools the agent invoked to fulfill the prompt.</p><p><strong>Step 2</strong>: Introduce pydantic-eval and write a dataset like this:</p><p>Write test cases with expected tool usage and an evaluator to verify output correctness:</p><pre>dataset = Dataset[str, QueryResult, Any](<br>    cases=[Case(<br>            name=&#39;User asks about an activity which requires weather forecast/alert&#39;,<br>            inputs=&#39;I live in New York and want to go out tomorrow evening for a walk. What should I do?&#39;,<br>            expected_output=QueryResult(tools_used={&#39;get_forecast&#39;, &#39;get_alerts&#39;}),<br>            evaluators=[LLMJudge(<br>                model=&#39;groq:llama-3.3-70b-versatile&#39;,<br>                rubric=&#39;The LLM should call use the get_alerts and get_forecast tools to come up with the suggestion&#39;<br>            )]<br>        )<br>    ],<br>    evaluators=[CustomEvaluator()],<br>)<br>report = await dataset.evaluate(run_llm_prompt)</pre><p>Lot to unpack but here is the gist:</p><ul><li>A dataset consists of Cases and Evaluators. A Case is a testcast</li><li>It takes an LLM prompt in the input parameter and the expected output in the output parameter. The input would be passed to the function being evaluated run_llm_prompt.</li><li>Its output would be captured and will be given for evaluation.</li><li>There are two evaluators — one for programmatic evaluation and the other for LLM-as-a-Judge evaluation</li><li>The programmatic evaluator CustomEvaluator, gets the input/output from the test run and the expected output, runs the code we write to evaluate and returns the result. It looks like this:</li></ul><pre>class MCPEvaluator(Evaluator[str, QueryResult, Any]):<br>    def evaluate(self, ctx: EvaluatorContext[str, QueryResult, Any]) -&gt; str:<br>        expected_tools_used = ctx.expected_output.tools_used<br>        actual_tools_used = ctx.output.tools_used<br>        if len(expected_tools_used) &gt; len(actual_tools_used):<br>            return f&quot;Should have used {expected_tools_used - actual_tools_used} but didn&#39;t&quot;<br>        elif len(expected_tools_used) &lt; len(actual_tools_used):<br>            return f&quot;Shouldn&#39;t used {actual_tools_used - expected_tools_used} but did&quot;<br>        else:<br>            return &quot;Passed&quot;</pre><p>Difference Evaluators can be passed along with built-in ones like IsInstance(), ExactMatch() etc. Moreover, a whole suite of test cases covering different scenarios can be specified. The formatted report looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*mPr0vXZPXyiAVyfc27buTA.png" /></figure><h3>Conclusion</h3><p>This approach can integrate seamlessly into automated pipelines, providing actionable and continuous quality feedback tailored for MCP servers serving AI workloads.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=113ca6d9b85f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spec-Driven Development with Jira: An Experiment]]></title>
            <link>https://medium.com/@varun.singh9786/spec-driven-development-with-jira-an-experiment-220aaa5e795f?source=rss-4f317f82f194------2</link>
            <guid isPermaLink="false">https://medium.com/p/220aaa5e795f</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[n8n]]></category>
            <dc:creator><![CDATA[Varun Singh]]></dc:creator>
            <pubDate>Mon, 24 Nov 2025 07:14:03 GMT</pubDate>
            <atom:updated>2025-11-24T07:14:03.208Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>I’ve been experimenting with AI-augmented development, focusing on creating more structured prompts for Large Language Models (LLMs) while keeping the context window manageable to efficiently complete tasks.</p><h3>Problem Statement</h3><p>There are two prevalent approaches to AI-augmented coding (distinct from “vibe-coding”):</p><ul><li><strong>Spec-Driven Development (SDD)</strong>: The developer defines specifications in a format that LLMs can understand and implement.</li><li><strong>Pairing with LLM</strong>: The developer guides the LLM through a conversation, with instructions ranging from vague (“Fix failing test cases”) to specific (“In server.py, create a function called add_numbers…”).</li></ul><p>I’ve tried both approaches and find them both viable. While I feel more confident with the pairing approach, SDD seems more scalable and efficient when mature.</p><p>I briefly explored <a href="https://github.com/github/spec-kit">Spec-kit</a>, currently the most popular SDD framework. While it’s effective, I identified two areas for potential improvement:</p><ul><li>Team-level observability is limited since specifications exist as markdown files in the codebase, with little visibility for Business Analysts, Delivery Leads, or Product Owners.</li><li>Developers seem to have limited control over the context window size, though this might be my subjective experience.</li></ul><h3>Solution Proposal</h3><p>I considered integrating project management tools into the process, as they seem better suited for storing specifications. Here’s a workflow I envisioned using Jira:</p><ol><li>The Product Owner defines an Epic (a feature or set of features with a common theme), which can be refined using an LLM for better structure.</li><li>LLMs break down the Epic into user stories (alternatively, this can be done by the team).</li><li>Stories are broken down into sub-tasks, either by developers or with LLM assistance.</li><li>Sub-tasks are designed to be independent yet cohesive, collectively completing the story.</li><li>The hierarchy of Epic → User Story → Sub-tasks forms the foundation of SDD.</li><li>These tasks can be implemented either by developers or by LLMs that raise PRs for review.</li><li>When developers handle implementation, they simply provide the task description in a new LLM conversation.</li></ol><p>This approach can be enhanced with a memory bank where LLMs summarize completed work after each sub-task.</p><h3>Anticipated Benefits:</h3><ul><li>Improved visibility for all stakeholders regarding what will be built</li><li>Better context window management as developers control the abstraction level of tasks (creating more sub-tasks for smaller context windows)</li></ul><h3>Implementation</h3><p>To test this approach, I selected a simple ToDo application as a use case. I also wanted to learn n8n, so I automated the Epic and User Story breakdown using LLMs.</p><p>I created an n8n workflow with these triggers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NZGW-syJspq1pQAkvdWXYw.png" /><figcaption>n8n workflow</figcaption></figure><ol><li>When a Jira Epic transitions to “Ready for Breakdown,” an AI agent creates a set of User Stories</li><li>When a Story transitions to “Ready for Breakdown,” the AI agent creates a set of Sub-tasks</li></ol><p>Following this setup:</p><ol><li>I initialized a Next.js project using npx create-next-app@latest</li><li>I tackled stories sequentially, addressing their sub-tasks in order</li><li>For each sub-task, I used a new LLM conversation with this prompt structure:</li></ol><pre>Implement the following Task. Strictly adhere to what is mentioned below. <br>Do nothing else.<br>---<br>&lt;Sub-task Description&gt;<br>---<br>IMPORTANT: Look at the folder @/ai-dev/ for the work done so far. <br>Once your work is done, update the files in the same folder following the existing format and conciseness. <br>This will help the AI agent that will pick the next task. It should be concise and must capture just enough details to give context for the next task.</pre><p>The sub-task descriptions followed this format:</p><pre>Description:<br>&lt;Overall 2-liner Description&gt;<br>Objective:<br>&lt;1-liner objective&gt;<br>Components to address in scope:<br>. &lt;Break-down of sub-tasks&gt;<br>. <br>Key requirements in scope:<br>. &lt;What should LLM build&gt;<br>. <br>Unit testing requirements in scope:<br>. &lt;What should LLM unit test&gt;<br>. <br>Dependencies:<br>Out of scope of this Subtask:<br>. &lt;What should LLM not build&gt;<br>. <br>Context for AI agent who will implement this:<br>EXISTING:<br>. &lt;What already there which is relevant for this task&gt;<br>. <br>REQUIREMENTS:<br>. &lt;What should LLM build&gt;<br>. <br>Acceptance Criteria:<br>. &lt;Self-explanatory&gt;<br>. <br>Validation Approach:<br>&lt;2-liner on how to validate that the task was successfully completed&gt;</pre><h3>Observations</h3><p>I needed to fine-tune the system prompt for breaking down Epics and User Stories. Once established, I minimized intervention unless absolutely necessary. I primarily used Claude Sonnet 4.5, though I also tried GPT-4.1-nano with less success (I plan to revisit this later).</p><p>I completed two and a half user stories, each with 5–6 sub-tasks, and observed consistent patterns:</p><ol><li>LLMs maintained focus without hallucinations, producing positive results with approximately 20k-30k tokens per task.</li><li>Implementation accuracy was roughly 95–105% of what was described in each sub-task, requiring minimal adjustments for the remaining +/-5%.</li><li>In one case, the sub-task breakdown missed a step for backend-frontend integration, highlighting the importance of human review at each stage: Epic refinement →Epic to Story breakdown →Story to Task breakdown → Task implementation</li><li>The memory bank of completed work significantly improved LLM performance.</li></ol><h3>Conclusion</h3><p>Though this was a modest experiment, it allowed me to learn n8n while exploring a new approach to AI-augmented coding.</p><p>Integrating LLMs at every stage of project management is undoubtedly challenging, but it can be broken down and implemented incrementally by individuals within their capacities. As developers, we often own the process of breaking stories into sub-tasks. I believe using project management tools rather than markdown specification files in the codebase can benefit both LLMs and the broader team.</p><h3>Reference:</h3><ol><li>Epic To Story Breakdown <a href="https://gitlab.com/varunsingh-personal/to-do/-/blob/main/n8n/epic-breakdown-system-prompt.md">System Prompt</a></li><li>Story to Task breakdown <a href="https://gitlab.com/varunsingh-personal/to-do/-/blob/main/n8n/story-breakdown-system-prompt.md">System Prompt</a></li><li>To Do app <a href="https://gitlab.com/varunsingh-personal/to-do">source-code</a>. (Roughly <a href="https://gitlab.com/varunsingh-personal/to-do/-/commits/main?ref_type=heads">one commit</a> per sub-task)</li><li>To Do app <a href="https://to-do-silk-six.vercel.app/">hosted</a> on Vercel+Supabase</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=220aaa5e795f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OAuth integration in MCP Servers]]></title>
            <link>https://medium.com/@varun.singh9786/oauth-integration-in-mcp-servers-5a50eb3b3737?source=rss-4f317f82f194------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a50eb3b3737</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[fastmcp]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[genai]]></category>
            <dc:creator><![CDATA[Varun Singh]]></dc:creator>
            <pubDate>Sun, 12 Oct 2025 07:15:10 GMT</pubDate>
            <atom:updated>2025-10-12T07:15:10.794Z</atom:updated>
            <content:encoded><![CDATA[<h3>MCP: An Emerging Framework</h3><p>The Model Context Protocol (<a href="https://modelcontextprotocol.io/docs/getting-started/intro">MCP</a>) is an open standard that enables AI agents and applications to securely interact with external tools and data sources through a unified interface. Without MCP, <strong>if there are M AI agents and N apps, developers would need to build and maintain MxN separate integrations</strong> — a costly and complex task. MCP addresses this challenge and is now supported by all major LLM providers.</p><h3>Authentication in MCP</h3><p>Initially, MCP servers were designed to run in a trusted environment — typically your local machine. Their functions were limited to simple use cases, such as file system access or web browsing.</p><p>Today, MCP servers can run remotely and support a much broader range of scenarios, from document management to graphic design. As a result, authentication has become a critical requirement.</p><p>Here’s the latest specification for authentication in MCP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*oVT8DmV162kBLY45rVIaZA.png" /></figure><h3>OAuth in MCP</h3><p>MCP relies on OAuth for secure authentication and <a href="https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization">expects</a> OAuth servers to support certain features:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*UxnL2gr0y4sk8jim1zD1EQ.png" /></figure><p>One of the interesting requirements here is <strong>Dynamic Client Registration</strong> (DCR). Let’s explore why this is significant with an example.</p><p>Suppose Slack needs to show Google Drive file previews inside chats. In this flow:</p><ul><li>Slack acts as the OAuth Client</li><li>Google Drive is the Resource Server</li><li>Google is the Authorization Server</li><li>The user is the Resource Owner</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KHGyGBVkPwhsGLTMA8s-iA.png" /></figure><p>Slack first registers with the Authorization Server to obtain a clientID and clientSecret. These credentials are then used to request tokens on behalf of the user, enabling Slack to access the user&#39;s Google Drive. This registration must be done in advance.</p><p>Simple enough.</p><p>In MCP, however, things work differently. Here, the MCP server plays the role of the Resource Server, and the MCP client is the OAuth Client. This means that each time a user connects an MCP server to an AI agent, a new OAuth client must be registered with the Authorization Server — dynamically and on the fly. This is where Dynamic Client Registration becomes essential. So the flow should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JG0mVgl0J4nslywGxHF4sw.png" /></figure><h3>The Gap and the Workaround</h3><p>While DCR makes sense in theory, it poses challenges in practice. The biggest issues are:</p><ul><li>How do we securely verify new clients before registering them?</li><li>Most Authorization Servers do not yet support DCR.</li></ul><p>While the first one is still up for discussion, to bridge the gap for second one, MCP SDKs like FastMCP have introduced a <a href="https://gofastmcp.com/servers/auth/oauth-proxy">workaround</a> following MCP’s <a href="https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#dynamic-client-registration">suggestion</a>. Their OAuth proxy implementation allows the MCP server to simulate DCR rather than rely on the Authorization Server directly.</p><p>Here’s how it works:</p><ul><li>The remote MCP server stores a fixed pair of clientID and clientSecret.</li><li>When a new MCP client attempts to register via DCR, the server pretends to issue new credentials.</li><li>Behind the scenes, it simply reuses the same stored credentials for all clients.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Swu_ZjGDoQouhqe9OoyOA.png" /></figure><p>This approach works for now but blurs the traditional boundary between an OAuth Client and a Resource Server.</p><h3>Conclusion</h3><p>The MCP landscape is evolving rapidly. While today’s authentication model has gaps, the community is actively discussing improvements. For example, one <a href="https://github.com/modelcontextprotocol/modelcontextprotocol/discussions/1405">proposal</a> suggests using the MCP server’s domain name as the clientID instead of generating one dynamically.</p><p>As large enterprises adopt MCP, it will be interesting to see whether the protocol evolves toward stricter, standards-compliant models — or if pragmatic workarounds like FastMCP’s remain the norm.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a50eb3b3737" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>