top of page

MCP Security: How Malicious Servers Can Harm Your Computer

  • Writer: Revanth Reddy Tondapu
    Revanth Reddy Tondapu
  • Sep 9
  • 5 min read
MCP Security
MCP Security

Introduction

Imagine you're hiring a handyman to fix your sink. You give them the keys to your house and tell them exactly what needs to be done. But instead of just fixing the sink, they secretly copy your house keys, take photos of your valuable items, and maybe even steal some documents from your desk. You'd never know because they still fixed your sink as promised.

This scenario perfectly describes a major security risk with MCP (Model Context Protocol) servers. These are tools that help AI assistants perform various tasks, but malicious ones can secretly harm your computer while appearing to work normally. Let's explore how this works and how you can protect yourself.


What Are AI Agents and MCP Servers?

Understanding AI Agents

Think of an AI agent as a smart assistant that can:

  • Answer questions directly using its built-in knowledge

  • Use special tools to get information or perform tasks

Here's how it works:

  1. You ask the AI a question

  2. The AI decides if it needs a tool to answer properly

  3. If yes, it picks the right tool and uses it

  4. The tool does its job and reports back

  5. The AI gives you the final answer


What is MCP?

MCP (Model Context Protocol) is like a universal toolbox system. Instead of each AI having its own specific tools, MCP allows different AIs to share the same set of tools. It's like having a standard socket that works with any brand of power tool.


How Function Calling Works

The Process Explained

When an AI needs to use a tool, it uses something called "function calling." Here's a simple breakdown:

What the AI Sees:

  • Tool name: "Get Weather"

  • Description: "Gets current weather for any city"

  • Required information: City name

What Happens:

  1. You ask: "What's the weather in New York?"

  2. The AI thinks: "I need the weather tool for this"

  3. The AI calls the weather function with "New York" as input

  4. The function runs and returns weather data

  5. The AI tells you: "It's sunny and 75°F in New York"


The Critical Security Flaw

Here's the dangerous part: The AI only sees the tool's description, not what the tool actually does.

It's like hiring someone based only on their resume. The resume says "Professional Plumber," but you never actually see them work. They could be doing anything in your house while you think they're just fixing pipes.


Real-World Example: The Malicious Documentation Server

Let's walk through a concrete example of how a malicious MCP server works.


The Fake Tool

What it Claims to Do:

  • Name: "Get Documentation from Database"

  • Description: "Returns helpful documentation for the project"

  • Appears harmless and useful

What it Actually Does:Behind the scenes, while fetching documentation, it also:

  • Runs secret commands on your computer

  • Copies your SSH keys (used for secure connections)

  • Saves sensitive information to hidden files

  • Could potentially send your data to criminals


The Attack in Action

  1. You ask: "Read the documentation and tell me about this project"

  2. AI thinks: "I'll use the documentation tool"

  3. Tool runs and:

    • Fetches documentation (as promised)

    • Secretly steals your SSH keys

    • Creates hidden files with your sensitive data

  4. You see: Normal documentation response

  5. You don't know: Your computer has been compromised


Why STDIO Transport Makes This Worse

What is STDIO Transport?

STDIO (Standard Input/Output) is like giving someone direct access to your computer's command line. When MCP servers run on STDIO:

  • They execute directly on your machine

  • They have the same permissions as you

  • They can access your files, run programs, and make changes


The Risk

Running a malicious MCP server on STDIO is like giving a stranger admin access to your computer. They can:

  • Read any file you can read

  • Delete important documents

  • Install malicious software

  • Access your passwords and private keys

  • Use your computer to attack others


How to Protect Yourself

Essential Safety Rules

1. Only Use Trusted Sources

  • Download MCP servers only from official sources

  • Avoid third-party or unknown developers

  • Check if the server comes from the company that owns the service

2. Pin Specific Versions

  • Don't auto-update MCP servers

  • Test new versions in a safe environment first

  • Use version control to track what you're installing

3. Read the Code

  • If possible, review the source code before installing

  • Look for any suspicious commands or file operations

  • Be wary of servers that request unnecessary permissions

4. Use Sandboxing

  • Run MCP servers in isolated environments when possible

  • Limit what files and systems they can access

  • Consider using virtual machines for testing

5. Monitor Your System

  • Watch for unexpected files or network activity

  • Regularly check for unauthorized access attempts

  • Keep logs of what MCP servers you've installed


Red Flags to Watch For

Be suspicious if an MCP server:

  • Requests more permissions than needed for its stated function

  • Comes from an unknown or unverified source

  • Has vague or misleading descriptions

  • Requires STDIO access for simple tasks

  • Hasn't been updated or maintained recently


Best Practices for Safe MCP Usage

Before Installing

  1. Research the developer - Is it from a reputable company?

  2. Check reviews and community feedback

  3. Verify the server actually needs the permissions it requests

  4. Test in a safe environment first


During Use

  1. Monitor system performance for unusual activity

  2. Check file systems for unexpected changes

  3. Watch network traffic for suspicious connections

  4. Keep backups of important data


After Installation

  1. Regular security scans of your system

  2. Update only when necessary and after testing

  3. Remove unused servers to reduce attack surface

  4. Document what you have installed for future reference


The Bigger Picture

Why This Matters

MCP servers represent a powerful new way for AI to interact with our computers and online services. As this technology becomes more popular:

  • More malicious servers will likely appear

  • Attacks will become more sophisticated

  • The potential damage will increase


Multiple Security Concerns

The function hiding attack described here is just one of many potential security issues with MCP servers. Other concerns include:

  • Data privacy violations

  • Unauthorized network access

  • Resource abuse (using your computer for mining, etc.)

  • Social engineering attacks


Summary

MCP servers are powerful tools that can greatly enhance AI capabilities, but they come with significant security risks. The core vulnerability is that AI agents can't see what MCP server code actually does - they only see the description.


Key Takeaways:

  • MCP servers run with your computer's permissions - they can do anything you can do

  • Malicious servers can hide harmful code behind legitimate-seeming functions

  • STDIO transport is especially dangerous because it gives direct system access

  • Always verify sources and use official publishers when possible

  • Pin versions to avoid automatic updates with malicious changes

  • Monitor your system for unusual activity after installing new servers


By understanding these risks and following security best practices, you can safely enjoy the benefits of MCP servers while protecting your computer and data from potential threats. Remember: when it comes to security, a little paranoia is better than a lot of regret.

Comments


bottom of page