SecureOps MCP

SecureOps MCP

A secure, modular MCP server for file operations and code review using Gemini.

Category
Visit Server

README

SecureOps MCP: Modular File Operations & Code Review Server

SecureOps MCP is a secure, modular Model Context Protocol (MCP) implementation built using the FastMCP Python framework. The project exposes secure file manipulation tools, directory/file resources, and code-analysis prompt templates. It includes a decoupled client CLI orchestrating a Gemini 2.5 Flash agent capable of performing autonomous tool-use loops.


Key Features

  1. Autonomous Tools:
    • write_file: Dynamically creates parent folders and writes files using utf-8 encoding (with real-time progress logging).
    • delete_file: Safely deletes files from the project directory, with explicit type checking.
  2. Local Resources:
    • dir://.: Lists the entire workspace structure along with file metadata (size, last modified).
    • file:///{file_name}: Directly reads file contents via the standard URI scheme.
  3. Prompt Templates:
    • code_review: Automatically extracts and packages source code files into structured prompts for comprehensive quality reviews.
    • documentation_generator: Generates technical documentation prompts for target source files.
  4. Path Traversal Security:
    • Every file operation is validated through a secure path resolver that restricts reads, writes, and deletions to the base workspace directory.
  5. Decoupled Architecture:
    • Separates the technical stdio communication layer (MCPClient) from the LLM cognitive layer (GeminiAgent), enabling clean modular testing.

Installation & Setup

  1. Create and Activate Virtual Environment:
    python -m venv .venv
    .venv\Scripts\activate
    
  2. Install Dependencies:
    pip install -r requirements.txt
    
  3. Configure API Key: Create a file named .env in the root folder and add your Gemini API key:
    GEMINI_API_KEY=your_actual_gemini_api_key_here
    

1. Running via the Interactive CLI Client (With LLM Logic)

To converse with the model, perform code reviews, or generate documentation using the actual Gemini 2.5 Flash model, you must run the client CLI.

Run Command:

.venv\Scripts\python.exe -m mcp_client.main mcp_server/main.py

Menu Options & Example Testing Inputs:

Option 1: Generate Documentation

  • Selection: 1
  • Input (file_path): mcp_server/utils.py
  • Input (doc_name): utils_docs.md
  • What happens: The server packages utils.py into a template. Gemini generates a markdown documentation file and writes it to disk.
  • Progress Screenshot: File Writing Progress

Option 2: Review Code

  • Selection: 2
  • Input (file_path): mcp_server/utils.py
  • What happens: Gemini performs a deep code-review of the path security helper and lists findings directly in your terminal.
  • Code Review Output Screenshots: Code Review Part 1 Code Review Part 2

Option 3: Read File

  • Selection: 3
  • Input (file_path): requirements.txt
  • What happens: The client directly queries the server's resource handler to load and print the file.

Option 4: Read Current Directory

  • Selection: 4
  • What happens: Prints a formatted terminal table showing all directories and files in your workspace.

Option 5: Converse with Agent (Autonomous Tool Use)

  • Selection: 5
  • Input Query: Delete utils_docs.md please
  • What happens: Gemini reads your text, identifies that it needs to run a tool, calls delete_file on the MCP server, and prints the result.
  • Tool Execution Screenshot: Dynamic File Deletion

2. Running via the FastMCP Web Inspector (Interface Testing)

The MCP Inspector is a browser-based developer dashboard used to test and validate your server's exposed tools, resources, and prompts in isolation.

[!IMPORTANT] No LLM Responses in the Inspector: The web interface only tests that the MCP server's schemas are correct and compiles prompts successfully. To see the actual AI-generated responses, you must run it via the CLI client (Method 1).

Run Command:

.venv\Scripts\fastmcp dev mcp_server/main.py

This command starts the local dev server and prints a URL (e.g., http://localhost:5173).

Configuration in the Browser:

In the left pane, set up the connection parameters:

  1. Command: .venv\Scripts\fastmcp.exe (or your absolute path to the executable)
  2. Arguments: run mcp_server/main.py --no-banner
  3. Click the Connect button.

How to Test Features in the Web UI:

  • Tools Tab: Select write_file, enter a path (e.g., test.txt) and content, then click Run to execute the local file write.

  • Resources Tab: Click list_files_resource (dir://.) or read_file_resource to view raw JSON listings and text from the local folder.

  • Prompts Tab: Select code_review, enter a path (e.g., mcp_server/utils.py), and click Run to see the fully compiled prompt template including your source code.

  • Interface Screenshot: MCP Inspector Interface

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured