This lesson demonstrates how to create a basic Model Context Protocol (MCP) server that provides a simple greeting functionality. You'll learn how to structure, build, and use your MCP server in various IDEs like Cursor, Windsurf, and VS Code.
Creating Your First MCP Server (from GitHub Tutorial Series)
server/
├── package.json # Node.js project configuration
├── tsconfig.json # TypeScript configuration
└── src/
├── index.ts # Main server implementation
└── tools/ # Tool implementations
└── greeting.ts # Greeting tool definition
-
Server Setup (
index.ts)- Creates an MCP server instance
- Defines tool list
- Implements tool call handlers
- Sets up stdio transport
-
Tool Implementation (
tools/greeting.ts)- Defines tool interface
- Implements tool logic
-
Install dependencies:
cd server npm install -
Build the server:
npm run build
This will:
- Compile TypeScript to JavaScript
- Make the output executable
- Generate files in the
build/directory
- Install the MCP extension
- Point to your built server in the MCP settings
- The greeting tool will be available in your AI commands
- Configure the MCP server path in settings
- The greeting functionality will be accessible through Cascade
- Install the MCP extension for VS Code
- Configure the extension to use your built server
- Access the greeting tool through the command palette
- MCP Server: A standardized way to extend AI capabilities in IDEs
- Tools: Modular functions that can be called by the IDE
- Transport: Communication layer (stdio in this case)
- Request Handlers: Logic for processing tool requests
- Try modifying the greeting tool
- Add new tools to the server
- Explore more complex MCP features