AIChat MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AIChat MCP Server帮我创建一个关于牛顿和胡克万有引力争论的对话"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AIChat MCP Server
将 AIChat 服务封装为 MCP (Model Context Protocol) 服务器,供 Claude、Cursor 等 AI 客户端调用。
功能
AI 可以通过 MCP 工具调用你的 AIChat 服务:
创建AI角色用户
创建和管理会话
发送消息
启动/停止自动对话
搜索历史著名论战
Related MCP server: Multi-CLI MCP
认证
MCP Server 支持 3 种认证方式:
方式 | 环境变量 | 说明 |
API Key |
| 推荐 - 需要在 AIChat 中预生成 API Key |
用户名密码 |
| 自动登录获取 Token |
直接 Token |
| 直接使用已有的 Access Token |
生成 API Key
登录 AIChat 网页端
在浏览器控制台执行以下代码生成 API Key:
// 获取当前用户的 accessToken(登录后)
const token = localStorage.getItem('accessToken');
// 生成 API Key
fetch('/api/auth/api-key/generate', {
method: 'POST',
headers: { 'Authorization': 'Bearer ' + token }
}).then(r => r.json()).then(d => console.log('API Key:', d.apiKey));或者使用 curl(需要先通过浏览器获取 token):
curl -X POST http://localhost:8080/api/auth/api-key/generate \
-H "Authorization: Bearer <your-jwt-token>"配置示例
方式A: 使用 mcporter (推荐)
将配置添加到 C:\Users\renji\.mcporter\mcporter.json:
{
"mcpServers": {
"aichat": {
"command": "python",
"args": ["D:/AI Project/AIChat/AIChat-MCP/server.py"],
"env": {
"AICHAT_BASE_URL": "http://localhost:8080/api",
"AICHAT_API_KEY": "your-api-key-here"
}
}
}
}方式B: Claude Desktop
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"aichat": {
"command": "python",
"args": ["D:/AI Project/AIChat/AIChat-MCP/server.py"],
"env": {
"AICHAT_BASE_URL": "http://localhost:8080/api",
"AICHAT_USERNAME": "your-username",
"AICHAT_PASSWORD": "your-password"
}
}
}
}方式C: 使用环境变量
# 方式1: API Key(推荐)
set AICHAT_API_KEY=your-api-key
set AICHAT_BASE_URL=http://localhost:8080/api
# 方式2: 用户名密码
set AICHAT_USERNAME=your-username
set AICHAT_PASSWORD=your-password
set AICHAT_BASE_URL=http://localhost:8080/api
# 方式3: 直接Token
set AICHAT_ACCESS_TOKEN=your-access-token
set AICHAT_BASE_URL=http://localhost:8080/api
python server.py快速开始
1. 安装依赖
cd AIChat-MCP
pip install -r requirements.txt2. 配置认证
设置环境变量或直接在 mcporter 配置中添加认证信息。
3. 启动 MCP Server
python server.py可用工具
工具 | 说明 |
| 列出所有AI角色用户 |
| 创建新的AI角色 |
| 根据ID获取用户详情 |
| 根据名称获取用户详情 |
| 列出所有会话 |
| 创建新会话 |
| 获取会话详情和消息 |
| 启动自动对话 |
| 停止对话 |
| 删除会话 |
| 清空消息 |
| 搜索历史著名论战 |
使用示例
命令行测试
# 列出所有工具
mcporter list aichat
# 列出用户
mcporter call aichat.list_users
# 根据名称查找用户
mcporter call aichat.get_user_by_name name:=牛顿
# 根据ID查找用户
mcporter call aichat.get_user userId:=1
# 搜索历史论战
mcporter call aichat.search_famous_debates "query=物理"
# 创建用户
mcporter call aichat.create_user name:=牛顿 displayName:=艾萨克·牛顿 modelType:=QWEN rolePrompt:=你是艾萨克·牛顿,英国物理学家
# 创建会话
mcporter call aichat.create_session name:=牛顿vs胡克 sessionTheme:=关于万有引力优先权的争论
# 获取会话详情
mcporter call aichat.get_session sessionId:=1让 AI 创建历史人物对话
用户: 帮我创建一个关于牛顿和胡克万有引力争论的对话AI 会自动:
调用
search_famous_debates搜索相关论战调用
create_user创建"牛顿"用户调用
create_user创建"胡克"用户调用
create_session创建会话调用
start_chat启动自动对话
搜索历史论战
用户: 找出物理学上著名的论战AI 会调用 search_famous_debates 返回预设的历史著名论战列表。
配置
修改后端地址
# 方式1: 环境变量
set AICHAT_BASE_URL=http://localhost:8080/api
python server.py
# 方式2: 直接修改 server.py 中的 BASE_URL
BASE_URL = "http://your-server:8080/api"项目结构
AIChat-MCP/
├── server.py # MCP Server 主程序
├── requirements.txt # Python 依赖
└── README.md # 说明文档依赖
Python 3.8+
mcp >= 1.0.0
requests >= 2.31.0
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/chandler-rj/AIChat-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server