VS Code MCP服务器模板

一个用于VS Code的MCP服务器模板,支持外部侦察功能,适用于安全测试和自动化任务。

  • by timsonner
  • Python
  • 本地部署
  • 9 星标
  • 更新于
在 GitHub 查看 timsonner/mcp-vscode-template

使用说明

mcp vscode模板

VS代码代理的MCP服务器模板

设置

按你喜欢的方式安装uv。可能有选择。
https://docs.astral.sh/uv/getting-started/installation/

项目设置在很大程度上基于Renae Schilg的工作。我甚至懒得更改项目名称以示敬意,尽管我确实在一些事情上有所偏离,即不使用Claude Desktop,但也进行了修改 external-recon.py 相当重。
https://nae-bo.medium.com/building-your-first-offensive-security-mcp-server-dd655e258d5f

# Initialize project
uv init external-recon
cd external-recon

我不得不修改python版本 .python-version 向 3.11 或3.8或3.10以上
我还不得不修改这条线 requires-python = ">=3.11" 在……里面 pyroject.toml 高于3.8或3.10 里程会有所不同。..可能没有必要。

# Create virtual environment and activate it
uv venv --python 3.11
source .venv/bin/activate

# Install mcp
uv add "mcp[cli]"

# Install dnspython (dependency for external-recon.py, not necessary for all projects, but for this one yes)
uv pip install dnspython

# Create MCP server external-recon.py file or empty and rename main.py
touch external-recon.py

VS代码 settings.json 应该修改。
使用 which uv 找到紫外线的传播途径。
这 "/path/to/project/external-recon" 应该参考MCP服务器.py文件所在的项目路径(使用absoulte路径)。

settings.json

    "mcp": {
        "servers": {
                "external-recon": {
                 "command": "/path/to/uv",
                 "args": [
                  "--directory",
                  "/path/to/project/external-recon",
                  "run",
                  "external-recon.py"
                 ]
                }
        }
    },

Renae的作品和我的作品的主要区别之一是我使用了 @mcp.tool() 而不是 @mcp.prompt() 在……里面 external-recon.py

启动服务器

从项目的venv开始,使用以下命令启动服务器 uv run external-recon.py
例子:

(external-recon) user@workstation external-recon % uv run external-recon.py