> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anysite.io/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP 服务器配置

> 配置 Anysite MCP 服务器以获得最佳性能

## 概述

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

## 配置文件

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

### 基本配置

创建一个 `hdw-config.json` 文件，结构如下：

```json theme={null}
{
  "apiKey": "your-hdw-api-key",
  "baseUrl": "https://api.anysite.io",
  "defaultTimeout": 30000,
  "retryAttempts": 3,
  "enableLogging": true,
  "logLevel": "info"
}
```

### 配置选项

<ParamField path="apiKey" type="string" required>
  您的 Anysite API 访问令牌。从您的[仪表板](https://anysite.io)获取。
</ParamField>

<ParamField path="baseUrl" type="string" default="https://api.anysite.io">
  Anysite API 的基础 URL。通常您不需要更改此项。
</ParamField>

<ParamField path="defaultTimeout" type="number" default="30000">
  API 请求的默认超时时间（毫秒）。
</ParamField>

<ParamField path="retryAttempts" type="number" default="3">
  失败 API 请求的重试次数。
</ParamField>

<ParamField path="enableLogging" type="boolean" default="true">
  启用或禁用日志输出。
</ParamField>

<ParamField path="logLevel" type="string" default="info">
  日志级别：`debug`、`info`、`warn`、`error`。
</ParamField>

## 环境变量

或者，您可以使用环境变量配置 MCP 服务器：

```bash theme={null}
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"
```

<Note>
  环境变量优先于配置文件设置。
</Note>

## 工具特定配置

### LinkedIn 工具配置

配置 LinkedIn 特定设置：

```json theme={null}
{
  "tools": {
    "linkedin": {
      "maxResults": 50,
      "includePrivateProfiles": false,
      "searchDepth": "standard"
    }
  }
}
```

### Instagram 工具配置

配置 Instagram 特定设置：

```json theme={null}
{
  "tools": {
    "instagram": {
      "maxPosts": 100,
      "includeStories": false,
      "mediaQuality": "standard"
    }
  }
}
```

### 速率限制配置

配置速率限制以保持在 API 限制范围内：

```json theme={null}
{
  "rateLimiting": {
    "enabled": true,
    "requestsPerMinute": 60,
    "burstLimit": 10
  }
}
```

## Claude Desktop 集成

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

### macOS

编辑 `~/Library/Application Support/Claude/claude_desktop_config.json`：

```json theme={null}
{
  "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`：

```json theme={null}
{
  "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 服务器添加到您的工作区设置：

```json theme={null}
{
  "mcp.servers": {
    "hdw": {
      "command": "node",
      "args": ["./node_modules/@horizondatawave/mcp-server/dist/index.js"],
      "env": {
        "HDW_API_KEY": "your-hdw-api-key"
      }
    }
  }
}
```

## 验证

通过在调试模式下运行 MCP 服务器来测试您的配置：

```bash theme={null}
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
```

## 故障排除

### 常见问题

<AccordionGroup>
  <Accordion title="无效 API 密钥错误">
    * 验证您的 API 密钥是否正确且有效
    * 检查密钥是否具有适当的权限
    * 确保密钥未过期
  </Accordion>

  <Accordion title="连接超时">
    * 检查您的互联网连接
    * 验证基础 URL 是否正确
    * 尝试增加超时值
  </Accordion>

  <Accordion title="速率限制错误">
    * 在配置中启用速率限制
    * 减少每分钟请求数
    * 检查您的 API 计划限制
  </Accordion>
</AccordionGroup>

### 调试模式

启用调试日志进行故障排除：

```json theme={null}
{
  "logLevel": "debug",
  "enableLogging": true
}
```

这将提供有关 API 请求、响应和内部操作的详细信息。

## 下一步

* [探索可用工具](/mcp-server/tools) - 了解所有 20+ 个可用工具
* [查看示例](/mcp-server/examples) - 查看实际使用示例
* [集成指南](/mcp-server/installation) - 完整安装指南
