@aibuilders/mcp-coach-server 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.dev.md +71 -0
- package/README.md +20 -93
- package/dist/index.js +26 -8
- package/package.json +2 -3
package/README.dev.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# AI Builder MCP (Developer Guide)
|
|
2
|
+
|
|
3
|
+
This document is for internal development and maintenance. It includes local setup, testing with MCP Inspector, and build instructions.
|
|
4
|
+
|
|
5
|
+
## Quick Start (Development)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Clone
|
|
9
|
+
git clone <repository-url>
|
|
10
|
+
cd student_portal_mcp
|
|
11
|
+
|
|
12
|
+
# Install dependencies
|
|
13
|
+
npm install
|
|
14
|
+
|
|
15
|
+
# Environment variables
|
|
16
|
+
cp .env.example .env
|
|
17
|
+
# Edit .env and set AI_BUILDER_TOKEN
|
|
18
|
+
|
|
19
|
+
# Run in dev mode
|
|
20
|
+
npm run dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## MCP Inspector Testing
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Install Inspector
|
|
27
|
+
npm install -g @modelcontextprotocol/inspector
|
|
28
|
+
|
|
29
|
+
# Run Inspector (in another terminal)
|
|
30
|
+
mcp-inspector
|
|
31
|
+
|
|
32
|
+
# In Inspector UI, connect using either:
|
|
33
|
+
# Option 1 (recommended): npx tsx src/index.ts
|
|
34
|
+
# Option 2: node dist/index.js
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Tool Usage Examples
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"tool": "get_api_specification",
|
|
42
|
+
"arguments": {}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"tool": "get_auth_token",
|
|
49
|
+
"arguments": { "masked": true }
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"tool": "get_deployment_guide",
|
|
56
|
+
"arguments": { "service_type": "fastapi" }
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Build
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm run build
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Publish Checklist
|
|
67
|
+
|
|
68
|
+
- Ensure `AI_BUILDER_TOKEN` handling is correct
|
|
69
|
+
- Update version in `package.json`
|
|
70
|
+
- `npm publish` (scope: `@aibuilders`)
|
|
71
|
+
|
package/README.md
CHANGED
|
@@ -1,72 +1,42 @@
|
|
|
1
|
-
# AI
|
|
1
|
+
# AI Builder MCP
|
|
2
2
|
|
|
3
|
-
MCP
|
|
3
|
+
An MCP server that provides deployment guidance and API usage support for the AI Builders platform. This README is for end users and focuses on installation and usage, not development.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- **get_api_specification()**: 获取AI Builders平台的OpenAPI规范和endpoint信息
|
|
8
|
-
- **get_deployment_guide()**: 获取部署指导(带缓存机制)
|
|
9
|
-
- **explain_authentication_model()**: 详细解释认证机制和使用最佳实践
|
|
10
|
-
- **get_auth_token()**: 返回环境中的 AI_BUILDER_TOKEN(默认打码)
|
|
11
|
-
- **create_env_file()**: 在指定目录创建包含 AI_BUILDER_TOKEN 的 .env 文件
|
|
12
|
-
|
|
13
|
-
## 本地开发和使用
|
|
14
|
-
|
|
15
|
-
### 快速开始(开发模式)
|
|
5
|
+
## Install
|
|
16
6
|
|
|
17
7
|
```bash
|
|
18
|
-
|
|
19
|
-
git clone <repository-url>
|
|
20
|
-
cd student_portal_mcp
|
|
21
|
-
|
|
22
|
-
# 2. 安装依赖
|
|
23
|
-
npm install
|
|
24
|
-
|
|
25
|
-
# 3. 配置环境变量
|
|
26
|
-
cp .env.example .env
|
|
27
|
-
# 编辑 .env 文件,添加你的 AI_BUILDER_TOKEN
|
|
28
|
-
|
|
29
|
-
# 4. 运行开发服务器
|
|
30
|
-
npm run dev
|
|
8
|
+
npm install -g @aibuilders/mcp-coach-server
|
|
31
9
|
```
|
|
32
10
|
|
|
33
|
-
|
|
11
|
+
You can also run without a global install:
|
|
34
12
|
|
|
35
13
|
```bash
|
|
36
|
-
|
|
37
|
-
npm install -g @modelcontextprotocol/inspector
|
|
38
|
-
|
|
39
|
-
# 运行Inspector(在另一个终端)
|
|
40
|
-
mcp-inspector
|
|
41
|
-
|
|
42
|
-
# 在Inspector界面中,选择以下任一方式:
|
|
43
|
-
# 方式1(推荐): npx tsx /Users/grapeot/co/student_portal_mcp/src/index.ts
|
|
44
|
-
# 方式2: node /Users/grapeot/co/student_portal_mcp/dist/index.js
|
|
45
|
-
# 然后点击 Connect
|
|
14
|
+
npx @aibuilders/mcp-coach-server
|
|
46
15
|
```
|
|
47
16
|
|
|
48
|
-
|
|
17
|
+
## Run
|
|
49
18
|
|
|
50
|
-
|
|
19
|
+
The server reads `AI_BUILDER_TOKEN` from your environment.
|
|
51
20
|
|
|
52
21
|
```bash
|
|
53
|
-
|
|
54
|
-
|
|
22
|
+
AI_BUILDER_TOKEN=your_token_here mcp-coach-server
|
|
23
|
+
```
|
|
55
24
|
|
|
56
|
-
|
|
57
|
-
|
|
25
|
+
Or with `npx`:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
AI_BUILDER_TOKEN=your_token_here npx mcp-coach-server
|
|
58
29
|
```
|
|
59
30
|
|
|
60
|
-
|
|
31
|
+
## Configure in MCP Clients
|
|
61
32
|
|
|
62
|
-
|
|
33
|
+
Example (Claude Desktop `mcpServers`):
|
|
63
34
|
|
|
64
35
|
```json
|
|
65
36
|
{
|
|
66
37
|
"mcpServers": {
|
|
67
|
-
"ai-
|
|
68
|
-
"command": "
|
|
69
|
-
"args": ["tsx", "/Users/grapeot/co/student_portal_mcp/src/index.ts"],
|
|
38
|
+
"ai-builder-mcp": {
|
|
39
|
+
"command": "mcp-coach-server",
|
|
70
40
|
"env": {
|
|
71
41
|
"AI_BUILDER_TOKEN": "your_token_here"
|
|
72
42
|
}
|
|
@@ -75,49 +45,6 @@ npx @ai-builders/mcp-coach-server
|
|
|
75
45
|
}
|
|
76
46
|
```
|
|
77
47
|
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"tool": "get_api_specification",
|
|
83
|
-
"arguments": {}
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
返回内容为英文,并包含:
|
|
88
|
-
- `endpoint_info.base_url`(自动从 OpenAPI servers 推断)
|
|
89
|
-
- `sdk_compatibility.openai_sdk_compatible`(标注兼容 OpenAI SDK)
|
|
90
|
-
- 示例:`/v1/chat/completions`
|
|
48
|
+
## License
|
|
91
49
|
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
"tool": "get_auth_token",
|
|
95
|
-
"arguments": { "masked": true }
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
返回打码后的 token;若需要写入 .env:
|
|
100
|
-
|
|
101
|
-
```json
|
|
102
|
-
{
|
|
103
|
-
"tool": "create_env_file",
|
|
104
|
-
"arguments": { "target_dir": "/path/to/project", "overwrite": false }
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## 开发
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
# 克隆项目
|
|
112
|
-
git clone <repository-url>
|
|
113
|
-
cd ai-builders-mcp-coach
|
|
114
|
-
|
|
115
|
-
# 安装依赖
|
|
116
|
-
npm install
|
|
117
|
-
|
|
118
|
-
# 开发模式运行
|
|
119
|
-
npm run dev
|
|
120
|
-
|
|
121
|
-
# 构建
|
|
122
|
-
npm run build
|
|
123
|
-
```
|
|
50
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -65,7 +65,7 @@ async function getCachedDeploymentGuide() {
|
|
|
65
65
|
catch {
|
|
66
66
|
}
|
|
67
67
|
try {
|
|
68
|
-
const response = await fetch("https://
|
|
68
|
+
const response = await fetch("https://space.ai-builders.com/deployment-prompt.md");
|
|
69
69
|
if (response.ok) {
|
|
70
70
|
const content = await response.text();
|
|
71
71
|
const cacheData = {
|
|
@@ -92,7 +92,7 @@ async function getCachedDeploymentGuide() {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
const server = new Server({
|
|
95
|
-
name: "ai-
|
|
95
|
+
name: "ai-builder-mcp",
|
|
96
96
|
version: "1.0.0",
|
|
97
97
|
}, {
|
|
98
98
|
capabilities: {
|
|
@@ -104,12 +104,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
104
104
|
try {
|
|
105
105
|
switch (name) {
|
|
106
106
|
case "get_api_specification": {
|
|
107
|
-
const response = await fetch("https://
|
|
107
|
+
const response = await fetch("https://space.ai-builders.com/students-backend/openapi.json");
|
|
108
108
|
if (!response.ok) {
|
|
109
109
|
throw new Error(`Failed to fetch OpenAPI specification: HTTP ${response.status}`);
|
|
110
110
|
}
|
|
111
111
|
const openapiSpec = await response.json();
|
|
112
|
-
let baseUrl = "https://
|
|
112
|
+
let baseUrl = "https://space.ai-builders.com/students-backend";
|
|
113
113
|
try {
|
|
114
114
|
if (openapiSpec?.servers?.length) {
|
|
115
115
|
const url = openapiSpec.servers[0].url;
|
|
@@ -117,7 +117,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
117
117
|
baseUrl = url;
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
|
-
baseUrl = `https://
|
|
120
|
+
baseUrl = `https://space.ai-builders.com${url}`;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -138,7 +138,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
138
138
|
authentication: {
|
|
139
139
|
type: "bearer_token",
|
|
140
140
|
header: "Authorization: Bearer {AI_BUILDER_TOKEN}",
|
|
141
|
-
token_source: "Environment variable AI_BUILDER_TOKEN"
|
|
141
|
+
token_source: "Environment variable AI_BUILDER_TOKEN",
|
|
142
|
+
setup_instruction: "The AI_BUILDER_TOKEN must be set in a .env file. As an AI assistant, you should proactively help users set up their .env file by calling get_auth_token to retrieve the token and then creating or updating the .env file with AI_BUILDER_TOKEN=<token_value>"
|
|
142
143
|
},
|
|
143
144
|
sdk_compatibility: {
|
|
144
145
|
openai_sdk_compatible: true,
|
|
@@ -156,7 +157,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
156
157
|
mcp_recommendation: {
|
|
157
158
|
note: "If running via an MCP server, call get_auth_token to retrieve AI_BUILDER_TOKEN and configure your environment manually",
|
|
158
159
|
tools: ["get_auth_token"],
|
|
159
|
-
env_key: "AI_BUILDER_TOKEN"
|
|
160
|
+
env_key: "AI_BUILDER_TOKEN",
|
|
161
|
+
ai_assistant_guidance: {
|
|
162
|
+
proactive_setup: "As an AI assistant, you should proactively help users set up their .env file when they need to use the API. Follow these steps:",
|
|
163
|
+
steps: [
|
|
164
|
+
"1. Call get_auth_token tool to retrieve the AI_BUILDER_TOKEN",
|
|
165
|
+
"2. Check if a .env file exists in the project root",
|
|
166
|
+
"3. Create or update the .env file with: AI_BUILDER_TOKEN=<token_from_get_auth_token>",
|
|
167
|
+
"4. Ensure .env is in .gitignore to prevent committing sensitive tokens",
|
|
168
|
+
"5. Inform the user that the token has been configured and they can now use the API"
|
|
169
|
+
],
|
|
170
|
+
example_env_content: "AI_BUILDER_TOKEN=your_token_here",
|
|
171
|
+
best_practices: [
|
|
172
|
+
"Always use get_auth_token to retrieve the token rather than asking the user",
|
|
173
|
+
"Create the .env file in the project root directory",
|
|
174
|
+
"Verify .gitignore includes .env before creating the file",
|
|
175
|
+
"Explain to the user what you've done and why it's secure"
|
|
176
|
+
]
|
|
177
|
+
}
|
|
160
178
|
}
|
|
161
179
|
}, null, 2)
|
|
162
180
|
}
|
|
@@ -308,7 +326,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
308
326
|
async function main() {
|
|
309
327
|
const transport = new StdioServerTransport();
|
|
310
328
|
await server.connect(transport);
|
|
311
|
-
console.error("AI
|
|
329
|
+
console.error("AI Builder MCP Server started");
|
|
312
330
|
}
|
|
313
331
|
main().catch((error) => {
|
|
314
332
|
console.error("Server failed to start:", error);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aibuilders/mcp-coach-server",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "MCP server
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "AI Builder MCP server for AI Builders platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"model-context-protocol",
|
|
20
20
|
"ai",
|
|
21
21
|
"deployment",
|
|
22
|
-
"coach",
|
|
23
22
|
"ai-builders"
|
|
24
23
|
],
|
|
25
24
|
"author": "AI Builders",
|