内容
# 语义 API MCP 服务器
<!-- mcp-name: io.github.peter-j-thompson/semanticapi -->
一个 [MCP(模型上下文协议)](https://modelcontextprotocol.io) 服务器,允许 Claude、ChatGPT 和其他 LLM 代理使用自然语言通过 [语义 API](https://semanticapi.dev) 搜索和发现 API。可以用简单的英语询问任何 API 功能,并获取端点详细信息、参数、身份验证信息和代码片段。
## 安装
```bash
pip install semanticapi-mcp
```
或使用 uvx 直接运行:
```bash
uvx semanticapi-mcp
```
## 配置
### 获取 API 密钥
在 [semanticapi.dev](https://semanticapi.dev) 注册以获取您的 API 密钥。
### 环境变量
| 变量 | 是否必需 | 默认值 | 描述 |
| --- | --- | --- | --- |
| `SEMANTIC_API_KEY` | 是 | — | 您的语义 API 密钥 |
| `SEMANTIC_API_URL` | 否 | `https://semanticapi.dev` | API 基本 URL 重定向 |
### Claude 桌面版
添加到您的 Claude 桌面版配置(`~/Library/Application Support/Claude/claude_desktop_config.json`):
```json
{
"mcpServers": {
"semanticapi": {
"command": "uvx",
"args": ["semanticapi-mcp"],
"env": {
"SEMANTIC_API_KEY": "your-api-key-here"
}
}
}
}
```
或如果使用 pip 安装:
```json
{
"mcpServers": {
"semanticapi": {
"command": "semanticapi-mcp",
"env": {
"SEMANTIC_API_KEY": "your-api-key-here"
}
}
}
}
```
## 工具
### `semantic_query`
使用自然语言搜索 API 功能。
**输入:**
- `query`(字符串,必需)— 您想要执行的操作,例如“使用 Gmail 发送电子邮件”
- `auto_discover`(布尔值,可选,默认值:true)— 如有必要,自动发现新的 API
**示例:** “为我找到一个实时转换货币的 API”
### `semantic_discover`
按名称和意图深入发现特定提供商/API。
**输入:**
- `provider_name`(字符串,必需)— API 提供商名称,例如“stripe”、“twilio”
- `user_intent`(字符串,可选)— 您想使用此 API 执行的操作
**示例:** 发现 Stripe 的“处理退款”的功能
### `semantic_discover_url`
从 API 文档 URL 分析任何 API。
**输入:**
- `url`(字符串,必需)— API 文档的 URL
- `user_intent`(字符串,可选)— 您想使用此 API 执行的操作
**示例:** 分析 `https://docs.example.com/api` 以生成提供商配置
## 相关
- **[语义 API](https://semanticapi.dev)** — 托管的 API 服务
- **[semanticapi-engine](https://github.com/peter-j-thompson/semanticapi-engine)** — 开源引擎(AGPL-3.0)
- **[semantic-api-skill](https://github.com/peter-j-thompson/semantic-api-skill)** — 代理框架技能包
- **[CLI 工具](https://github.com/peter-j-thompson/semanticapi-cli)** — 命令行界面(`pip install semanticapi-cli`)
<!-- mcp-name: io.github.peter-j-thompson/semanticapi -->
## 许可证
MIT