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

# 使用 AI 编程

AgentScope Java 文档支持 [`llms.txt` 标准](https://llmstxt.org/)，让 AI 编程助手能够理解框架文档并生成准确的代码。

## 什么是 llms.txt？

`llms.txt` 是一个专为大模型设计的文档索引文件，包含文档结构和关键页面说明，方便 AI 工具快速定位所需内容。

AgentScope Java 现在按版本提供文档入口：

| 文件                 | 说明                           | URL                                           |
| ------------------ | ---------------------------- | --------------------------------------------- |
| `v2/llms.txt`      | AgentScope Java 2.0 文档索引     | `https://java.agentscope.io/v2/llms.txt`      |
| `v2/llms-full.txt` | AgentScope Java 2.0 单文件完整上下文 | `https://java.agentscope.io/v2/llms-full.txt` |
| `v1/llms.txt`      | AgentScope Java 1.x 文档索引     | `https://java.agentscope.io/v1/llms.txt`      |
| `v1/llms-full.txt` | AgentScope Java 1.x 单文件完整上下文 | `https://java.agentscope.io/v1/llms-full.txt` |

## 配置指南

### Claude Code

[Claude Code](https://docs.anthropic.com/en/docs/claude-code) 可以通过 MCP 服务接入文档。

**安装：**

```bash theme={null}
claude mcp add agentscope-docs -- uvx --from mcpdoc mcpdoc --urls AgentScopeJava:https://java.agentscope.io/v2/llms.txt
```

**示例：**

安装后可以直接提问：

> 如何用 AgentScope Java 创建一个工具？

### Cursor

[Cursor](https://cursor.com/) 支持两种接入方式。

**方式一：添加文档（推荐）**

1. 打开 **Cursor Settings** -> **Features** -> **Docs**
2. 点击 **+ Add new Doc**
3. 填入：`https://java.agentscope.io/v2/llms-full.txt`

**方式二：MCP 服务**

1. 打开 **Cursor Settings** -> **Tools & MCP**
2. 点击 **New MCP Server** 编辑 `mcp.json`
3. 添加配置：

```json theme={null}
{
  "mcpServers": {
    "agentscope-docs": {
      "command": "uvx",
      "args": [
        "--from", "mcpdoc", "mcpdoc",
        "--urls", "AgentScopeJava:https://java.agentscope.io/v2/llms.txt"
      ]
    }
  }
}
```

**示例：**

> 参考 AgentScope 文档，写一个带天气查询工具的 ReActAgent。

### Windsurf

[Windsurf](https://codeium.com/windsurf) 可以通过 MCP 服务接入。

1. 打开设置，进入 MCP 配置
2. 添加服务：

```json theme={null}
{
  "mcpServers": {
    "agentscope-docs": {
      "command": "uvx",
      "args": [
        "--from", "mcpdoc", "mcpdoc",
        "--urls", "AgentScopeJava:https://java.agentscope.io/v2/llms.txt"
      ]
    }
  }
}
```

### 其他工具

**支持文档/知识库的工具：**

直接添加 `https://java.agentscope.io/v2/llms-full.txt`。

**支持 MCP 的工具：**

参考上面的 MCP 配置模板。

**使用 AgentScope Java 1.x：**

如果项目仍在使用 1.x，请改用：

* `https://java.agentscope.io/v1/llms.txt`
* `https://java.agentscope.io/v1/llms-full.txt`

**环境要求：**

MCP 方式需要先安装 [`uv`](https://docs.astral.sh/uv/)。
