Get the FREE Ultimate OpenClaw Setup Guide →

mcp -example

A simple MCP server to search for documentation (tutorial)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio alejandro-ao-mcp-server-example uv run main.py \
  --env UV_DIRECTORY="Absolute path to the project directory (optional)"

How to use

This MCP server implementation provides a lightweight Python-based MCP server that can expose resources, tools, and prompts to MCP clients. It is designed to integrate with the UV package manager and can be launched with a simple uv run main.py command from the project root. Once running, clients that support MCP can connect to this server to access data sources or capabilities defined by the server implementation. The repository demonstrates how to structure an MCP server, how to initialize a project, and how to configure clients like Claude Desktop to discover and use the server. The server is intended for educational purposes and can be extended to expose additional resources (files, API responses), tools (callable functions with user approval), or prompts (pre-written templates) to LLMs through MCP.

How to install

Prerequisites:\n- Python 3.10 or higher\n- UV package manager (uv) installed on your system\n- Internet access to install dependencies\n\nInstall and set up the MCP server:\n1) Install uv (if not already installed):\nbash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n2) Create and setup the project directory (example names follow the README):\nbash\nuv init mcp-server\ncd mcp-server\n\n3) Create and activate a Python virtual environment (optional but recommended):\nbash\nuv venv\n# Activate (example on macOS/Linux)\nsource .venv/bin/activate\n\n4) Install MCP CLI and dependencies:\nbash\nuv add "mcp[cli]" httpx\n\n5) Create the server entry file (main.py) and implement your MCP server logic:\nbash\ntouch main.py\n\n6) Run the MCP server:\nbash\nuv run main.py\n\nNotes:\n- Ensure uv is properly installed and available in your PATH.\n- Adjust the directory path in your client configuration to the absolute path of your mcp-server project when necessary.\n- For Claude Desktop integration, configure the mcpServers entry with the absolute path to uv and your main.py script as shown in the README.\n

Additional notes

Tips and common issues:\n- Use absolute paths in client configurations to avoid discovery problems.\n- If the server does not appear in MCP clients, verify that the uv command is accessible and that main.py starts without errors.\n- Keep Python dependencies up to date and ensure you are using Python 3.10+ as required.\n- When extending the server, document new resources, tools, or prompts with clear metadata to help MCP clients understand how to interact with them.\n- If running behind a restricted network, ensure the necessary ports for MCP connections are open and not blocked by firewalls.\n

Related MCP Servers

Sponsor this space

Reach thousands of developers