QF

q1317540161/free5gc-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

2 stars 7 forks 质量 50 趋势 8

MCP server for free5gc

概览

This project is an MCP (Model Context Protocol) server implemented in Go that provides AI assistants (like GitHub Copilot) with tools to manage free5GC 5G core network subscribers and configurations. - : Start, stop, and monitor all free5GC network functions (NRF, AMF, SMF, UPF, etc.) - : Full CRUD operations for 5G subscribers - : Query users within tenants - : Automatic authentication with free5GC webconsole - : Works seamlessly with GitHub Copilot in VS Code - : Version 1.22 or later (1.23+ recommended) - : Version 4.4 or later - : With GitHub Copilot extension installed - : installation guide - : installation guide This setup is only for local free5gc. Skip this if you use free5gc-helm. ⚠️ : The MCP server requires passwordless sudo privileges to start and stop free5GC network functions. This is because free5GC's run.sh script requires root privileges to configure network interfaces and start the UPF (User Plane Function).

README

以下为原文 README 节选,完整内容请查看原文。

free5GC MCP (Model Context Protocol) Server

This project is an MCP (Model Context Protocol) server implemented in Go that provides AI assistants (like GitHub Copilot) with tools to manage free5GC 5G core network subscribers and configurations.

Features

  • Core Network Control: Start, stop, and monitor all free5GC network functions (NRF, AMF, SMF, UPF, etc.)
  • Subscriber Management: Full CRUD operations for 5G subscribers
  • Tenant User Management: Query users within tenants
  • JWT Authentication: Automatic authentication with free5GC webconsole
  • VS Code Integration: Works seamlessly with GitHub Copilot in VS Code

Table of Contents

  1. Prerequisites
  2. free5GC Setup
  3. Configuring Sudo for MCP Server
  4. Patching free5GC run.sh
  5. Setting Up the MCP Server
  6. VS Code MCP Configuration
  7. Tool Summary
  8. Configuration Reference
  9. Usage Examples
  10. Quick Start (TL;DR)
  11. Troubleshooting

Prerequisites

  • Go: Version 1.22 or later (1.23+ recommended)
  • MongoDB: Version 4.4 or later
  • VS Code: With GitHub Copilot extension installed
  • free5GC: installation guide
  • free5gc-helm: installation guide

free5GC Setup

This setup is only for local free5gc. Skip this if you use free5gc-helm.

Step 1: Start MongoDB

sudo systemctl start mongodb
sudo systemctl enable mongodb

# Verify MongoDB is running
mongosh --eval "db.adminCommand('ping')"

Step 2: Clone and Build free5GC

# Clone free5GC
git clone --recursive -b v4.1.0 -j `nproc` https://github.com/free5gc/free5gc.git
cd free5gc

# Build all NFs
make all

# Build webconsole
cd webconsole
go build -o bin/webconsole ./server.go

Step 3: Start free5GC Components

Edit webuicfg.yaml:

# modify the webconsole port 
nano ~/free5gc/config/webuicfg.yaml
port: 5000 -> 30500
# Terminal 1: Start the webconsole (backend API server)
cd free5gc/webconsole
./bin/webconsole

# The webconsole will be available at http://127.0.0.1:30500
# Default login: admin / free5gc

Step 4: Verify free5GC is Running

# Check webconsole health
curl -s http://127.0.0.1:30500/api/health

# Login to get a token (for manual testing)
curl -s -X POST http://127.0.0.1:30500/api/login \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"free5gc"}'

Configuring Sudo for MCP Server

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →