MCP Stdio Server
A Model Context Protocol server that provides tools for mathematical calculations and directory listing, alongside prompt templates for code reviews and explanations. It enables file system access and resource reading through stdio transport.
README
MCP Stdio Server
A complete Model Context Protocol (MCP) server implementation using stdio transport that showcases:
- Resources: File system access to read project files (README.md, package.json, src/server.ts)
- Tools: Calculator for mathematical operations and file listing
- Prompts: Code review and code explanation assistants
Features
- MCP server with stdio transport
- File reading resources for project files
- Mathematical calculator tool
- Directory listing tool
- Code review and explanation prompt templates
- VSCode integration ready
- Test client for basic functionality testing
Setup
- Install dependencies:
npm install
- Build the project:
npm run build
Testing Options
Option 1: Basic Functionality Test (No Additional Tools Required)
npm run test-simple
This runs a simple client that tests basic MCP communication with the server.
Option 2: Comprehensive Testing (Requires mcp-cli Installation)
First, install mcp-cli globally:
npm install -g @modelcontextprotocol/cli
Then run comprehensive tests:
# Set the MCP configuration
export MCP_CLI_CONFIG_PATH=$(pwd)/mcp_config.json
# On Windows Command Prompt, use: set MCP_CLI_CONFIG_PATH=%cd%\mcp_config.json
# List available tools
mcp-cli tool list --server hjmcp-stdio
# Test calculator tool
mcp-cli tool call calculate --server hjmcp-stdio --input '{"expression": "2 + 3 * 4"}'
# Test file listing tool
mcp-cli tool call list_files --server hjmcp-stdio --input '{"directory": "."}'
# Test resource reading
mcp-cli tool read file://package.json --server hjmcp-stdio
VSCode Integration (No mcp-cli Required)
VSCode has built-in MCP support and connects directly to your server. You do NOT need to install mcp-cli for VSCode integration.
Add this to your VSCode MCP settings to use this server:
{
"mcpServers": {
"hjmcp-stdio": {
"command": "node",
"args": ["dist/server.js"],
"cwd": "/absolute/path/to/your/hjmcpstdio/directory",
"transport": "stdio"
}
}
}
Important Notes:
- Replace
/absolute/path/to/your/hjmcpstdio/directorywith the actual absolute path to this project directory - Make sure you've run
npm run buildfirst to compile the TypeScript - VSCode will handle all MCP communication automatically - no additional tools needed
Available npm Scripts
npm run build- Compile TypeScript to JavaScriptnpm run dev- Watch mode compilationnpm run start- Run the MCP server directlynpm run test-simple- Run basic client testnpm run clean- Remove build files
Server Capabilities
Resources
file://README.md- Project documentationfile://package.json- Package configurationfile://src/server.ts- Server source code
Tools
calculate- Perform mathematical calculations- Input:
{"expression": "mathematical expression"} - Example:
{"expression": "2 + 3 * 4"}
- Input:
list_files- List files in a directory- Input:
{"directory": "relative path"}(optional, defaults to ".") - Example:
{"directory": "src"}
- Input:
Prompts
code-review- Get code review suggestions- Arguments:
file_path(required),focus_areas(optional)
- Arguments:
explain-code- Get code explanations- Arguments:
code_snippet(required),language(optional)
- Arguments:
Project Structure
src/server.ts- Main MCP server implementationsrc/simple-client.ts- Basic test clientmcp_config.json- MCP CLI configuration for testingpackage.json- Project configuration and dependenciestsconfig.json- TypeScript configuration
Testing Summary
Quick Testing (No Additional Setup):
- Use
npm run test-simplefor basic functionality verification
Comprehensive Testing (Requires mcp-cli):
- Install mcp-cli globally:
npm install -g @modelcontextprotocol/cli - Use mcp-cli commands for detailed tool and resource testing
VSCode Integration (No mcp-cli Needed):
- Add server configuration to VSCode MCP settings
- VSCode handles MCP communication automatically
The server has been tested with:
- ✅ Tool functionality (calculate, list_files)
- ✅ Resource reading (package.json confirmed working)
- ✅ Stdio transport communication
- ✅ MCP protocol compliance
- ✅ Cross-platform compatibility (Windows, macOS, Linux)
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。