MCP ExplorerExplorer

Mcp Vscode Template

@timsonneron 9 months ago
7 MIT
FreeCommunity
AI Systems
MCP server template for VS Code

Overview

What is Mcp Vscode Template

mcp-vscode-template is a template for creating MCP servers specifically designed for use with Visual Studio Code. It provides a structured setup to streamline the development of MCP servers.

Use cases

Use cases include setting up a custom MCP server for security testing, developing tools for external reconnaissance, and integrating with other security frameworks within Visual Studio Code.

How to use

To use mcp-vscode-template, install the necessary tools as outlined in the setup instructions. Initialize the project using ‘uv init external-recon’, create a virtual environment, and install required dependencies. Modify the VS Code ‘settings.json’ to configure the server command and arguments.

Key features

Key features include easy project initialization, support for Python 3.11 and above, integration with VS Code, and the ability to customize server behavior using decorators like ‘@mcp.tool()’.

Where to use

mcp-vscode-template is primarily used in the field of offensive security, particularly for developing and running MCP servers that assist in security assessments and penetration testing.

Content

mcp-vscode-template

MCP server template for VS Code Agent

Setup

Install uv however you like. May options available.
https://docs.astral.sh/uv/getting-started/installation/

Project setup is heavily based off of Renae Schilg’s work. I didn’t even bother to change the project name as an homage although I did deviate on a few things, namely not using Claude Desktop, but also modified external-recon.py fairly heavily.
https://nae-bo.medium.com/building-your-first-offensive-security-mcp-server-dd655e258d5f

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

I had to modify the python versions in .python-version to 3.11 or something above 3.8 or 3.10
I also had to modify the line requires-python = ">=3.11" in pyroject.toml to something above 3.8 or 3.10
Mileage will vary… It may not be necessary.

# 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

The VS Code settings.json should be modified.
Use which uv to find the path to uv.
The "/path/to/project/external-recon" should refer to the project path, where the MCP server .py file is located (use absoulte path).

settings.json

One of the main differences between Renae’s work and mine is I used @mcp.tool() instead of @mcp.prompt() in external-recon.py

Start the server

From the venv of the project, start the server with uv run external-recon.py
Example:

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

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers