使用说明
MCP Server Template (TypeScript)
Welcome to the MCP Server template! A starter for building Model Context Protocol servers with TypeScript.
Features
- MCP SDK for building MCP servers
- Hono web framework for HTTP transport
- Zod schema validation
- Ready for Cloudflare Workers with Wrangler
- Vitest for testing
MCP Capabilities
This template includes example MCP implementations:
Tools
greet- Greets someone by name (returns structured JSON)ungreet- Says goodbye by name (returns text content)
Prompts
nplus1- Generates tests for N+1 query issues in Java Spring applications
Requirements
- Node.js 26 or later
- pnpm, at the version pinned in the
packageManagerfield ofpackage.json
Getting Started
Node.js 26 no longer bundles Corepack, so install pnpm once with npm:
npm install -g pnpm@10.17.1
Then install dependencies and start developing:
# Install dependencies
pnpm install
# Run the development server
pnpm dev
# Check formatting (does not modify files)
pnpm format:check
# Fix formatting
pnpm format
# Lint (does not modify files)
pnpm run lint:check
# Fix lint issues
pnpm lint
# Run all checks: formatting, lint, and tests
pnpm check
# Build the project
pnpm build
# Run tests
pnpm test
If you are using this repository as a template for a new project, refer to the "Using This Template In A New Project" section in AGENTS.md for the required replacement checklist.
MCP Endpoint
The MCP server is available at /mcp. Use an MCP client (like Claude Desktop or Claude Code) to connect and use the tools and prompts.
The endpoint is stateless: every request gets a fresh server from setup() in src/route.ts. Both 2025-era and 2026-07-28 clients are accepted.
Not supported yet
- Change notifications (
list_changed, resource updates): the handler lives for one request, so there is nothing to publish to. See the comment insrc/index.tsfor what to change. - Skills and Tasks extensions: waiting for server-side SDK support (typescript-sdk#2818, typescript-sdk#2782).
License
MIT, see LICENSE for details.