Get the FREE Ultimate OpenClaw Setup Guide →

lightspeed_mcp

Lightspeed MCP: FastAPI + FastMCP integration with automatic discovery of api routes, tools/resources/prompts.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio techwithty-lightspeed_mcp python model_context_protocol/server.py \
  --env MCP_SSL="enabled (configured via deployment proxy such as NGINX/HTTPS gateway)" \
  --env FASTAPI_APP_IMPORT="app.api.main:app"

How to use

This MCP server integrates a FastAPI application with FastMCP, exposing all FastAPI endpoints as MCP tools and resources. At startup it dynamically discovers modules under tools/, prompts/, and resources/ and auto-registers any MCP-decorated functions. You can extend the server by adding new Python modules to those folders without editing server.py. The server supports Context for logging, progress updates, and LLM sampling, and includes image workflows via Image data types. Start the server with python model_context_protocol/server.py, then connect as an MCP client to query tools, resources, and prompts exposed by your FastAPI app. When secured deployment is required, run behind an SSL-enabled proxy (e.g., NGINX) to keep all MCP communications encrypted.

How to install

Prerequisites:

  • Python 3.9+
  • A FastAPI project to integrate with (the MCP folder should sit at the root of your FastAPI app)
  • Access to install Python dependencies (pip)

Installation steps:

  1. Create a Python virtual environment: python -m venv venv source venv/bin/activate # on macOS/Linux venv\Scripts\activate # on Windows

  2. Install required dependencies (adjust as needed for your project): pip install fastapi fastmcp

    If you have a requirements.txt for your project, install them too:

    pip install -r requirements.txt

  3. Ensure your FastAPI app exposes an app object importable as app.api.main:app (as described in the README).

  4. Place the model_context_protocol directory at the root of your FastAPI app folder as described in the guide.

  5. Run the MCP server: python model_context_protocol/server.py

Optional (Docker):

  • Build and run the container as shown in the guide's docker section: docker build -t mcp-server -f app/mcp_server/docker/Dockerfile . docker run -d -p 8000:8000 --name mcp-server mcp-server

Additional notes

Notes and tips:

  • The MCP server auto-imports modules from tools/, prompts/, and resources/ using dynamic import at startup; add modules with @mcp.tool, @mcp.resource, or @mcp.prompt decorators to register them automatically.
  • If you relocate the model_context_protocol folder, update the import paths in server.py accordingly.
  • The platform supports SSL/TLS; deploy behind a reverse proxy (e.g., NGINX) or an HTTPS-enabled gateway to secure MCP communications by default.
  • Blocked/privileged routes like /system, /service, and /mcp_deny are intentionally excluded from public MCP access.
  • For production, consider using Docker or a process manager to ensure reliability and SSL termination at the edge.

Related MCP Servers

Sponsor this space

Reach thousands of developers