After covering MCP architecture, gateways, and how MCPs work under the hood, let's tackle something practical: how do you actually run MCP servers? If you've seen configurations with npx, uvx, or Docker commands and wondered what's going on, this post is for you.
The Executable Landscape
When you configure an MCP server, you're essentially telling your client (Claude, Cursor, VS Code) how to spawn a process that speaks the MCP protocol. But not all servers are created equal - they come in different flavors based on their underlying technology.
json
// What do these commands actually mean?
{
"mcpServers": {
"memory": {
"command": "npx", // JavaScript/Node.js server
"args": ["-y", "@modelcontextprotocol/server-memory"]
},
"sqlite": {
"command": "uvx", // Python server
"args": ["mcp-server-sqlite", "--db-path", "test.db"]
},
"docker-example": {
"command": "docker", // Containerized server
"args": ["run", "-i", "mcp-server:latest"]
}
}
}
Understanding the Executables
npx - The Node.js Runner
npx is used for TypeScript/JavaScript-based MCP servers. It's Node Package Execute - a tool that downloads and runs Node.js packages without installing them globally.
How it works:
- Downloads the package from npm registry (if not cached)
- Executes it in a temporary environment
- The -y flag auto-confirms any prompts
Example:
bashnpx -y @modelcontextprotocol/server-filesystem
# Downloads and runs the filesystem MCP server
Pros:
- Zero installation required
- Always runs the latest version
- Simple configuration
Cons:
- Security risk: runs with full system access
- Requires Node.js installed
- Downloads code on every fresh run
uvx - The Python Equivalent
uvx is the Python equivalent, used for Python-based MCP servers. It's part of the uv package manager - Rust-powered and blazingly fast.
How it works:
- Creates isolated Python environments automatically
- Downloads from PyPI (Python Package Index)
- Manages dependencies in virtual environments
Example:
bashuvx mcp-server-fetch
# Runs the Python-based fetch server
Pros:
- Faster dependency resolution than pip
- Automatic virtual environment management
- No Python version conflicts
Cons:
- Requires uv installation first
- Same security concerns as npx - full host access
- Less familiar to Python developers than pip
uv - Direct Python Execution
For development, you might see uv without the x:
json{
"command": "uv",
"args": ["--directory", "/path/to/project", "run", "mcp-server"]
}
This runs Python code directly from a project directory - useful during development.
Docker - The Secure Option
Docker containers provide isolation and security that npx/uvx lack.
How it works:
- Runs servers in isolated containers
- Can limit resources and network access
- Provides consistent environment across systems
Example:
json{
"command": "docker",
"args": [
"run",
"-i", // Interactive mode for stdio
"--rm", // Remove container after exit
"mcp-server:latest"
]
}
Pros:
- Sandboxed execution - much more secure
- Platform independent
- Resource limits possible
Cons:
- Requires Docker installation
- Slightly more complex configuration
- Container startup overhead
Direct Executables
Some MCP servers compile to native binaries:
json{
"command": "/usr/local/bin/mcp-custom-server",
"args": ["--config", "server.json"]
}
These are typically Go, Rust, or C++ servers compiled for specific platforms.
Local vs Remote: Where Does Execution Happen?
Local Servers (stdio transport)
Most MCP servers run locally on your machine using stdio (standard input/output):
json{
"command": "npx", // Spawns local process
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
Characteristics:
- Client spawns the server process directly
- Communication via stdin/stdout
- Server has access to your local filesystem
- No network configuration needed
Remote Servers (SSE/HTTP transport)
Some servers run remotely and communicate over the network:
json{
"transport": "sse",
"url": "https://mcp.example.com/sse"
}
Characteristics:
- Server runs on separate machine/cloud
- Communication via HTTP/SSE
- Authentication typically required
- Can scale independently
Hybrid: Local Containers
Docker bridges the gap - runs locally but with isolation:
json{
"command": "docker",
"args": ["run", "-p", "8080:8080", "mcp-server"],
"transport": "http",
"url": "http://localhost:8080"
}
Security Implications: The Elephant in the Room
Using npx or uvx means telling your system to download and execute whatever code is registered with that package name, with full root access to your machine.
The Risk Matrix
Best Practices
- For Development: Use npx/uvx for convenience, but understand the risks
- For Production: Use Docker containers or verified solutions
- For Enterprise: Never use npx/uvx - containerize everything
- For Sensitive Data: Run in isolated VMs or cloud environments
Platform-Specific Gotchas
Windows Issues
On Windows, npx commands often need special handling:
json// Broken on Windows:
{
"command": "npx",
"args": ["-y", "package"]
}
// Fixed:
{
"command": "cmd",
"args": ["/c", "npx", "-y", "package"]
}
macOS/Linux
Generally work out of the box, but watch for:
- Permission issues with Docker
- Path resolution differences
- Shell interpretation variations
The Future: Beyond Current Executables
The MCP ecosystem is evolving rapidly. Docker is establishing containers as the standard for MCP server distribution, with initiatives like:
- MCP Gateway: Remote server orchestration
- Verified Marketplaces: Curated, security-audited servers
- WebAssembly: Platform-independent, sandboxed execution
Practical Decision Framework
Choose npx when:
- Prototyping or learning
- Using official Anthropic servers
- Local development only
Choose uvx when:
- Working with Python-based tools
- Need faster package management
- Want virtual environment isolation
Choose Docker when:
- Security is a concern
- Need reproducible environments
- Deploying to production
- Working with sensitive data
Choose direct binaries when:
- Maximum performance needed
- Custom enterprise servers
- Embedded systems
Conclusion
Understanding MCP server executables isn't just about configuration syntax - it's about making informed decisions about security, performance, and deployment. While npx and uvx offer convenience for development, the future of production MCP deployments clearly points toward containerization and managed platforms.
As the ecosystem matures, expect to see more emphasis on secure, verified execution environments. The wild west days of "just run npx" are numbered - and that's a good thing for everyone building serious AI applications.
Next in the series: We'll dive into MCP authentication patterns and how to secure your server connections. Stay tuned!
What execution method are you using for your MCP servers? Have you moved to containers yet, or still living dangerously with npx? Let's discuss in the comments!
Top comments (0)