My First MCP Server 🚀
Welcome! I built this project to explore and implement my own Model Context Protocol (MCP) server. This server connects a local development environment to an AI assistant (Claude Desktop), allowing the AI to execute custom local code.
🧠 What is MCP?
The Model Context Protocol (MCP) is an open standard introduced by Anthropic. Think of it like a USB-C cable for AI models.
Normally, Large Language Models (LLMs) are isolated in the cloud. They can't see your local files, interact with your databases, or run your internal scripts. MCP solves this by providing a standardized, secure way for AI models to connect to external tools and data sources.
🎯 Purpose and Use Cases
The purpose of this project is to demonstrate how to break an AI out of its isolated bubble. By building an MCP server, we give the AI a "menu" of tools it can use.
Why is this powerful?
- Local File Access: You can build tools that let the AI read your local codebase or logs.
- Live Data Fetching: The AI can trigger API calls (like fetching live weather, stock prices, or database queries) and read the responses.
- Task Automation: The AI can execute local scripts on your behalf.
This specific project features a Greeting Tool that takes a user's name as input from the AI and returns a custom formatted greeting generated entirely on the local machine.
---
⚙️ Step-by-Step Setup Guide
If you want to run this MCP server on your own machine, follow these instructions carefully.
Prerequisites
- Node.js (v18 or higher) installed on your machine.
- Claude Desktop App installed and logged in.
1. Installation
Clone this repository to your local machine and install the required dependencies:
git clone <github-repo-url>
# 1. Create a new folder and move into it
mkdir my-first-mcp
cd my-first-mcp
# 2. Initialize a blank Node.js project (creates a package.json file)
npm init -y
# 3. Install the official MCP SDK
npm install @modelcontextprotocol/sdk
# 4. Install TypeScript tools for development
npm install -D typescript @types/node ts-node
# 5. Create a basic TypeScript configuration file
npx tsc --init
2. Compile the TypeScript Code
This project is written in modern TypeScript. You need to compile it into JavaScript so Node.js can run it.
Run the following command in your terminal:
Bash
npx tsc
Note: This will generate a new dist folder containing the compiled index.js file.
3. Get Your Absolute Path
Claude Desktop needs to know exactly where this compiled file lives on your computer.
Open the new dist folder.
Right-click on index.js and select Copy Path (You need the full absolute path, e.g., C:\Users\Name\Desktop\my-first-mcp\dist\index.js).
4. Configure Claude Desktop
You need to link your local server to the Claude app.
Open the Claude Desktop app.
Go to Settings > Developer > Edit Config.
This will open a file named claude_desktop_config.json. Add the following configuration, replacing the args path with the absolute path you copied in the previous step:
JSON
{
"mcpServers": {
"my-first-mcp": {
"command": "node",
"args": ["C:/YOUR/ABSOLUTE/PATH/HERE/dist/index.js"],
"env": {}
}
}
}
Windows Users: Ensure your path uses forward slashes / or double backslashes \\.
5. Restart and Test
Fully close Claude Desktop (ensure it is quit from the system tray).
Reopen the application.
Start a new chat. You should see a small "plug" or "hammer" icon indicating local tools are connected.
Prompt Claude: "Use your tools to greet [Your Name]."
Watch as Claude routes the request to your local Node.js server and returns the custom response!
Built by Imran






