MCP TypeScript Starter
A feature-complete MCP server template in TypeScript demonstrating tools, resources, prompts, and both stdio and HTTP transports.
README
MCP TypeScript Starter
A feature-complete Model Context Protocol (MCP) server template in TypeScript. This starter demonstrates all major MCP features with clean, production-ready code.
š Documentation
⨠Features
| Category | Feature | Description |
|---|---|---|
| Tools | hello |
Basic tool with annotations |
get_weather |
Tool with structured output schema | |
ask_llm |
Tool that invokes LLM sampling | |
long_task |
Tool with 5-second progress updates | |
load_bonus_tool |
Dynamically loads a new tool | |
| Resources | info://about |
Static informational resource |
file://example.md |
File-based markdown resource | |
| Templates | greeting://{name} |
Personalized greeting |
data://items/{id} |
Data lookup by ID | |
| Prompts | greet |
Greeting in various styles |
code_review |
Code review with focus areas |
š Quick Start
Prerequisites
- Node.js 20+
- npm or pnpm
Installation
# Clone the repository
git clone https://github.com/SamMorrowDrums/mcp-typescript-starter.git
cd mcp-typescript-starter
# Install dependencies
npm install
# Build
npm run build
Running the Server
stdio transport (for local development):
npm run start:stdio
HTTP transport (for remote/web deployment):
npm run start:http
# Server runs on http://localhost:3000
š§ VS Code Integration
This project includes VS Code configuration for seamless development:
- Open the project in VS Code
- The MCP configuration is in
.vscode/mcp.json - Build with
Ctrl+Shift+B(orCmd+Shift+Bon Mac) - Test the server using VS Code's MCP tools
Using DevContainers
- Install the Dev Containers extension
- Open command palette: "Dev Containers: Reopen in Container"
- Everything is pre-configured and ready to use!
š Project Structure
.
āāā src/
ā āāā tools.ts # Tool definitions (hello, get_weather, ask_llm, etc.)
ā āāā resources.ts # Resource and template definitions
ā āāā prompts.ts # Prompt definitions
ā āāā server.ts # Server orchestration (combines all modules)
ā āāā stdio.ts # stdio transport entrypoint
ā āāā http.ts # HTTP transport entrypoint
āāā .vscode/
ā āāā mcp.json # MCP server configuration
ā āāā tasks.json # Build/run tasks
ā āāā extensions.json
āāā .devcontainer/
ā āāā devcontainer.json
āāā package.json
āāā tsconfig.json
āāā .prettierrc # Prettier configuration
āāā eslint.config.js
š ļø Development
# Development mode with live reload
npm run dev
# Build for production
npm run build
# Format code
npm run format
# Lint
npm run lint
# Clean build
npm run clean && npm run build
Live Reload
The npm run dev command uses tsx watch for instant reloads during development.
Changes to any .ts file will automatically restart the server.
š MCP Inspector
The MCP Inspector is an essential development tool for testing and debugging MCP servers.
Running Inspector
npx @modelcontextprotocol/inspector -- npx tsx src/stdio.ts
What Inspector Provides
- Tools Tab: List and invoke all registered tools with parameters
- Resources Tab: Browse and read resources and templates
- Prompts Tab: View and test prompt templates
- Logs Tab: See JSON-RPC messages between client and server
- Schema Validation: Verify tool input/output schemas
Debugging Tips
- Start Inspector before connecting your IDE/client
- Use the "Logs" tab to see exact request/response payloads
- Test tool annotations are exposed correctly
- Verify progress notifications appear for
long_task
š Feature Examples
Tool with Annotations
server.tool(
"hello",
{
title: "Say Hello",
description: "A friendly greeting tool",
annotations: { readOnlyHint: true },
},
{ name: z.string() },
async ({ name }) => ({
content: [{ type: "text", text: `Hello, ${name}!` }],
})
);
Resource Template
server.resourceTemplate(
"greeting://{name}",
{ name: "Personalized Greeting", mimeType: "text/plain" },
async ({ name }) => ({
contents: [{
uri: `greeting://${name}`,
text: `Hello, ${name}!`,
}],
})
);
Tool with Progress Updates
server.tool(
"long_task",
{ title: "Long Task" },
{ taskName: z.string() },
async ({ taskName }, { sendProgress }) => {
for (let i = 0; i < 5; i++) {
await sendProgress({ progress: i / 5, total: 1.0 });
await sleep(1000);
}
return { content: [{ type: "text", text: "Done!" }] };
}
);
š Environment Variables
Copy .env.example to .env and configure:
cp .env.example .env
| Variable | Description | Default |
|---|---|---|
PORT |
HTTP server port | 3000 |
š¤ Contributing
Contributions welcome! Please ensure your changes maintain feature parity with other language starters.
š License
MIT License - see LICENSE for details.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.