My Learning MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@My Learning MCP Serverwhat's the weather in Tokyo?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ค My Learning MCP Server
A hands-on MCP (Model Context Protocol) server built with TypeScript to learn the three core MCP primitives: Tools, Resources, and Prompts.
๐ What is MCP?
The Model Context Protocol is an open standard by Anthropic that lets AI models (like Claude) connect to external data sources, APIs, and custom logic in a standardized way.
graph LR
subgraph Hosts["AI Hosts"]
A["Claude Desktop"]
B["MCP Inspector"]
C["Gemini LLM Client"]
end
subgraph Server["๐ข MCP Server โ this project"]
E["src/index.ts"]
subgraph T["๐ง Tools"]
F["calculator"]
G["get_weather"]
end
subgraph R["๐ Resources"]
H["notes://all ยท 1 ยท 2 ยท 3"]
end
subgraph P["๐ฌ Prompts"]
I["code-review ยท explain-concept"]
end
E --> F & G & H & I
end
A & B & C -->|"MCP Protocol / stdio"| E
classDef host fill:#3b82f6,stroke:#1d4ed8,color:#fff
classDef server fill:#22c55e,stroke:#15803d,color:#fff
classDef prim fill:#f0fdf4,stroke:#16a34a,color:#166534
class A,B,C host
class E server
class F,G,H,I primRelated MCP server: MCP Learning Project
๐๏ธ Project Structure
my-mcp-server/
โโโ src/
โ โโโ index.ts โ Main MCP server entry point
โ โโโ client/
โ โ โโโ index.ts โ ๐ค Gemini LLM client
โ โโโ tools/
โ โ โโโ calculator.ts โ ๐ง Calculator tool
โ โ โโโ weather.ts โ ๐ง Weather lookup tool
โ โโโ resources/
โ โ โโโ notes.ts โ ๐ Notes resource
โ โโโ prompts/
โ โโโ templates.ts โ ๐ฌ Prompt templates
โโโ spec/
โ โโโ README.md โ Spec index
โ โโโ 01-architecture/ โ Server architecture design
โ โ โโโ why-mcp.md โ "N ร M" problem breakdown
โ โโโ 02-llm-client/ โ LLM client design
โโโ .env โ API keys (gitignored)
โโโ package.json
โโโ tsconfig.json
โโโ README.md๐งฉ Core MCP Primitives
Primitive | Purpose | Example |
๐ง Tools | Actions the AI can execute | Calculate math, fetch weather |
๐ Resources | Data the AI can read | Notes, files, DB records |
๐ฌ Prompts | Reusable message templates | Code review, explain concept |
๐ Getting Started
1. Install dependencies
npm install2. Set up your API key (required for LLM client)
cp .env.example .envThen open .env and add your Gemini API key:
GEMINI_API_KEY=your_key_hereGet a free key at aistudio.google.com/app/apikeys. See
spec/02-llm-client/design.mdfor detailed setup steps.โ ๏ธ The MCP Inspector and server work without the key. Only
npm run clientneeds it.
3. Run in dev mode (with hot reload)
npm run dev4. Open the MCP Inspector (visual debugger in the browser)
npm run inspectorThis opens a web UI where you can:
Call tools interactively
Browse and read resources
Try out prompt templates
5. Run the Gemini LLM client (requires API key from step 2)
npm run clientChat in plain English โ Gemini will automatically call tools as needed.
6. Build for production
npm run build๐ง Tools
Tools let the AI execute actions (like making an API call or calculating math).
How to use:
In MCP Inspector (
npm run inspector): Go to the Tools tab, select a tool, enter the JSON arguments, and click "Run Tool".In Gemini Client (
npm run client): Ask natural language questions like "What is 25 x 4?" or "What's the weather in Tokyo?" Gemini will automatically call the tool for you.
calculator
Perform basic arithmetic operations.
Input:
{
"operation": "add" | "subtract" | "multiply" | "divide",
"a": number,
"b": number
}Example: { "operation": "multiply", "a": 12, "b": 7 } โ 12 multiply 7 = 84
get_weather
Get current weather for a city (uses mock data for learning).
Input:
{
"city": "London",
"unit": "celsius" | "fahrenheit"
}Example response:
{
"city": "London",
"temperature": "12ยฐC",
"humidity": "80%",
"condition": "Cloudy",
"timestamp": "2025-01-01T10:00:00.000Z"
}๐ Resources
Resources provide read-only data (like a file or database) for the AI to read.
How to use:
In MCP Inspector (
npm run inspector): Go to the Resources tab and click "List Resources" to see all available notes. Click on a specific URI (likenotes://1) and click "Read Resource" to see its contents.In Gemini Client: (Coming soon - currently the client only supports Tools, not Resources).
Resources are accessed via URI:
URI | Description |
| Summary list of all notes |
| Note #1: "What is MCP?" |
| Note #2: "MCP Transport Types" |
| Note #3: "Why use Zod for validation?" |
๐ฌ Prompts
Prompts are reusable templates (like slash commands) that generate structured instructions for an LLM.
How to use:
In MCP Inspector (
npm run inspector): Go to the Prompts tab, selectcode-revieworexplain-concept, fill out the required arguments (e.g.,language: "TypeScript"), and click "Get Prompt". It returns a highly detailed, ready-to-use prompt template.In Claude Desktop: These appear as slash commands. You type
/code-reviewand it prompts you for the arguments.
code-review
Generates a structured code review prompt.
Argument | Required | Values |
| โ | TypeScript, Python, Go, etc. |
| โ |
|
explain-concept
Explains a technical concept at a chosen level.
Argument | Required | Values |
| โ | e.g. "MCP Resources", "async/await" |
| โ |
|
๐ฅ๏ธ Connect to Claude Desktop
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"my-mcp-server": {
"command": "node",
"args": ["/Users/YOUR_USERNAME/workspace/Personal/my-mcp-server/dist/index.js"]
}
}
}Then run npm run build and restart Claude Desktop.
๐ Key Learnings
stdio transport โ the server communicates via stdin/stdout; always log to
stderrAlways validate inputs โ use Zod's
safeParseto catch bad data before it crashes your serverThree primitives โ Tools (do), Resources (read), Prompts (template)
McpError โ throw typed errors so the client receives structured error responses
Capabilities โ declare what your server supports in the Server constructor
๐ Further Reading
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sushobhitrajan/my-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server