My Learning MCP Server
Click on "Deploy 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: simple_mcp
ποΈ 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
Available Tools
2 toolscalculatorA
Perform basic arithmetic operations: add, subtract, multiply, or divide two numbers.
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | The first number | |
| b | Yes | The second number | |
| operation | Yes | The arithmetic operation to perform |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It clearly describes the core behavior (performs the selected arithmetic operation) but omits edge cases such as division by zero, error handling, or return type. For a pure computation tool, this is acceptable but not deeply transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, tightly written sentence that front-loads the main verb and resource, then lists the operations. No filler words or unnecessary repetition; every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple, stateless calculator with fully documented parameters, the description is sufficient for an agent to select and invoke it correctly. The absent output schema is not a gap here since the return value (the arithmetic result) is obvious, though the description does not mention division-by-zero behavior.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema provides 100% coverage for all parameters, including descriptions for a, b, and operation. The tool description merely restates the operation names without adding meaning beyond the schema. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a precise verb ('perform') with a resource ('basic arithmetic operations'), and enumerates the exact operations ('add, subtract, multiply, or divide'). It is unambiguous and clearly distinct from the only sibling tool, get_weather, making the tool's purpose immediately apparent.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the toolβwhenever basic arithmetic on two numbers is neededβbut it does not explicitly state usage context or exclusions. Since the only sibling is get_weather, no alternative routing is needed, but there is no explicit 'when to use' guidance beyond the obvious purpose.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_weatherA
Get the current weather for a city. Returns temperature, humidity, and conditions.
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | Name of the city to get weather for | |
| unit | No | Temperature unit (default: celsius) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full behavioral burden and does disclose the return payload and that the data is current. However, it does not mention behavior for invalid or ambiguous city names, data freshness, or the default unit behavior beyond what the schema already says.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no filler; the core action, target, and return values are all front-loaded. Every clause earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter read-only tool, the combination of description and schema is largely sufficient: required city, optional unit, and the returned fields are all covered. Missing only minor operational considerations such as error handling, which is acceptable for this level of complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the input schema already fully documents city and unit, including the default temperature unit. The description adds no parameter-level detail beyond what the schema provides, which meets the baseline but does not exceed it.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('get'), a clear resource ('current weather'), and a target ('a city'), and explicitly lists the returned data (temperature, humidity, conditions). This makes it easily distinguishable from the only sibling tool, calculator.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'current weather for a city' clearly signals the intended use case: when real-time weather data is needed. There are no similar sibling tools that require exclusion, though no explicit when-not-to-use guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.0.0- First observed
calculator - First observed
get_weather
TDQS
Scored across 2 tools
Calculator and get_weather are completely unrelated and clearly distinguishable. There is no possibility of confusion between arithmetic operations and weather retrieval.
The names use mixed conventions: 'calculator' is a noun while 'get_weather' follows a verb_noun pattern. Both are readable, but the naming style is not consistent across the set.
With only two tools, the server feels very thin, especially for a vaguely named 'Learning MCP Server.' The tools are also unrelated, making the small count feel arbitrary rather than focused.
The domain is unclear, so it is difficult to define full coverage. Calculator covers basic arithmetic but no advanced operations, and weather only returns current conditions without forecast or location management, leaving notable gaps.
Maintenance
Related MCP Connectors
An MCP server for deep research or task groups
Educational MCP server with 17 math/stats tools, visualizations, and persistent workspace
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceA comprehensive educational server demonstrating Model Context Protocol capabilities for tools, resources, and prompts, allowing AI assistants to connect to external data and functionality.8 npm-
- FlicenseNot gradedqualityCmaintenanceAn educational MCP server that teaches implementing the Model Context Protocol from scratch, enabling AI models to discover and invoke tools via JSON-RPC over stdio.-
- AlicenseBqualityCmaintenanceA toy MCP server for exploring Model Context Protocol capabilities, including resources, tools, and prompts.1Apache 2.0
- AlicenseAqualityCmaintenanceA learning-focused MCP server that provides tools for current time, arithmetic, random quotes, mock weather, and UUID generation, demonstrating the Model Context Protocol end-to-end.5MIT