Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Choose the entry that matches the requested task before installing dependencies
| Read documentation through Google ADK tools | [ADK MCP example](examples/adk_docs.py) and the README section “Read documentation with Google ADK”; Python 3.11+, uv, no model, Cloud project or account key. |
| Read documentation through Pydantic AI tools | [Pydantic AI MCP example](examples/pydantic_docs.py) and the README section “Read documentation with Pydantic AI”; Python 3.11+, uv, no model or account key. |
| Read documentation through the OpenAI Agents SDK | [OpenAI Agents SDK MCP example](examples/openai_agents_docs.py) and the README section “Read documentation with the OpenAI Agents SDK”; Python 3.12+, uv, no model or account key. |
| Read documentation with mcp-use from Node.js | [Standalone mcp-use example](examples/mcp-use-docs/remote-docs.ts) and the README section “Read documentation with mcp-use (Node.js)”; Node.js 22.22.2+, no model or account key. |
| Check a chain's identity with Python | [Standard-library public reader](examples/public_chain.py) and the README section “Python standard-library entry”. |
| Check chain identity and read the latest block number | [Public TypeScript reader](src/public-read-cli.ts) and the README section “Start with a keyless read”. |
| Inspect a saved BSC receipt and fixed-block logs offline | [Pinned BSC event sample](https://gist.github.com/gjwang/5a8f80f5e441a5701e2e01ae73f187bf/0f680ce849c78375537fce5ed1ce9e447fe2f341) and the README section “Check a saved BSC receipt and its logs”; Node.js 22+, no account or key. |
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,22 @@ The `async with server` block keeps the connection open for both calls and close

This calls the SDK-managed MCP server directly; it does not run an `Agent` or `Runner`. For a model-backed agent, configure your model separately and pass the same server in the agent's `mcp_servers`. See the [official OpenAI Agents SDK guide](https://developers.openai.com/api/docs/guides/agents/integrations-observability). This example does not test a model-driven agent workflow.

### Read documentation with mcp-use (Node.js)

Use the standalone [mcp-use example](examples/mcp-use-docs/remote-docs.ts) with Node.js 22.22.2+:

```bash
cd examples/mcp-use-docs
npm ci --ignore-scripts
npm start
```

It connects to the docs-only MCP endpoint, lists the tools, searches for `quickstart` in English and prints the page returned by the search. No local server, model, account or API key is needed. The client closes on success or failure; tool errors and empty results stop the script. Calls have 15-second timeouts. Dependency installation needs network access and happens before the script starts.

SDK anonymous telemetry is disabled before the client module loads.

The example pins `@mcp-use/client` to 2.4.5 and commits its dependency lockfile. Internal QA runs set `BLOCKVECTRA_INTERNAL_QA=1`; ordinary runs leave it unset. Reading the document does not execute its RPC or account instructions.

### 1. Claude Code Configuration

#### Keyless Documentation MCP
Expand Down
16 changes: 16 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,22 @@ uv run examples/openai_agents_docs.py

此例直接调用由 SDK 管理的 MCP server,不运行 `Agent` 或 `Runner`。需要模型参与时,另行配置模型,并把同一个 server 放入 agent 的 `mcp_servers`。参见 [OpenAI Agents SDK 官方指南](https://developers.openai.com/api/docs/guides/agents/integrations-observability)。此例未验证模型驱动的 Agent 工作流。

### 使用 mcp-use 读取文档(Node.js)

使用独立的 [mcp-use 示例](examples/mcp-use-docs/remote-docs.ts),需要 Node.js 22.22.2+:

```bash
cd examples/mcp-use-docs
npm ci --ignore-scripts
npm start
```

示例连接仅文档 MCP 入口,列出工具,用英语搜索 `quickstart`,然后打印搜索返回的页面。无需本地服务、模型、账号或 API key。成功或失败都会关闭客户端;工具报错或结果为空时停止。每次调用超时为 15 秒。安装依赖需要联网,在脚本启动前完成。

示例在加载客户端模块前关闭 SDK 匿名遥测。

示例固定 `@mcp-use/client` 2.4.5,并提交依赖锁文件。内部 QA 设置 `BLOCKVECTRA_INTERNAL_QA=1`,正常使用时不设置。读取文档不会执行文中的 RPC 或账号操作。

### 1. Claude Code 配置

#### 免 Key 文档服务
Expand Down
1 change: 1 addition & 0 deletions examples/mcp-use-docs/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
228 changes: 228 additions & 0 deletions examples/mcp-use-docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions examples/mcp-use-docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "blockvectra-mcp-use-docs-example",
"private": true,
"version": "1.0.0",
"type": "module",
"engines": {
"node": ">=22.22.2"
},
"scripts": {
"start": "node remote-docs.ts"
},
"dependencies": {
"@mcp-use/client": "2.4.5"
}
}
95 changes: 95 additions & 0 deletions examples/mcp-use-docs/remote-docs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* Search and read BlockVectra documentation with @mcp-use/client.
* Node.js 22.22.2+; from this directory: npm ci --ignore-scripts && npm start.
* No local server, model, account or API key is needed.
*/

export {};

// Disable SDK telemetry before the module initializes.
process.env.MCP_USE_ANONYMIZED_TELEMETRY = "false";
const { MCPClient } = await import("@mcp-use/client");

const TIMEOUT = 15000;
const LANG = "en";
// Internal QA runs set BLOCKVECTRA_INTERNAL_QA=1 so traffic can be told apart.
const USER_AGENT =
"mcp-use-remote-docs-example/1" +
(process.env.BLOCKVECTRA_INTERNAL_QA === "1" ? " BlockVectraQA/1" : "");

function textOf(
result: { isError?: boolean; content: unknown[] },
label: string
): string {
if (result.isError) throw new Error(`${label} returned an error result`);
for (const block of result.content) {
if (typeof block !== "object" || block === null) continue;
if ("type" in block && block.type === "text" && "text" in block) {
if (typeof block.text === "string" && block.text.trim()) {
return block.text;
}
}
}
throw new Error(`${label} returned no text content`);
}

function firstResultPath(payload: unknown): string {
if (typeof payload === "object" && payload !== null && "results" in payload) {
const { results } = payload;
if (Array.isArray(results) && results.length > 0) {
const first: unknown = results[0];
if (typeof first === "object" && first !== null && "path" in first) {
if (typeof first.path === "string" && first.path !== "") {
return first.path;
}
}
}
}
throw new Error("search_docs returned no usable results; stopping");
}

async function main(): Promise<void> {
const client = new MCPClient({
mcpServers: {
docs: {
url: "https://docs.blockvectra.com/mcp/docs",
oauth: false,
detectMixedAuth: false,
timeout: TIMEOUT,
headers: {
"User-Agent": USER_AGENT,
},
},
},
});

try {
const connection = await client.connect("docs");

const tools = await connection.listTools({ timeout: TIMEOUT });
console.log("tools:", tools.map((t) => t.name).join(", "));

const search = await connection.callTool(
"search_docs",
{ query: "quickstart", lang: LANG, limit: 1 },
{ timeout: TIMEOUT }
);
const payload: unknown = JSON.parse(textOf(search, "search_docs"));
const path = firstResultPath(payload);
console.log("first result:", path);

const doc = await connection.callTool(
"read_doc",
{ path, lang: LANG },
{ timeout: TIMEOUT }
);
console.log(textOf(doc, "read_doc"));
} finally {
await client.close();
}
}

main().catch((err) => {
console.error(err);
process.exitCode = 1;
});
Loading