MCP server template for generic API requests
Project description
yooztech_mcp_api_request —— 基于 MCP 的通用 API 请求工具
该 MCP 服务器用于向真实后端 API 发起请求,帮助前端/AI 获取最真实的接口返回;包含:
init_config(project_root=None, overwrite=false, tokens=None, fmt="yaml"):在项目根创建配置文件,存储鉴权信息api_request(method, url, params=None, headers=None, body=None, project_root=None, timeout_seconds=30):读取配置并发起请求,返回基本信息与完整响应
在 Cursor 中配置
在 Cursor 的设置中添加 MCP Server(示例):
{
"mcpServers": {
"yooztech_mcp_api_request": {
"command": "yooztech_mcp_api_request",
"args": []
}
}
}
如不想全局安装,可使用 uvx 方式:
{
"mcpServers": {
"yooztech_mcp_api_request": {
"command": "uvx",
"args": ["yooztech_mcp_api_request"]
}
}
}
脚本与入口
- 控制台脚本:
yooztech_mcp_api_request(见pyproject.toml的[project.scripts])
开发
- 依赖安装:
pip install -r requirements.txt - 运行:
yooztech_mcp_api_request
配置文件
- 默认文件名(写入项目根目录):
.mcp_api_request.yml(或.json当fmt=json) - 文件结构:列表,每项为
{type, key, value}type:header|paramkey: token 的字段名value: token 的值
示例(YAML):
- type: header
key: Authorization
value: Bearer xxxxxx
- type: param
key: access_token
value: xxxxxx
或(JSON):
[
{"type":"header","key":"Authorization","value":"Bearer xxxxxx"},
{"type":"param","key":"access_token","value":"xxxxxx"}
]
使用流程
- 初始化(生成空值模板):
{"tool":"init_config","args":{"overwrite":false}}
执行后会在项目根创建 .mcp_api_request.yml(或 .json),其中示例条目的 value 为空。请手动编辑为你的真实 token;空值项在请求时不会发送。
- 发起请求:
{
"tool":"api_request",
"args":{
"method":"GET",
"url":"https://api.example.com/users",
"params":{"page":1},
"headers":{"X-Debug":"1"}
}
}
许可证
- MIT(见
LICENSE)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yooztech_mcp_api_request-0.0.1.tar.gz.
File metadata
- Download URL: yooztech_mcp_api_request-0.0.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
756126c2643b9a060ff05070bdd75a14d253b15f38af294fa2a7e81767883a6c
|
|
| MD5 |
ef5495c9c63e14985134b376ffaebb48
|
|
| BLAKE2b-256 |
65ded8dc6db66f4341c42a31bb7483874730a6ff3a5c0c36cc0f274f8b57a3af
|
File details
Details for the file yooztech_mcp_api_request-0.0.1-py3-none-any.whl.
File metadata
- Download URL: yooztech_mcp_api_request-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d60af448253b54ab71fb8a6d38f89d639f4c5f0771dae2c738e153c0cfba73
|
|
| MD5 |
8eef7c1b03b0009061335cebc43921f8
|
|
| BLAKE2b-256 |
0e7b025581a3a0ed8425f02b499c369c171d75fde81bcd5da621af9e3afa87eb
|