home / mcp / akshayarav mcp server
My implementation of an MCP server using Python. This is just a way for me to learn about the technology and how it works.
Configuration
View docs{
"mcpServers": {
"akshayarav-mcp": {
"command": "python3",
"args": [
"src/mcp_server.py"
],
"env": {
"PYTHONPATH": "{project_path}/src"
}
}
}
}You run a lightweight MCP server locally to connect an AI model to a set of simple tools. This server speaks the MCP protocol over stdio, letting you send JSON-RPC style requests and receive responses from a Python process. Itβs designed to be easy to extend and to serve as a learning model for MCP internals while remaining practical for experimenting with tools like reading and writing files or listing directories.
You will start the MCP server locally from your project and connect to it from an MCP client. Use the local stdio configuration to launch the Python process that runs the MCP server and supplies the available tools to the client. Once running, the client can request greetings, read and write files, list directories, and perform basic directory operations through the server.
Prerequisites you need on your machine before starting are Python 3 and a working shell. You will also create and activate a virtual environment to isolate dependencies.
# Create virtual environment
python3 -m venv mcp-venv# Activate virtual environment
source mcp-venv/bin/activate # On macOS/Linux
# or
mcp-venv\Scripts\activate # On Windows# Install required packages
pip install -r requirements.txt# Test server starts correctly
python3 src/mcp_server.pyConfiguration for integrating with a client app can include environment variables. For example, when launching the server from a desktop configuration, you might set PYTHONPATH to point at your source directory so the server can find its modules.
This example shows how to configure the local MCP server for a client that wants to start the server via a stdio command and an environment variable.
Run the server in a trusted environment, keep the virtual environment isolated, and avoid exposing the local MCP server to untrusted networks during development. Use standard debugging practices to inspect requests and responses from the client to ensure the tools behave as expected.
If the server fails to start, verify that the Python interpreter is accessible as python3, the virtual environment is activated, and the required dependencies in requirements.txt are installed. Check that the path to src/mcp_server.py is correct and that there are no syntax errors or missing modules.
You can request a greeting, read a file, or list a directory through the MCP client once the server is running. Use the clientβs available endpoints to interact with the tools exposed by the MCP server.
If you want to validate the MCP server using a dedicated inspector tool, install the inspector globally and run it against your local Python process to exercise the server end-to-end.
Run unit tests to ensure the server components behave as expected during development.
Returns a greeting message from the MCP server
Reads contents of a file within allowed paths
Writes content to files at allowed locations
Lists files and directories within a given directory
Creates a new directory