About Mock Server
Mock Server is an MCP server published by fengf233 in the Developer Tools category: a zero-dependency, configurable mock MCP server for testing MCP clients and harnesses. Serves a correct MCP handshake over stdio (initialize, tools/list, tools/call). You describe tools and canned responses in a JSON file. Simulates errors and missing-argument handling. Perfect target for your existing conformance, audit, and load-test tools.
The repository has 2 stars and 0 forks, with the last commit 11 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.
Install
git clone https://github.com/fengf233/mcp-mock-serverThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Mock Server
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
MCP 服务器
基于 Model Context Protocol (MCP) 的模拟服务器,用于开发和测试 MCP 客户端。
功能
- 工具调用:提供模拟工具,支持参数化模板
- 提示词管理:动态生成提示词内容
- 资源访问:提供模拟资源数据
- 多传输支持:支持 StreamableHTTP 和 SSE 传输
快速开始
安装依赖
go mod tidy
配置服务器
编辑 mock.yaml 文件配置服务器参数:
server:
host: "0.0.0.0"
port: 9999
transport: "StreamableHTTP" # 或 "sse"
运行服务器
# 编译
go build
# 运行
./mcp_server
服务器将在 http://localhost:9999/mcp 启动。
配置说明
工具配置
在 mock.yaml 中定义工具:
tools:
- name: "get_weather"
description: "Get current weather for a city"
parameters:
- name: "city"
type: string #只支持字符串
required: true
mock_template: "The current weather in {{city}} is sunny, 25°C."
提示词配置
prompts:
- name: "summarize_article"
description: "Summarize a given article"
arguments:
- name: "article"
required: true
mock_template: "Summarize: {{article}}"
资源配置
resources:
- name: "user_profile"
mime_type: "application/json"
uri: "internal://resources/user_profile.json"
mock_content: "{\"user_id\": \"{{user_id}}\"}"
项目结构
mcp_server/
├── main.go # 服务器主程序
├── config.go # 配置加载和解析
├── registry.go # 工具、提示词、资源注册
├── mock.yaml # 服务器配置文件
├── go.mod # 模块定义
└── go.sum # 依赖校验
依赖
github.com/mark3labs/mcp-go/server:MCP 服务器库github.com/mark3labs/mcp-go/mcp:MCP 协议定义gopkg.in/yaml.v3:YAML 配置文件解析
使用示例
- 启动服务器:
./mcp_server - 使用 MCP 客户端连接:
mcp_client -type http -url http://localhost:9999/mcp - 在客户端中调用工具、获取提示词、查看资源
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.