Overview
What is Python MCP Server Project?
This project implements a Model Context Protocol (MCP) server using Python. It exposes local capabilities like file system access and command execution to MCP clients such as AI agents or language models, and is fully containerized with Docker.
How to use Python MCP Server Project?
Build the Docker image with docker build -t mcp-server ., then run the container with docker run -d ... providing environment variables and volume mounts. Use the /health endpoint or the provided Python test client to verify the server.
Key features of Python MCP Server Project
- File system directory creation and listing.
- File writing and reading.
- Shell command execution inside the container.
- Fully containerized with Docker for easy deployment.
- Configurable via environment variables (port, base directory, shell commands toggle).
Use cases of Python MCP Server Project
- Allowing AI agents to create, read, and write files on a host machine.
- Enabling language models to execute shell commands within a controlled container.
- Providing structured file system access for MCP-based tools and workflows.
FAQ from Python MCP Server Project
What tools does the server expose?
It exposes five tools: file_system_create_directory, file_system_write_file, file_system_read_file, file_system_list_directory, and execute_shell_command.
How do I enable or disable shell command execution?
Set the environment variable ALLOW_ARBITRARY_SHELL_COMMANDS to "true" (enabled) or "false" (disabled) when running the Docker container.
What are the runtime requirements?
The server requires Docker Desktop with WSL2 integration (on Windows) or Docker on Linux. The client-side test script needs Python 3.12+ with venv.
How does data persistence work?
File system tools operate on a base working directory inside the container. You can mount a host directory into that path using a Docker volume mount to persist data on the host.
How is the server served?
The server uses Uvicorn as the ASGI server and Starlette as the ASGI framework, with the MCP server built using FastMCP from the mcp Python SDK.