@sport365/sport-mcp 0.1.0
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.md +192 -0
- package/basketball-api.md +918 -0
- package/bin/sport-mcp.js +39 -0
- package/football-api.md +1166 -0
- package/native/sport-mcp-server-darwin-arm64 +0 -0
- package/native/sport-mcp-server-darwin-x64 +0 -0
- package/native/sport-mcp-server-linux-x64 +0 -0
- package/native/sport-mcp-server-win32-x64.exe +0 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Sport MCP
|
|
2
|
+
|
|
3
|
+
Sport MCP is a Rust-based MCP stdio server packaged as an npm CLI. Users can start it with `npx`, while the actual MCP protocol handling and upstream API calls run in the native Rust binary.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
After the package is published, configure your MCP client like this:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"sport": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "@sport365/sport-mcp"],
|
|
15
|
+
"env": {
|
|
16
|
+
"SPORT_AGENT_KEY": "skill_abc123"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`SPORT_AGENT_KEY` is required. It is sent to the upstream API as `X-Agent-Key`.
|
|
24
|
+
|
|
25
|
+
Optional environment variables:
|
|
26
|
+
|
|
27
|
+
| Variable | Default | Description |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| `SPORT_API_BASE_URL` | `https://beta-skill-api.zhitiyu.com/` | Override the upstream API host. |
|
|
30
|
+
| `SPORT_API_TIMEOUT_SECS` | `20` | HTTP timeout in seconds. |
|
|
31
|
+
| `X_AGENT_KEY` | none | Fallback when `SPORT_AGENT_KEY` is not set. |
|
|
32
|
+
|
|
33
|
+
The default upstream URL is compiled into the Rust binary from `crates/sport-core/build.rs`.
|
|
34
|
+
The API documentation entry is `https://beta-skill-api.zhitiyu.com/docs/api`.
|
|
35
|
+
|
|
36
|
+
## MCP Tools
|
|
37
|
+
|
|
38
|
+
The server exposes two MCP tools:
|
|
39
|
+
|
|
40
|
+
| Tool | Description |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `sport_list_domains` | List supported football and basketball API domains. |
|
|
43
|
+
| `sport_api_call` | Call a whitelisted Skill API domain with query parameters. |
|
|
44
|
+
|
|
45
|
+
Example `sport_api_call` input:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"ball_type": "ft",
|
|
50
|
+
"kind": "data",
|
|
51
|
+
"domain": "match-info",
|
|
52
|
+
"query": {
|
|
53
|
+
"matchId": "123456"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For material APIs, repeated query parameters can be passed as arrays:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"ball_type": "bk",
|
|
63
|
+
"kind": "material",
|
|
64
|
+
"domain": "match",
|
|
65
|
+
"query": {
|
|
66
|
+
"matchId": "123456",
|
|
67
|
+
"materialIndexList": ["1", "3"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
API references:
|
|
73
|
+
|
|
74
|
+
- [Football API](docs/api/football-api.md)
|
|
75
|
+
- [Basketball API](docs/api/basketball-api.md)
|
|
76
|
+
|
|
77
|
+
## Project Structure
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
bin/sport-mcp.js npm/npx wrapper
|
|
81
|
+
crates/sport-core Core config, domain registry, HTTP client
|
|
82
|
+
crates/sport-mcp-server Rust MCP stdio server binary
|
|
83
|
+
docs/architecture.md Chinese architecture design
|
|
84
|
+
docs/api/ Skill API documents
|
|
85
|
+
scripts/ Build, staging and packaging scripts
|
|
86
|
+
dist/ Generated build and npm package output
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Node only selects and starts the native binary. It does not parse MCP messages or call upstream APIs. The Rust server writes MCP JSON-RPC messages through stdio and writes normal logs to stderr.
|
|
90
|
+
|
|
91
|
+
## Build
|
|
92
|
+
|
|
93
|
+
Build the current platform:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npm run build
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Build Windows x64 and Linux x64:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npm run build:win-linux
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Build all supported native binaries:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm run build:all
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`build:all` currently stages:
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
native/sport-mcp-server-win32-x64.exe
|
|
115
|
+
native/sport-mcp-server-linux-x64
|
|
116
|
+
native/sport-mcp-server-darwin-x64
|
|
117
|
+
native/sport-mcp-server-darwin-arm64
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
On Windows, Linux x64 is built with Docker by default when Docker is available. macOS cross builds use `cargo-zigbuild`, Zig and a configured macOS SDK.
|
|
121
|
+
|
|
122
|
+
## macOS Cross Build On Windows
|
|
123
|
+
|
|
124
|
+
Required tools:
|
|
125
|
+
|
|
126
|
+
```powershell
|
|
127
|
+
choco install zig -y
|
|
128
|
+
cargo install --locked cargo-zigbuild
|
|
129
|
+
rustup target add x86_64-apple-darwin aarch64-apple-darwin
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Configure the macOS SDK:
|
|
133
|
+
|
|
134
|
+
```powershell
|
|
135
|
+
$env:SDKROOT="D:\sdks\MacOSX.sdk"
|
|
136
|
+
$env:MACOSX_SDK_PATH="D:\sdks\MacOSX.sdk"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Then build:
|
|
140
|
+
|
|
141
|
+
```powershell
|
|
142
|
+
npm run build:mac:zig
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Package
|
|
146
|
+
|
|
147
|
+
Generate an npm tarball for the current platform:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npm run package
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Generate a full-platform tarball:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npm run package:all
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The output is written to:
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
dist/artifacts/
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The npm staging directory is:
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
dist/npm/
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Publish
|
|
172
|
+
|
|
173
|
+
Before publishing, replace the placeholder package name in `package.json`:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"name": "@sport365/sport-mcp"
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Then publish the staged package:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npm login
|
|
185
|
+
npm run publish:npm:all
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Architecture
|
|
189
|
+
|
|
190
|
+
The detailed architecture design is written in Chinese:
|
|
191
|
+
|
|
192
|
+
- [Architecture Design](docs/architecture.md)
|