Sponsored by Deepsite.site

🤖 Claude-Compatible MCP Server Setup

Created By
bhupender-kaushal8 months ago
A demo using MCP servers.
Content

🤖 Claude-Compatible MCP Server Setup

This guide walks you through setting up a Claude-compatible MCP server using Python, FastMCP, and uv, with support for both Windows and macOS/Linux.


✅ Prerequisites

  • Python ≥ 3.12 (required by mcp-example)
  • uv installed
  • A terminal (Command Prompt, PowerShell, or Bash)

Installing the mcp packahe using uv

uv add "mcp[cli]"

Installing the Claude is mandatory

📁 Step 1: Create Your MCP Server (main.py)

In your project folder, create a file named main.py:

from mcp.server.fastmcp import FastMCP
import sys

print("✅ MCP server running with:", sys.version)

# Create the MCP server
mcp = FastMCP("Demo")

# Add a simple tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b

# Add a dynamic greeting resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
    """Return a personalized greeting"""
    return f"Hello, {name}!"

📦 Step 2: Install uv

🪟 Windows

  1. Open PowerShell as Administrator
  2. Run:
irm https://astral.sh/uv/install.ps1 | iex

This will install uv to %USERPROFILE%\.cargo\bin\uv.

Optional: Add it to your PATH manually if needed:

$env:Path += ";$HOME\.cargo\bin"

Then close and reopen your terminal.


🍎 macOS / 🐧 Linux

Run in your terminal:

curl -Ls https://astral.sh/uv/install.sh | sh

Add to your shell’s config if needed:

export PATH="$HOME/.local/bin:$PATH"

Test it:

uv --version

✅ If you see a version, you're good to go.


🚀 Step 3: Launch Your MCP Server

Now register and run your Claude-compatible server:

uv run mcp install main.py

This will:

  • Dynamically install mcp[cli] using uv
  • Validate your main.py server
  • Register it for Claude (if integrated)

🧪 Step 4 (Optional): Test it manually

To verify it runs correctly:

uv run --python 3.12 --with "mcp[cli]" mcp run main.py

Expected output:

✅ MCP server running with: 3.12.x
👋 Server started, waiting for client...

🛠️ Troubleshooting

spawn uv ENOENT

Cause: uv is not on your system PATH

Fix:

On macOS/Linux:

export PATH="$HOME/.local/bin:$PATH"

On Windows:

$env:Path += ";$HOME\.cargo\bin"

spawn uv EACCES

Cause: uv exists but isn't executable (macOS/Linux)

Fix:

chmod +x ~/.local/bin/uv

❌ Python version error: Python 3.9.6 does not satisfy Python>=3.12

Cause: Your default Python is outdated

Fix:

  • Install Python 3.12 from python.org
  • OR use pyenv or Anaconda to manage Python versions
  • OR force uv to use the correct Python:
uv run --python 3.12 ...

You can also create a .python-version file in your project:

echo "3.12" > .python-version

You can also follow


❌ Claude doesn't connect

  • Make sure your server name (FastMCP("Demo")) matches what Claude expects
  • Add logging to confirm the server is running and accepting requests:
print("👋 Server ready and waiting for Claude...")

🧠 Tips

  • You can use any name in FastMCP("YourName")
  • You can register multiple servers with different entry files
  • You don’t need to write .mcp/config.json manually — mcp install handles that for you

🎉 You're Done!

You now have a Claude-compatible MCP server that supports:

  • 🔧 Tools (like add(a, b))
  • 🔗 Resources (like greeting://name)
  • uv-based install/run flow
  • 💬 Claude compatibility out of the box

Some more resources to follow.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
ChatWiseThe second fastest AI chatbot™
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
CursorThe AI Code Editor
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
Serper MCP ServerA Serper MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Playwright McpPlaywright MCP server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Amap Maps高德地图官方 MCP Server
Tavily Mcp