跳转到主要内容

概述

Anysite MCP 服务器需要正确配置才能连接您的 API 凭据并自定义工具行为。本指南涵盖所有可用的配置选项。

配置文件

MCP 服务器使用 JSON 配置文件,该文件应放置在您的项目目录中或通过环境变量指定。

基本配置

创建一个 hdw-config.json 文件,结构如下:
{
  "apiKey": "your-hdw-api-key",
  "baseUrl": "https://api.anysite.io",
  "defaultTimeout": 30000,
  "retryAttempts": 3,
  "enableLogging": true,
  "logLevel": "info"
}

配置选项

apiKey
string
必填
您的 Anysite API 访问令牌。从您的仪表板获取。
baseUrl
string
默认值:"https://api.anysite.io"
Anysite API 的基础 URL。通常您不需要更改此项。
defaultTimeout
number
默认值:"30000"
API 请求的默认超时时间(毫秒)。
retryAttempts
number
默认值:"3"
失败 API 请求的重试次数。
enableLogging
boolean
默认值:"true"
启用或禁用日志输出。
logLevel
string
默认值:"info"
日志级别:debuginfowarnerror

环境变量

或者,您可以使用环境变量配置 MCP 服务器:
export HDW_API_KEY="your-hdw-api-key"
export HDW_BASE_URL="https://api.anysite.io"
export HDW_TIMEOUT="30000"
export HDW_RETRY_ATTEMPTS="3"
export HDW_LOG_LEVEL="info"
环境变量优先于配置文件设置。

工具特定配置

LinkedIn 工具配置

配置 LinkedIn 特定设置:
{
  "tools": {
    "linkedin": {
      "maxResults": 50,
      "includePrivateProfiles": false,
      "searchDepth": "standard"
    }
  }
}

Instagram 工具配置

配置 Instagram 特定设置:
{
  "tools": {
    "instagram": {
      "maxPosts": 100,
      "includeStories": false,
      "mediaQuality": "standard"
    }
  }
}

速率限制配置

配置速率限制以保持在 API 限制范围内:
{
  "rateLimiting": {
    "enabled": true,
    "requestsPerMinute": 60,
    "burstLimit": 10
  }
}

Claude Desktop 集成

要在 Claude Desktop 中使用 MCP 服务器,请将此配置添加到您的 Claude 配置文件:

macOS

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "hdw": {
      "command": "node",
      "args": ["/path/to/hdw-mcp-server/dist/index.js"],
      "env": {
        "HDW_API_KEY": "your-hdw-api-key"
      }
    }
  }
}

Windows

编辑 %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "hdw": {
      "command": "node",
      "args": ["C:\\path\\to\\hdw-mcp-server\\dist\\index.js"],
      "env": {
        "HDW_API_KEY": "your-hdw-api-key"
      }
    }
  }
}

Cursor 集成

对于 Cursor IDE 集成,请将 MCP 服务器添加到您的工作区设置:
{
  "mcp.servers": {
    "hdw": {
      "command": "node",
      "args": ["./node_modules/@horizondatawave/mcp-server/dist/index.js"],
      "env": {
        "HDW_API_KEY": "your-hdw-api-key"
      }
    }
  }
}

验证

通过在调试模式下运行 MCP 服务器来测试您的配置:
node dist/index.js --debug --config ./hdw-config.json
您应该看到类似以下的输出:
[INFO] Anysite MCP Server starting...
[INFO] Configuration loaded successfully
[INFO] API connection verified
[INFO] 20+ tools registered
[INFO] MCP Server ready on stdio

故障排除

常见问题

  • 验证您的 API 密钥是否正确且有效
  • 检查密钥是否具有适当的权限
  • 确保密钥未过期
  • 检查您的互联网连接
  • 验证基础 URL 是否正确
  • 尝试增加超时值
  • 在配置中启用速率限制
  • 减少每分钟请求数
  • 检查您的 API 计划限制

调试模式

启用调试日志进行故障排除:
{
  "logLevel": "debug",
  "enableLogging": true
}
这将提供有关 API 请求、响应和内部操作的详细信息。

下一步