<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dishant Kumar</title>
    <description>The latest articles on DEV Community by Dishant Kumar (@dishant27).</description>
    <link>https://dev.to/dishant27</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4227673%2F7b06256a-cef9-4a26-956b-3eb23cee9630.png</url>
      <title>DEV Community: Dishant Kumar</title>
      <link>https://dev.to/dishant27</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dishant27"/>
    <language>en</language>
    <item>
      <title>Why your first MCP server doesn't show any tools (and a starter that fixes it)</title>
      <dc:creator>Dishant Kumar</dc:creator>
      <pubDate>Thu, 05 Nov 2026 05:07:54 +0000</pubDate>
      <link>https://dev.to/dishant27/why-your-first-mcp-server-doesnt-show-any-tools-and-a-starter-that-fixes-it-kkf</link>
      <guid>https://dev.to/dishant27/why-your-first-mcp-server-doesnt-show-any-tools-and-a-starter-that-fixes-it-kkf</guid>
      <description>&lt;h1&gt;
  
  
  Why your first MCP server doesn't show any tools (and a starter that fixes it)
&lt;/h1&gt;

&lt;p&gt;I've built MCP servers for LinkedIn, Twitter/X, Medium and Kaggle. Most of what went wrong with them wasn't the API logic. It was small plumbing mistakes that the usual starters don't protect you from. So I pulled the fixes into one small template: &lt;strong&gt;&lt;a href="https://github.com/Dishant27/mcp-server-starter" rel="noopener noreferrer"&gt;mcp-server-starter&lt;/a&gt;&lt;/strong&gt; (TypeScript, MIT).&lt;/p&gt;

&lt;h2&gt;
  
  
  Why most MCP starters break
&lt;/h2&gt;

&lt;p&gt;The common failures look like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The server "connects" but the client shows &lt;strong&gt;no tools&lt;/strong&gt;, or you get JSON parse errors.&lt;/li&gt;
&lt;li&gt;One bad tool call &lt;strong&gt;kills the whole server&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;A missing API key &lt;strong&gt;crashes on startup&lt;/strong&gt; and leaves an unreadable stack trace in the client logs.&lt;/li&gt;
&lt;li&gt;An API key ends up &lt;strong&gt;printed in logs&lt;/strong&gt; or committed in a &lt;code&gt;.env&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Nothing runs in CI, so a broken build only shows up when a user tries it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. With stdio, stdout belongs to the protocol
&lt;/h2&gt;

&lt;p&gt;With the stdio transport, every byte on stdout has to be a JSON-RPC message. One &lt;code&gt;console.log("starting...")&lt;/code&gt; puts plain text into that stream. Depending on the client, you get parse errors, an empty tool list, or a connection that drops without explanation.&lt;/p&gt;

&lt;p&gt;The starter handles this three ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;src/logger.ts&lt;/code&gt; writes everything to &lt;strong&gt;stderr&lt;/strong&gt;, which Claude Desktop and Cursor show as server logs. &lt;code&gt;LOG_LEVEL&lt;/code&gt; can be &lt;code&gt;debug&lt;/code&gt;, &lt;code&gt;info&lt;/code&gt;, &lt;code&gt;warn&lt;/code&gt; or &lt;code&gt;error&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;ESLint's &lt;code&gt;no-console&lt;/code&gt; rule allows only &lt;code&gt;console.error&lt;/code&gt;, so a stray &lt;code&gt;console.log&lt;/code&gt; &lt;strong&gt;fails lint and CI&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Secrets are never printed. Startup logs only show a masked key like &lt;code&gt;sk-t…7890&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// eslint.config.js&lt;/span&gt;
&lt;span class="nx"&gt;rules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// stdout is reserved for the MCP protocol. Use the logger (stderr) instead.&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;no-console&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Every tool input is validated with zod
&lt;/h2&gt;

&lt;p&gt;Tools use the SDK 1.x &lt;code&gt;McpServer.registerTool&lt;/code&gt; API with a zod &lt;code&gt;inputSchema&lt;/code&gt;. The SDK validates arguments before your handler runs, and the &lt;code&gt;.describe()&lt;/code&gt; text is what the model reads when it fills in arguments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;exampleSearchInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;query must not be empty&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Text to search for&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Maximum number of results (1-50)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Failures become tool errors, not crashes
&lt;/h2&gt;

&lt;p&gt;Each handler runs inside &lt;code&gt;runTool()&lt;/code&gt;. Anything it throws becomes an MCP result with &lt;code&gt;isError: true&lt;/code&gt; and a short message the model can act on. The full details, including the stack, go to stderr. One failed upstream call never takes the server down.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Safe API-key handling
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;src/config.ts&lt;/code&gt; reads the key &lt;strong&gt;lazily&lt;/strong&gt;. If &lt;code&gt;EXAMPLE_API_KEY&lt;/code&gt; is missing, the server still starts and lists its tools. Only the tool that needs the key returns a clear &lt;code&gt;ConfigError&lt;/code&gt; telling you to add it to the &lt;code&gt;env&lt;/code&gt; block of your MCP client config. Keys live in that &lt;code&gt;env&lt;/code&gt; block, or in a local &lt;code&gt;.env&lt;/code&gt; that's already in &lt;code&gt;.gitignore&lt;/code&gt;. &lt;code&gt;maskSecret()&lt;/code&gt; lets you show that a key is set without revealing it.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. CI from day one
&lt;/h2&gt;

&lt;p&gt;A GitHub Actions workflow runs &lt;code&gt;npm ci&lt;/code&gt;, typecheck, lint and build on &lt;strong&gt;Node 20 and 22&lt;/strong&gt; for every push and PR. Because of the lint rule, CI also catches the stdout mistake.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/Dishant27/mcp-server-starter.git my-mcp-server
&lt;span class="nb"&gt;cd &lt;/span&gt;my-mcp-server
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm run build
&lt;span class="nv"&gt;EXAMPLE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-key npm run inspect   &lt;span class="c"&gt;# opens the MCP Inspector&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Adding a tool takes three steps. Copy &lt;code&gt;src/tools/exampleSearch.ts&lt;/code&gt;, register it in &lt;code&gt;src/tools/index.ts&lt;/code&gt;, and rebuild. The README has a copy-paste example and Claude Desktop and Cursor configs.&lt;/p&gt;

&lt;p&gt;Repo: &lt;strong&gt;&lt;a href="https://github.com/Dishant27/mcp-server-starter" rel="noopener noreferrer"&gt;https://github.com/Dishant27/mcp-server-starter&lt;/a&gt;&lt;/strong&gt;. Issues and PRs are welcome, especially from anyone who has hit a different "why doesn't my MCP server work" problem.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>typescript</category>
      <category>ai</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
