使用说明
MCP服务器示例
MCP(模型上下文协议)服务器,提供对示例API的访问,允许AI助手与示例数据交互。
特性
- 从示例API中列出和检索项目
- 异步HTTP客户端,具有错误处理功能
- 使用Pydantic模型键入响应
安装
使用mpak(推荐)
# Configure your API key
mpak config set @nimblebraininc/example api_key=your_api_key_here
# Run the server
mpak run @nimblebraininc/example
手动安装
# Clone the repository
git clone https://github.com/NimbleBrainInc/mcp-example.git
cd mcp-example
# Install dependencies with uv
uv sync
# Set your API key
export EXAMPLE_API_KEY=your_api_key_here
# Run the server
uv run python -m mcp_example.server
配置
获取API密钥
- 首选https://example.com/settings/api
- 创建新的API密钥
- 复制密钥
Claude桌面配置
添加到您的 ~/.claude/settings.json:
{
"mcpServers": {
"example": {
"command": "mpak",
"args": ["run", "@nimblebraininc/example"]
}
}
}
可用工具
| 工具 | 说明 |
|---|---|
list_items |
列出API中具有可选限制的项目 |
get_item |
按ID获取单个项目 |
发展
# Install dev dependencies
uv sync --dev
# Run tests
uv run pytest tests/ -v
# Format code
uv run ruff format src/ tests/
# Lint
uv run ruff check src/ tests/
# Type check
uv run ty check src/
# Run all checks
make check
许可证
麻省理工学院