MCP Python Server - Streamable HTTP
Enables LangChain agents to discover and execute Python functions as tools via the Model Context Protocol, including shell commands, code execution, and file system operations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Python Server - Streamable HTTPfind all .py files in the project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Python Server - Streamable HTTP
A simple Model Context Protocol (MCP) server built using FastMCP that exposes multiple tools over Streamable HTTP. This project demonstrates how AI assistants (such as Claude Desktop, LangChain Agents, Cursor, or any MCP-compatible client) can discover and execute Python functions as tools.
Features
Streamable HTTP transport
Automatic tool discovery
Execute Bash commands
Execute Python code
Execute Python files
Read and write files
Search files using glob patterns
Search text inside files
Create and delete folders
Related MCP server: Remote MCP Server
Project Structure
.
├── server.py # Starts the MCP HTTP Server
├── tools.py # Tool definitions exposed to MCP clients
├── requirements.txt
├── README.md
└── .gitignoreAvailable Tools
bash(command: str)
Executes a Bash/Command Prompt command and returns the output.
Example:
bash("dir")python_code(code: str)
Executes Python code directly.
Example:
python_code("print('Hello MCP')")python_file(file: str)
Runs a Python script.
Example:
python_file("sample.py")glob(pattern: str)
Returns files matching a pattern.
Example:
glob("*.py")grep(pattern: str, file: str)
Searches for matching text inside a file.
Example:
grep("TODO", "notes.txt")read_file(file: str)
Reads the contents of a file.
write_file(file: str, content: str)
Creates or overwrites a file with the provided content.
create_folder(folder: str)
Creates a directory.
delete_folder(folder: str)
Deletes an existing directory.
Installation
Clone the repository:
git clone https://github.com/nik-red/MCP.git
cd MCPCreate a virtual environment:
Windows
python -m venv .venv
.venv\Scripts\activateLinux / macOS
python3 -m venv .venv
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txtRunning the Server
Start the MCP server:
python server.pyThe server starts using Streamable HTTP on:
http://localhost:8050Testing with MCP Inspector
Install MCP Inspector (if not already installed):
npx @modelcontextprotocol/inspectorConnect to:
http://localhost:8050You can:
Discover available tools
Execute tools interactively
Inspect requests and responses
Verify tool metadata
How It Works
The server starts and registers all functions decorated with
@mcp.tool().An MCP client connects using the Streamable HTTP protocol.
The client requests the list of available tools.
FastMCP automatically generates tool metadata from the Python function signatures and docstrings.
When a tool is invoked, FastMCP executes the corresponding Python function and returns the result to the client.
Technologies Used
Python 3.x
FastMCP
Model Context Protocol (MCP)
Streamable HTTP
Learning Objectives
This project demonstrates:
Building an MCP Server
Creating custom MCP tools
Tool discovery
Streamable HTTP transport
Function execution through MCP
Integrating AI agents with Python applications
Future Improvements
Add authentication
Restrict dangerous shell commands
Add logging
Improve error handling
Deploy as a Databricks App or Docker container
Add Databricks, Azure, and SQL tools
Package and publish reusable tools to PyPI
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nik-red/MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server