1. Conduid
  2. AI
  3. Fastapi Bitnet
MCP server · AI

Fastapi Bitnet

Running Microsoft's BitNet inference framework via FastAPI, Uvicorn and Docker.

60Good

Scored 6 hours ago · breakdown

About Fastapi Bitnet

Fastapi Bitnet is an MCP server published by grctest in the AI category: running Microsoft's BitNet inference framework via FastAPI, Uvicorn and Docker.

The repository has 42 stars and 14 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/grctest/FastAPI-BitNet

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Fastapi Bitnet

Powered by Claude · Grounded in docs

I know everything about Fastapi Bitnet. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 6 hours ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • ✓License declaredUsable under a stated license.
  • !Tests presentNo tests found. Behaviour changes may go unnoticed between versions.
  • !Dependencies pinnedNo lockfile. Installs can pull different code over time.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

Releases

v0.1.1v0.1.1
v0.1.0v0.1.0
v0.0.9v0.0.9
v0.0.8v0.0.8
v0.0.7v0.0.7

README

FastAPI-BitNet

This project provides a robust REST API built with FastAPI and Docker to manage and interact with llama.cpp-based BitNet model instances. It allows developers and researchers to programmatically control llama-cli and llama-server processes for automated testing, benchmarking, and interactive chat sessions.

Key Features

  • Session Management: Start, stop, and check the status of multiple persistent llama-cli and llama-server session based chats.
  • Batch Operations: Initialize, shut down, and chat with multiple instances in a single API call.
  • Interactive Chat: Send prompts to running bitnet sessions and receive cleaned model responses.
  • Model Benchmarking: Programmatically run benchmarks and calculate perplexity on GGUF models.
  • Resource Estimation: Estimate maximum server capacity based on available system RAM and CPU threads.
  • VS Code Integration: Connects directly to GitHub Copilot Chat as a tool via the Model Context Protocol.
  • Automatic API Docs: Interactive API documentation powered by Swagger UI and ReDoc.

Technology Stack

  • FastAPI for the core web framework.
  • Uvicorn as the ASGI server.
  • Docker for containerization and easy deployment.
  • Pydantic for data validation and settings management.
  • fastapi-mcp for VS Code Copilot tool integration.

Getting Started

Prerequisites

1. Set Up the Python Environment

Create and activate a Conda environment:

conda create -n bitnet python=3.11
conda activate bitnet

Install the Huggingface-CLI tool to download the models:

pip install -U "huggingface_hub[cli]"

Download Microsoft's official BitNet model:

huggingface-cli download microsoft/BitNet-b1.58-2B-4T-gguf --local-dir app/models/BitNet-b1.58-2B-4T

Running the Application

Using Docker (Recommended)

This is the easiest and recommended way to run the application.

  1. Build the Docker image:

    docker build -t fastapi_bitnet .
    
  2. Run the Docker container: This command runs the container in detached mode (-d) and maps port 8080 on your host to port 8080 in the container.

    docker run -d --name ai_container -p 8080:8080 fastapi_bitnet
    

Local Development

For development, you can run the application directly with Uvicorn, which enables auto-reloading.

uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload

API Usage

Once the server is running, you can access the interactive API documentation:


VS Code Integration

As a Copilot Tool (MCP)

You can connect this API directly to VS Code's Copilot Chat to create and interact with models.

  1. Run the application using Docker or locally.
  2. In VS Code, open the Copilot Chat panel.
  3. Click the wrench icon ("Configure Tools...").
  4. Scroll to the bottom and select + Add MCP Server, then choose HTTP.
  5. Enter the URL: http://127.0.0.1:8080/mcp

Copilot will now be able to use the API to launch and chat with BitNet instances.

See Also - VSCode Extension!

For a more integrated experience, check out the companion VS Code extension:

License

This project is licensed under the MIT License. See the LICENSE file for details.

README fetched from the repository 6 hours ago. The original is authoritative.

Questions

About Fastapi Bitnet

How do I install Fastapi Bitnet?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Fastapi Bitnet safe to use with an AI agent?

Its trust score is 60 out of 100 (good). It passes 3 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Fastapi Bitnet still maintained?

The last commit was a year ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.