demo-mcp-01

demo-mcp-01

A starter MCP server that provides a calculator tool for performing basic arithmetic operations within Claude Desktop. It serves as a demonstration project for building and extending local tools using the Model Context Protocol.

Category
访问服务器

README

demo-mcp-01

A local MCP (Model Context Protocol) server for Claude Desktop.


Table of Contents


Overview

This project is a local MCP (Model Context Protocol) server that extends Claude Desktop with custom tools. MCP is an open protocol that allows Claude to interact with local services, files, APIs, and more — turning Claude into a powerful assistant tailored to your specific workflow.

This server is built with the MCP TypeScript SDK and runs locally on your machine via stdio transport. Once configured, Claude Desktop automatically starts the server and makes its tools available in every conversation.

What's included

  • calculate — Performs basic math operations: add, subtract, multiply, and divide

This is a starter project — you can easily extend it by adding more tools in src/index.js.


📁 Project Structure

demo-mcp-01/
│
├── src/
│   └── index.js          # MCP server entry point
│
├── tools/
│   └── calculate.js      # Calculate tool logic
│
├── .gitignore            # Ignore node_modules, .env, etc.
├── package.json          # Dependencies and scripts
└── README.md             # This file

Getting Started

Prerequisites


1. Clone the Repository

git clone https://github.com/santanu2908/demo-mcp-01.git
cd demo-mcp-01

2. Install Dependencies

npm install

3. Configure Claude Desktop

Create a file named claude_desktop_config.json in the Claude config folder.

Config folder path (Windows):

C:\Users\<YourUsername>\AppData\Roaming\Claude\

💡 To quickly open this folder, press Win + R and type: %APPDATA%\Claude If the Claude folder doesn't exist, create it manually.

Paste the following into claude_desktop_config.json, updating the path to match where you cloned the repo:

{
  "mcpServers": {
    "my-local-server": {
      "command": "node",
      "args": [
        "C:\\Users\\<YourUsername>\\path\\to\\demo-mcp-01\\src\\index.js"
      ]
    }
  }
}

⚠️ On Windows, use double backslashes \\ in the path. Example: "C:\\Users\\John\\Documents\\demo-mcp-01\\src\\index.js"

4. Restart Claude Desktop

Fully quit Claude Desktop (check the system tray → right-click → Quit) and reopen it.

5. Verify the Setup

Open Claude Desktop and go to Settings → Developer. You should see my-local-server listed with a green status indicator showing it is running. If it shows an error or is missing, revisit the config path and restart Claude Desktop.


⚙️ How the Server Starts — No npm start Needed

You never need to manually run npm start or keep a terminal open. Claude Desktop launches the server for you automatically.

When Claude Desktop reads your config:

{
  "command": "node",
  "args": ["C:\\...\\src\\index.js"]
}

It runs node src/index.js as a child process in the background every time Claude Desktop opens. When you close Claude Desktop, it shuts the process down too.

This works because the server uses StdioServerTransport — it communicates via stdin/stdout rather than HTTP or a network port. Claude Desktop pipes messages directly to the process, so there is nothing to manually start or keep alive. Claude Desktop owns the entire process lifecycle.

Traditional Server MCP stdio Server
Who starts it? You (npm start) Claude Desktop
How does it communicate? HTTP / WebSocket stdin / stdout
Who keeps it alive? You Claude Desktop
Port needed? Yes No

🔄 How It Works — End-to-End Flow

Here's a walkthrough of a real tool call: "Multiply 12 by 7"

Step 1 — User Prompt

The user sends a message to Claude Desktop:

Use the calculate tool to multiply 12 by 7

Step 2 — Tool Discovery

  • Claude used the internal tool_search mechanism to locate the calculate tool by querying "math multiply".
  • The tool schema was returned with the following parameters:
    • a → number (first operand)
    • b → number (second operand)
    • operation → one of add | subtract | multiply | divide

Step 3 — Tool Invocation

  • Claude called the calculate tool with:
    a = 12
    b = 7
    operation = multiply
    
  • The server executed the operation and returned:
    Result: 84
    

Step 4 — Result Verification

  • Claude received 84 from the tool and confirmed it as correct.
  • This validated the full MCP loop: Claude → Tool Call → Local Server → Result → Claude.

🛠 Tool Reference

calculate

Performs a basic arithmetic operation on two numbers.

Parameter Type Required Values
a number Any numeric value
b number Any numeric value
operation string add, subtract, multiply, divide

Example Request:

{
  "a": 12,
  "b": 7,
  "operation": "multiply"
}

Example Response:

Result: 84

Troubleshooting

No hammer icon showing?

  • Double-check the path in your config file points to the correct index.js
  • Validate your JSON at jsonlint.com
  • Make sure Node.js is installed: run node --version in a terminal
  • Fully quit Claude Desktop from the system tray before restarting

Config not loading?

  • Confirm the file is named exactly claude_desktop_config.json (not .json.txt)
  • Confirm it lives in %APPDATA%\Claude\, not inside the project folder

📌 Key Takeaways

  • MCP lets Claude call real, external code — not guess answers.
  • The calculate tool is deterministic: same input always yields the same output.
  • This pattern scales to databases, APIs, file systems, and hardware.

Built with Model Context Protocol · Connected via Claude.ai Developer Tools

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选