Skip to content

Commit f566bdb

Browse files
domdomeggclaude
andcommitted
docs: update quickstart to use TypeScript and tsx
Change the quickstart example from JavaScript (.mjs) to TypeScript (.ts) and use npx tsx to run it directly without requiring a build step. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4d0af08 commit f566bdb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ npm install @modelcontextprotocol/sdk
4949

5050
## Quick Start
5151

52-
Let's create a simple MCP server that exposes a calculator tool and some data. Save the following as `server.mjs`:
52+
Let's create a simple MCP server that exposes a calculator tool and some data. Save the following as `server.ts`:
5353

54-
```javascript
54+
```typescript
5555
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
5656
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
5757
import express from "express";
@@ -124,8 +124,10 @@ app.listen(port, () => {
124124
});
125125
```
126126

127-
Now run the server with `node server.mjs`. You can connect to it using any MCP client that supports streamable http, such as:
128-
- [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector): `npx npx @modelcontextprotocol/inspector` and connect to the streamable HTTP URL `http://localhost:3000/mcp`
127+
Install the deps with `npm install @modelcontextprotocol/sdk express zod@3`, and run with `npx -y tsx server.ts`.
128+
129+
You can connect to it using any MCP client that supports streamable http, such as:
130+
- [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector): `npx @modelcontextprotocol/inspector` and connect to the streamable HTTP URL `http://localhost:3000/mcp`
129131
- [Claude Code](https://docs.claude.com/en/docs/claude-code/mcp): `claude mcp add --transport http my-server http://localhost:3000/mcp`
130132
- [VS Code](https://code.visualstudio.com/docs/copilot/customization/mcp-servers): `code --add-mcp "{\"name\":\"my-server\",\"type\":\"http\",\"url\":\"http://localhost:3000/mcp\"}"`
131133
- [Cursor](https://cursor.com/docs/context/mcp): Click [this deeplink](cursor://anysphere.cursor-deeplink/mcp/install?name=my-server&config=eyJ1cmwiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAvbWNwIn0%3D)

0 commit comments

Comments
 (0)