Simple MCP Server
A minimal MCP server providing basic calculator operations (add, echo) and Android device management tools (list connected devices and available emulators via ADB).
README
Simple MCP Server with Add Functionality
This is a minimal MCP (Model Context Protocol) server that provides two tools:
- echo - Echoes back any text you send
- add - Adds two numbers together
How it Works
This MCP server acts as a bridge between an AI Model (like Claude) and your local environment (Android tools and system commands).
Communication Flow
The following diagram illustrates how a user prompt triggers a tool execution:
sequenceDiagram
participant User
participant AI as AI Model (Claude)
participant MCP as MCP Server (Node.js)
participant Tools as Android Tools (ADB/Emulator)
User->>AI: "Are there any Android phones connected?"
AI->>MCP: Call tool: list_android_devices
MCP->>Tools: Execute: adb devices
Tools-->>MCP: Return device list
MCP-->>AI: Return tool result (JSON)
AI-->>User: "Yes, you have 2 emulators connected..."
Detailed Process
- User Prompt: You send a natural language request to the AI.
- Tool Selection: The AI identifies that the request requires a specific tool (e.g.,
list_android_devices) based on the tool descriptions provided by the MCP server. - MCP Request: The AI sends a JSON-RPC request to the MCP server via the standard transport (stdio).
- Execution: The MCP server executes the corresponding system command (like
adboremulator) using Node.jschild_process. - Response: The server captures the command output and sends it back to the AI as a structured response.
- AI Interpretation: The AI interprets the raw data and provides a human-friendly answer to you.
PlantUML Source
If you wish to render this diagram elsewhere, here is the PlantUML source:
@startuml
actor User
participant "AI Model (Claude)" as AI
participant "MCP Server (Node.js)" as MCP
participant "Android Tools (ADB/Emulator)" as Tools
User -> AI : "Are there any Android phones connected?"
AI -> MCP : Call tool: list_android_devices
MCP -> Tools : Execute: adb devices
Tools -> MCP : Return device list
MCP -> AI : Return tool result (JSON)
AI -> User : "Yes, you have 2 emulators connected..."
@enduml
Prerequisites
- Node.js installed
- Dependencies installed (
npm install)
Installation
npm install
Running as a Local MCP Server
Option 1: Direct Node Execution
node server.js
Option 2: Configure in Claude Desktop (or other MCP clients)
Add this to your MCP client configuration (e.g., claude_desktop_config.json):
{
"mcpServers": {
"simple-calculator": {
"command": "node",
"args": ["d:\\work\\mcp\\mcp-min\\server.js"]
}
}
}
Note: Update the path in args to match your actual installation directory.
Available Tools
1. echo
Echoes back whatever text you send.
Input:
text(string, required): The text to echo back
Output:
echoed(string): The echoed text
Example:
{
"text": "Hello, World!"
}
2. add
Adds two numbers together.
Input:
a(number, required): First numberb(number, required): Second number
Output:
result(number): Sum of a and b
Example:
{
"a": 5,
"b": 3
}
Returns: { "result": 8 }
3. list_android_devices
Lists connected Android devices using the adb command.
Input:
- None
Output:
text(string): The output of theadb devicescommand.
Example:
Returns: List of devices attached\nemulator-5554\tdevice
4. list_android_emulators
Lists available Android emulators (AVDs) using the emulator -list-avds command.
Input:
- None
Output:
text(string): The list of available AVD names.
Example:
Returns: Pixel_9a\nPixel_Tablet
Testing the Server
You can test the server by:
- Running it directly with
node server.js - Connecting it to an MCP client like Claude Desktop
- Using the tools through the client interface
The server communicates via stdio (standard input/output), which is the standard transport for MCP servers.
Example Prompts
Once the MCP server is connected to your client (like Claude Desktop), you can use prompts like these to trigger the tools:
For the add tool:
- "Can you add 25 and 37 for me?"
- "What is the sum of 123.45 and 67.89?"
- "I have 15 apples and my friend gives me 28 more. How many do I have in total? (Use the add tool)"
- "Calculate 1024 + 2048."
For the echo tool:
- "Echo the phrase 'MCP is awesome!'"
- "Can you repeat back exactly what I say: 'Testing the echo functionality'?"
- "Use the echo tool to send back 'Hello from the other side'."
For the list_android_devices tool:
- "List my connected Android devices."
- "Show me all Android devices currently attached via adb."
- "Are there any Android phones connected?"
For the list_android_emulators tool:
- "What Android emulators do I have available?"
- "List all my AVDs."
- "Show me the list of Android emulators I can start."
Server Details
- Name: simple-mcp-server
- Version: 0.0.1
- Transport: stdio (StdioServerTransport)
- Module Type: ES Modules (import/export)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。