mcp-for-programmer
Click on "Install 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., "@mcp-for-programmerexplain this code snippet and suggest improvements"
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.
# MCP-Server for Programmers
简体中文 | English
一个为程序员学习助力的Model Context Protocol服务器。
安装
使用NPM包(推荐)
# 使用npm安装
npm install mcp-for-programmer
# 或使用yarn
yarn add mcp-for-programmer
# 或使用pnpm
pnpm add mcp-for-programmer开发者安装
# 克隆仓库
git clone https://github.com/zaizaizhao/mcp-for-programmer.git
cd mcp-for-programmer
# 安装依赖
pnpm install
# 构建项目
pnpm buildRelated MCP server: MCP Codebase Insight
打包与构建
本项目使用Rollup进行库的打包,支持以下功能:
生成CommonJS和ES模块两种格式
自动生成TypeScript类型声明文件
支持监视模式进行开发
生产环境构建优化
开发模式
运行以下命令启动开发模式,将自动监视文件变更并实时构建:
npm run dev生产构建
运行以下命令进行生产环境构建:
npm run build生成的文件将输出到各个包的dist目录中。
项目简介
MCP-Server for Programmers 是一个基于 Model Context Protocol (MCP) 的服务器实现,专为帮助程序员理解和学习代码而设计。它能够通过提示词模板解析代码,提供代码解释、技术栈分析和最佳实践建议,帮助新手程序员更快地理解复杂代码。
文档
📚 DeepWiki 详细文档 - 由 Devin 自动生成的项目详细文档
📘 提示词规范文档 - MCP提示词规范与使用指南
📦 NPM包 - NPM包页面
特性
🚀 基于 MCP 协议,支持多种传输方式(stdio、SSE、streamable、HTTP Stream)
📝 支持通过 YAML 文件定义提示词模板
🔧 自动将提示词转换为工具,无需手动映射
🧩 模板变量替换功能,支持条件渲染
🌐 内置 Express 服务器,提供 REST API
🔍 支持与 MCP Inspector 集成,方便调试
📋 标准化的提示词规范,确保一致性和可维护性
已完成功能
✅ MCP 服务器基础架构搭建
✅ 多种传输方式支持(stdio、SSE、streamable)
✅ YAML 提示词模板加载和解析
✅ 提示词自动转换为工具功能
✅ 模板变量替换和条件渲染
✅ Express REST API 服务
✅ 代码解释器提示词实现
✅ Rollup构建系统用于库打包
✅ HTTP Stream方式调用MCP服务器
✅ 提示词规范文档与示例
待完成功能
📋 用户界面优化与交互改进
📋 更多专业领域提示词模板
📋 代码分析与建议功能增强
📋 多语言支持扩展
📋 性能优化与缓存机制
📋 用户配置文件和个性化设置
📋 插件系统支持
使用方法
启动服务器
# 使用标准输入输出(stdio)启动
pnpm run dev
# 或直接使用npx
npx mcp-for-programmer
# 使用 SSE 传输启动
pnpm run dev:sse
# 或直接使用npx
npx mcp-for-programmer --transport sse --port 3322 --endpoint /sse
# 使用 Streamable 传输启动
pnpm run dev:streamable
# 使用 HTTP Stream 方式启动
pnpm run dev:stream
# 在指定端口启动 Express 服务器
pnpm run dev:express
# 使用 Inspector 启动(调试模式)
pnpm run dev:inspector
# 或直接使用npx
npx @modelcontextprotocol/inspector mcp-for-programmer创建提示词模板
在 prompts 目录下创建 YAML 文件,例如 code-explainer.yaml:
name: code-explainer
description: 解释代码的功能和实现细节
arguments:
- name: code
description: 需要解释的代码片段
required: true
schema:
type: string
- name: language
description: 代码的编程语言
required: false
schema:
type: string
- name: context
description: 代码的上下文或背景信息
required: false
schema:
type: string
messages:
- role: system
content:
type: text
text: "你是一位专业的代码解释器,请解释以下{{language}}代码:\n\n```{{language}}\n{{code}}\n```\n{{#if context}}代码上下文:{{context}}{{/if}}"
- role: user
content:
type: text
text: "请详细解释这段代码的功能、实现原理和可能的优化点。"API 接口
GET /api/models- 获取可用模型列表POST /api/query- 向模型发送查询GET /api/prompts- 获取所有可用的提示词模板GET /api/prompts/:filename- 获取特定提示词模板的内容
项目结构
mcp-for-programmer/
├── packages/
│ └── mcp-for-programmer/
│ ├── src/
│ │ ├── backend/ # Express 服务器相关代码
│ │ ├── routes/ # API 路由定义
│ │ ├── tools/ # MCP 工具和提示词处理
│ │ ├── transportUtils/ # 传输方式实现
│ │ ├── index.ts # 入口文件
│ │ └── server.ts # MCP 服务器创建
│ ├── dist/ # 构建输出(不被Git跟踪)
│ ├── prompts/ # 提示词模板 YAML 文件
│ └── package.json
├── scripts/
│ ├── dev.js # 开发构建脚本,带监视模式
│ └── build.js # 生产环境构建脚本
├── prompt-schema.yaml # 提示词规范说明文档
├── prompt-example.yaml # 提示词示例文件
└── package.jsonMCP 提示词规范与使用指南
本文档提供了MCP (Model Context Protocol) 服务器的提示词(Prompt)规范和使用指南。
文件结构
prompt-schema.yaml: 提示词规范说明文档,详细定义了提示词文件的结构和字段要求prompt-example.yaml: 提示词示例文件,展示了如何创建符合规范的提示词
提示词文件规范
每个提示词文件应遵循以下基本结构:
name: 提示词名称
description: 提示词描述
arguments: # 可选
- name: 参数名称
description: 参数描述
required: true/false
schema:
type: 参数类型
messages:
- role: 角色(system/user/assistant)
content:
type: 内容类型(text/image)
text: 文本内容详细规范请参考 prompt-schema.yaml 文件。
如何创建新的提示词
在
prompts目录下创建一个新的.yaml文件文件名应与提示词名称保持一致
按照规范定义提示词的结构和内容
参考
prompt-example.yaml作为创建提示词的模板
如何使用提示词
提示词文件创建完成后,系统会自动加载并注册为工具。您可以通过以下方式使用这些提示词:
在代码中引用提示词名称
传递必要的参数
调用相应的API
示例代码:
// 引入必要的模块
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp";
import { createToolsForAllPrompts } from "./tools/promptTools";
// 初始化MCP服务器
const server = new McpServer();
// 注册所有提示词工具
await createToolsForAllPrompts(server);
// 使用提示词工具
const result = await server.invoke("gen_prd_prototype_html", {
productConcept: "一个智能家居控制应用"
});
console.log(result);提示词模板变量
提示词模板支持使用变量和条件语句,使用双花括号 {{}} 语法:
messages:
- role: user
content:
text: |
产品概念:{{productConcept}}
{% if targetUsers %}
目标用户:{{targetUsers}}
{% endif %}提示词类型与用途
根据不同场景和需求,您可以创建多种类型的提示词:
代码解释器提示词 - 用于解释代码功能和实现细节
产品需求文档生成器 - 用于生成产品需求文档和原型设计
技术栈分析提示词 - 分析项目使用的技术栈和架构
最佳实践建议提示词 - 提供代码优化和最佳实践建议
最佳实践
提示词名称应简洁明了,反映其功能
描述应详细说明提示词的用途、输入和预期输出
参数应明确定义类型和是否必填
消息内容应结构清晰,便于理解和维护
定期审查和更新提示词,确保其有效性和安全性
为复杂提示词添加详细注释,解释其工作原理
测试提示词在不同输入条件下的表现
注意事项
确保YAML格式正确,避免语法错误
避免在提示词中包含敏感信息或私有数据
测试提示词在不同场景下的表现,确保其稳定性和可靠性
提示词应遵循一致的命名规范,便于管理和使用
定期更新提示词以适应新的需求和场景
技术栈
TypeScript
Node.js
Express.js
Model Context Protocol (MCP)
Rollup (构建系统)
YAML
Zod (类型验证)
贡献
欢迎贡献代码、报告问题或提出新功能建议。请先创建 Issue 讨论您的想法,然后再提交 Pull Request。
许可证
本项目采用 ISC 许可证。详情请参阅 LICENSE 文件。
Star 历史
Available Tools
3 toolscode-explainerC
帮助新手程序员理解代码,分析技术栈和最佳实践
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description lacks any behavioral context such as whether the tool reads or modifies code, requires authentication, or has side effects. With no annotations, this omission is critical for safe usage.
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 concise sentence, but it omits essential details such as input method, output format, and usage examples. While brief, it is not adequately informative.
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?
Given no parameters, no output schema, and minimal description, the tool definition is severely incomplete for an agent to use correctly. The description does not specify what the tool does exactly (e.g., returns a report, updates code, etc.) or how to invoke it.
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?
Despite having zero parameters, the description does not explain how the agent should provide code for exploration. The input schema is empty, implying input may come from context, but this is not clarified, leaving ambiguity in invocation.
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 clearly states the tool helps novice programmers understand code and analyze tech stack and best practices. It is specific on the target audience and function, but does not differentiate from sibling tools like gen_prd_prototype_html or typescript-challenge-analyzer, leaving some ambiguity about when to use this one.
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?
No guidance is provided on when to use this tool versus alternatives. There is no mention of prerequisites, context, or conditions that would help an agent decide whether to invoke code-explainer over other tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
gen_prd_prototype_htmlA
基于用户提供的产品概念,自动生成结构完整的产品需求文档(PRD)和高保真交互原型,二者深度融合于一个单页HTML中,适合产品团队评审、路演和开发落地。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description must fully disclose behavior. It mentions 'based on user-provided product concept' but the tool has no input parameters, leaving ambiguity about how the concept is supplied. It does not state whether the operation is read-only or destructive, nor any prerequisites.
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 that is well-structured and front-loaded with the main purpose. It conveys all key information without unnecessary words, though it could be slightly more concise.
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?
Given the complexity of generating a PRD and prototype, the description is fairly complete: it specifies the output format, input source, and target audience. It lacks details on how the HTML is returned, but no output schema exists to compensate.
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 tool has no parameters, so the schema coverage is 100%. Baseline for zero parameters is 4. The description adds context about the input concept but does not need to explain parameter semantics further.
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 clearly states the tool generates a complete PRD and high-fidelity interactive prototype integrated into a single HTML file based on user-provided product concepts. It specifies the output format and use cases, and it is clearly differentiated from sibling tools like code-explainer and typescript-challenge-analyzer.
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 mentions the tool is suitable for product team review, roadshows, and development, providing context on when to use it. However, it does not explicitly state when not to use it or name alternatives, though siblings are distinct.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
typescript-challenge-analyzerC
我正在刷typescript-challenge,根据我提供的ts代码段,分析这段TypeScript代码中使用的高级类型技术,提供最佳实践和使用场景示例,适合正在学习TypeScript类型系统的开发者
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided. The description mentions analyzing a 'provided ts code snippet', but the input schema has zero parameters, creating a contradiction about how input is received. No behavioral details beyond the purpose.
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, which is concise but not well-structured. It front-loads the purpose but lacks clarity about input and output. Every sentence is present but not all information is earned due to the schema contradiction.
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?
Given the complexity of analyzing TypeScript code, the description is incomplete. It does not mention output format, return values (no output schema), or how the code snippet is provided. The tool's behavior is under-specified, especially with no annotations.
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 input schema has no parameters, but the description implies a code snippet input. This contradiction misleads the agent about how to invoke the tool. The description fails to add meaningful parameter information; it adds confusion instead.
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 the tool analyzes TypeScript code for advanced type techniques, providing best practices and examples. However, it does not differentiate from sibling 'code-explainer', which may have overlapping functionality. The purpose is clear but lacks distinction.
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 usage for developers learning TypeScript type system, but provides no explicit guidance on when to use this tool versus siblings (code-explainer, gen_prd_prototype_html) or when not to use it. No context or prerequisites are mentioned.
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. Dates show when Glama detected each change.
3 tool updates
v1.0.0- First observed
code-explainer - First observed
gen_prd_prototype_html - First observed
typescript-challenge-analyzer
TDQS
Scored across 3 tools
Each tool targets a clearly different task: code explanation, PRD/prototype generation, and TypeScript challenge analysis. There is no overlap or ambiguity between them.
Naming conventions are mixed: 'code-explainer' and 'typescript-challenge-analyzer' use hyphens, while 'gen_prd_prototype_html' uses underscores and an abbreviation, breaking consistency.
With only 3 tools, the server feels minimal. The name 'mcp-for-programmer' suggests broader functionality, but the small set may be acceptable for a niche specialization.
The tools cover only three specific scenarios with no common programmer tasks (e.g., search, lint, refactor). The surface is incomplete for the implied domain.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enhances AI-generated code quality through comprehensive analysis across 10 critical dimensions, helping identify issues before they become problems.190Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA server component of the Model Context Protocol that provides intelligent analysis of codebases using vector search and machine learning to understand code patterns, architectural decisions, and documentation.12MIT
- AlicenseDqualityDmaintenanceA server based on Model Context Protocol that provides predefined prompt templates for tasks like code review and API documentation generation, enabling more efficient workflows in Cursor/Windsurf editors.1013247MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that helps large language models process code repositories by providing file tree generation, code merging, and code analysis capabilities.321MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zaizaizhao/mcp-for-programmer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server