模型上下文协议服务器

一个npm包,提供MCP(模型上下文协议)服务器,使AI助手如GitHub Copilot和Claude能够访问工作区工具。

  • by kdemarest
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 kdemarest/jeesty-mcp

使用说明

Jeesty MCP

用于AI助手的MCP服务器

一个提供MCP(模型上下文协议)服务器的npm包,让GitHub Copilot和Claude等AI助手可以访问工作空间工具。

快速开始

npx jeesty-mcp init

这将创建:

  • .jeestymcp/config.json --工具、提示和资源定义
  • .jeestymcp/instructions.md --项目的AI指令模板
  • 将jeesty mcp添加到您的VS代码mcp配置中

重新加载VS代码以开始使用MCP服务器。

配置位置

这 init 命令可以将jeesty mcp添加到两个不同的位置:

# User-level config (default) - applies to ALL your projects
npx jeesty-mcp init

# Workspace-level config - only for this project
npx jeesty-mcp init --workspace
配置级别 位置 范围
用户 ~/.vscode/mcp.json 所有VS代码工作区
工作区 .vscode/mcp.json 只是这个项目

优先:工作区配置始终覆盖用户配置。如果你想让一个项目使用不同的MCP服务器设置(例如,用于开发),这很有用。

项目配置

你的项目 .jeestymcp/ 文件夹包含:

文件 目的
config.json 定义自定义工具、提示和资源
instructions.md AI指令模板(使用胡子变量)

config.json示例

{
    "tools": {
        "deploy": {
            "usage": "Deploy the application to production",
            "cmd": "npm run deploy",
            "params": {
                "environment": {
                    "type": "string",
                    "description": "Target environment (staging/production)",
                    "required": true
                }
            }
        },
        "webget": {
            "usage": "Fetch content from a URL",
            "module": "scripts/webget.js",
            "params": {
                "url": { "type": "string", "description": "The URL to fetch", "required": true }
            }
        }
    },
    "prompts": {
        "explain-code": {
            "description": "Explain code in plain English",
            "template": "Please explain the following code:\n\n{{code}}"
        }
    },
    "resources": {
        "myapp://status": {
            "description": "Get app status",
            "url": "http://localhost:3000/status",
            "mimeType": "application/json"
        }
    }
}

内置工具

工具 说明
pingJeestyMCP 验证MCP服务器是否正在运行

自定义工具

工具可以在两种模式下执行:

命令模式(cmd):生成一个shell并运行命令

{
    "usage": "Run tests",
    "cmd": "npm test",
    "params": { ... }
}

模块模式(module):导入一个JS/TS模块并调用其 run() 函数

{
    "usage": "Fetch a URL",
    "module": "scripts/webget.js",
    "params": { ... }
}

模块模式更快(没有shell开销),可以返回结构化数据。该模块必须导出:

export async function run(params: Record<string, unknown>): Promise<string | object>

刀具参数

参数支持以下选项:

  • type: "string", "number", "boolean"
  • description:向AI显示帮助文本
  • required:参数是否为必填项
  • addToCmdWithoutKey:如果为true,则值作为位置arg传递,而不是 --key=value

CLI命令

npx jeesty-mcp init              # Add to user MCP config + create .jeestymcp/
npx jeesty-mcp init --workspace  # Add to workspace .vscode/mcp.json instead
npx jeesty-mcp remove            # Remove from user MCP config
npx jeesty-mcp --help            # Show help

运作原理

  1. VS Code启动jeesty mcp服务器(通过mcp配置)
  2. 服务器从您的工作区向上搜索 .jeestymcp/config.json
  3. AI助手可以调用提供的工具与您的工作空间进行交互
  4. 自定义工具执行shell命令或进程内模块并返回输出

发展

如果你正在开发jeesty mcp本身:

使用Nodemon自动重启

配置您的 工作区 .vscode/mcp.json 要使用具有自动重启功能的本地构建,请执行以下操作:

{
    "servers": {
        "jeesty-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": ["nodemon", "--watch", "out", "--ext", "js", "--exec", "node", "${workspaceFolder}/out/mcp-server/index.js"],
            "env": {
                "JEESTY_WORKSPACE_PATH": "${workspaceFolder}"
            }
        }
    }
}

此工作区配置覆盖了用户级配置,因此您的开发环境使用本地构建,而其他项目使用已发布的npm包。

开发配置文件

repo使用遗留配置文件名进行开发(未发布到npm):

  • jm-config.json --dev配置
  • jm-instructions.md --开发指令模板

MCP服务器在以下情况下检查这些作为回退 .jeestymcp/config.json.

许可证

麻省理工学院