Build a local TypeScript server
Serve and inspect the local server
Connect the server factory to stdio and test discovery, validation, success, and errors with the official Inspector.
8 minute lesson
Now we can connect the capability factory to stdio. Create src/index.ts:
import { serveStdio } from '@modelcontextprotocol/server/stdio'
import { createServer } from './server.js'
void serveStdio(createServer)
serveStdio() owns the transport and chooses the protocol era from the opening exchange. It creates one server from our factory and pins it to that connection.
Start the Inspector from the project folder:
npx @modelcontextprotocol/inspector npx tsx src/index.ts
Discovery comes before execution. List the tools and inspect their descriptions, schemas, and read-only annotations. If the surface is unclear here, a model will also struggle to choose correctly.
Call search_notes with deploy, then call get_note with deploy-checklist. Check both the text content and structured result.
Repeat with an empty query, a limit of 20, and an unknown ID. Save the four outcomes in TESTING.md.
Also watch the terminal that launched the Inspector. Safe diagnostics may appear on stderr; ordinary log text must never appear inside the protocol stream.
Record the SDK version and negotiated protocol revision:
npm ls @modelcontextprotocol/server
An Inspector success proves the public MCP surface works. It does not prove authorization, data safety, or production readiness. We will test those boundaries separately.
Lesson completed