Token导航 LogoToken导航TokenDH.com
Chainforge MCP logo
AI代理未说明官方级别未说明来源级核验

Chainforge MCP

MCP Server

ChainForge是一个基于Flask、Redis和OpenAI的全栈MCP(模型上下文协议)系统,用于实现AI自动化工具调用、加密数据分析和报告生成。

工具数

9

提示词数

0

GitHub Stars

0

资源数

0
AI自动化报告生成Python

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

jacemElwaar1

提供方

jacemElwaar1

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

太好了!✅ — 以下是 完整且抛光 README.md,每个部分——包括 安装、配置和使用(从第2点开始) --完全以正确的Markdown风格为GitHub编写。

它是一个干净、结构化的独立文档,可以放入您的存储库根目录。

______________________________________________________________________

# 🧠 ChainForge — MCP Intelligent Automation Hub  
*A full-stack MCP (Model Context Protocol) system built with Flask, Redis, and OpenAI.*

![Python](https://img.shields.io/badge/Python-3.10+-blue)
![Flask](https://img.shields.io/badge/Flask-3.0+-green)
![Redis](https://img.shields.io/badge/Redis-Enabled-red)
![OpenAI](https://img.shields.io/badge/OpenAI-GPT--4o-orange)
![License](https://img.shields.io/badge/License-MIT-lightgrey)

---

## 🚀 Overview

**ChainForge** is a modular **AI automation backend** designed to demonstrate the **Model Context Protocol (MCP)** — the same concept powering **ChatGPT Apps**, **LangChain agents**, and **AI function calling**.

This project connects a **Flask backend** (your MCP Server) with an **AI-powered client** that can:
- Automatically discover available tools  
- Reason about user input using GPT models  
- Dynamically call tools (functions)  
- Generate real results such as **crypto analytics**, **reports**, and **AI recommendations**

It’s a **complete training ground** to understand how to bridge **AI reasoning** with **backend automation**.

---

## 🧠 What is MCP?

**MCP (Model Context Protocol)** is an open protocol that defines how AI models interact with tools and external systems.  

In simple terms:
> 🧩 The server provides tools.  
> 🤖 The AI model (client) uses them intelligently.

Your project implements this exact logic — creating a self-contained MCP ecosystem:
- **Server:** Flask app exposing standardized tools via `/mcp/tools/list` and `/mcp/tools/call`  
- **Client:** AI agent powered by OpenAI GPT that decides which tool to call  
- **Execution:** Tools that fetch live crypto data, generate reports, or return insights  

---

## ⚙️ Architecture Overview

链锻炉/ ├── 服务器/ │ ├── app.py← MCP服务器(Flask) │ ├── db/← 数据库配置 │ ├── auth/← JWT身份验证 │ ├── 工具/← 模块化工具 │ │ ├── 加密货币/← CoinGecko API工具 │ │ ├── 报告/← 报告生成 │ │ ├── 人工智能← 基于人工智能的工具(推荐) │ │ ├── 工作/← 后台任务(Redis RQ) │ │ ├── hello.py等。 │ ├── worker.py← 用于异步作业的Redis worker │ └── 需求.txt │ └── 客户/ ├── mcp_client.py← MCP服务器的HTTP客户端 ├── 主客户端.py← AI推理客户端 └── .环境← OpenAI密钥


---

## 🧰 Features

| Category | Tools | Description |
|-----------|--------|-------------|
| 🧩 **Core** | `hello`, `health_check` | Basic server checks |
| 👤 **Auth** | `register_user`, `list_users` | JWT-based user handling |
| 💰 **Crypto** | `get_crypto_price`, `get_market_trends`, `compare_portfolio` | Real crypto data (CoinGecko API) |
| 📊 **Reports** | `generate_report` | Export Excel/PDF reports |
| ⚙️ **Automation** | `schedule_job`, `check_job_status` | Run background jobs |
| 💡 **AI** | `generate_recommendations` | AI-powered portfolio insights |

---

## 🛠️ Installation & Setup

### 🧩 Step 1 — Clone the Repository

git clone https://github.com/your-username/chainforge.git cd chainforge


______________________________________________________________________

### 🧩 步骤2——创建虚拟环境

python -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows


______________________________________________________________________

### 🧩 步骤3——安装依赖项

pip install -r server/requirements.txt


这将安装:

- 烧瓶
- SQLAlchemy
- Redis+RQ
- ReportLab+OpenPyXL
- OpenAI SDK
- Dotenv。

______________________________________________________________________

### 🧩 步骤4——配置环境变量

创建 `.env` 服务器和客户端的文件。

#### **服务器/.env**

JWT_SECRET=dev-secret DATABASE_URL=sqlite:///chainforge.db REDIS_URL=redis://localhost:6379/0 OPENAI_API_KEY=your_openai_api_key_here


#### **客户端/.env**

OPENAI_API_KEY=your_openai_api_key_here


______________________________________________________________________

### 🧩 步骤5——初始化数据库

python

>> from db.base import Base, engine >> import db.models >> Base.metadata.create_all(bind=engine) >> exit()

______________________________________________________________________

### 🧩 第6步——启动Redis

如果Redis没有在本地安装,可以使用Docker:

docker run -d -p 6379:6379 redis


______________________________________________________________________

### 🧩 步骤7——启动MCP服务器

python server/app.py


预期产量:

✅ Loaded tool: hello ✅ Loaded tool: get_crypto_price ✅ Loaded tool: generate_report MCP server running on http://127.0.0.1:8000


______________________________________________________________________

### 🧩 步骤8-(可选)启动后台工作程序

如果你打算使用异步工具(例如。 `schedule_job`):

python server/worker.py


______________________________________________________________________

### 🧩 步骤9——运行AI MCP客户端

python client/main_client.py


预期产量:

Connected to MCP server! Available tools: ['hello', 'get_crypto_price', 'compare_portfolio', 'generate_report', 'generate_recommendations'] 🤖 MCP Agent Ready!


______________________________________________________________________

## 💬 示例用法

客户端运行后,键入自然命令,如:

______________________________________________________________________

### 💰 示例1——获取加密货币价格
What’s the current price of Bitcoin?

→ Using tool: get_crypto_price 💰 BTC price: 68000 USD


______________________________________________________________________

### 💼 示例2——比较投资组合
Compare my portfolio: 0.5 BTC and 1.2 ETH

→ Using tool: compare_portfolio 💼 Total Portfolio Value: $12,200


______________________________________________________________________

### 📊 示例3——生成报告
Generate a report of my portfolio in Excel

→ Using tool: generate_report 📄 Report generated successfully: portfolio_analysis_20251025.xlsx


______________________________________________________________________

### 💡 示例4——获取人工智能建议
Give me investment recommendations for my crypto portfolio

→ Using tool: generate_recommendations 💡 Recommendations:

  1. Diversify holdings.
  2. Increase ETH exposure.
  3. Monitor BTC volatility.

______________________________________________________________________

## ⚙️ 手动API调用(可选)

### 列出可用工具

curl http://127.0.0.1:8000/mcp/tools/list | jq


### 执行工具

curl -X POST http://127.0.0.1:8000/mcp/tools/call \ -H "Content-Type: application/json" \ -d '{"name":"get_crypto_price","arguments":{"symbol":"bitcoin"}}' | jq


答复:

{ "result": { "content": [ {"type":"text","text":"💰 BTC price: 68000 USD"} ], "is_error": false } }


______________________________________________________________________

## 🧩 运作原理

1. **MCP服务器** 通过以下方式公开所有可用工具 `/mcp/tools/list` 和 `/mcp/tools/call`.
1. **AI客户端** 获取工具列表。
1. **OpenAI模型** 解释用户输入并决定调用哪个工具。
1. **服务器** 执行该工具并返回结构化JSON。
1. **客户** 显示结果(如果需要,可以链接操作)。

______________________________________________________________________

## 🧱 技术栈概述

|层|技术|
| -------------------- | ------------------------------------------ |
| **服务器框架** |烧瓶|
| **数据库** |SQLAlchemy+SQLite|
| **异步作业** |Redis+RQ|
| **AI推理** |OpenAI GPT模型|
| **报告** |ReportLab+OpenPyXL|
| **客户端接口** |Python命令行界面(Rich+OpenAI)|
| **协议** |类似模型上下文协议(MCP)的JSON API|

______________________________________________________________________

## 🧠 扩展系统

您可以轻松添加新工具——只需在中创建一个新文件 `server/tools//`:

name = "tool_name" description = "What this tool does" input_schema = { ... }

def handler(args): # business logic return { "content": [{"type": "text", "text": "✅ Done successfully"}], "is_error": False }


工具是 **自动注册** 启动时使用Flask应用程序——无需配置。

______________________________________________________________________

## 🧭 后续步骤

|特性|描述|
| ------------------------- | ------------------------------------------------------------------- |
| 🧩 **前端仪表板** |构建一个React/Next.js web界面来可视化和调用工具。    |
| ⚙️ **工具链** |允许AI客户端按顺序执行多个工具。         |
| ☁️ **S3集成** |将生成的文件存储在云存储(Scaleway或AWS)中。           |
| 🔒 **角色管理** |添加用户角色和身份验证范围(顾问、管理员等)。 |

______________________________________________________________________

## 🧑‍💻 作者

**ChainForge** --创建为完整 **动手项目** 掌握人工智能工具集成、后端自动化和模型上下文协议。

内置❤️ 由一位充满热情的开发人员 **人工智能系统工程**.

______________________________________________________________________

## 📜 许可证

**MIT许可证** --免费用于个人和商业用途。

______________________________________________________________________

## ✅ 快速小结

✅ Flask MCP服务器
✅ 加密货币+报告+人工智能工具
✅ Redis后台作业
✅ OpenAI驱动的MCP客户端
✅ 全端到端人工智能自动化

欢迎来到 **ChainForge** --您的个人实验室,用于构建智能人工智能系统的未来🚀

Would you like me to include a bonus setup.sh script at the end of the README (so users can install everything and run the full system with one command)? It’s perfect for new developers or quick deployment setups.

目录标签

目录标签

AI自动化报告生成Python本地部署加密数据分析模型上下文协议Flask后端

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

9

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP