Skip to main content

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(或 .jsonfmt=json
  • 文件结构:列表,每项为 {type, key, value}
    • type: header | param
    • key: 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"}
]

使用流程

  1. 初始化(生成空值模板):
{"tool":"init_config","args":{"overwrite":false}}

执行后会在项目根创建 .mcp_api_request.yml(或 .json),其中示例条目的 value 为空。请手动编辑为你的真实 token;空值项在请求时不会发送。

  1. 发起请求:
{
  "tool":"api_request",
  "args":{
    "method":"GET",
    "url":"https://api.example.com/users",
    "params":{"page":1},
    "headers":{"X-Debug":"1"}
  }
}

许可证

  • MIT(见 LICENSE

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yooztech_mcp_api_request-0.0.6.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yooztech_mcp_api_request-0.0.6-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file yooztech_mcp_api_request-0.0.6.tar.gz.

File metadata

File hashes

Hashes for yooztech_mcp_api_request-0.0.6.tar.gz
Algorithm Hash digest
SHA256 cea0ef657943c81429a1d6370c18a7051a5d950d961c66b8fae326f704095f8d
MD5 1f2604dd10de99f07b7ef50254883bd4
BLAKE2b-256 7cceea72b738163bffdd2abb68902ae6c612d9e2b11fea3a28b23bea3f83b203

See more details on using hashes here.

File details

Details for the file yooztech_mcp_api_request-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for yooztech_mcp_api_request-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2a91b0eb398cf11ff95443065cb3d9ae9bf51085a27affb1cd25e9b6137159c2
MD5 2ad9e214ce76e76f69daf15aaa7c5794
BLAKE2b-256 c3e0fc283959147aae2d72afb6df39947e396f5db1293584f5826de9d8a02357

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page