Skip to content

sunwu51/deno-webfetch-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deno-webfetch-mcp

一个可部署到 Deno Deploy 的 MCP Server,提供 fetch_url 工具:传入 URL,抓取页面文本并返回。

本地运行

deno task dev

启动后:

  • MCP endpoint: http://127.0.0.1:8000/mcp
  • 健康检查: http://127.0.0.1:8000/

工具说明

工具名:fetch_url

参数:

  • url (string, 必填): 目标 HTTP/HTTPS URL
  • max_chars (number, 可选): 最多返回字符数,默认 20000
  • timeout_ms (number, 可选): 请求超时毫秒数,默认 15000

返回内容包括:

  • 请求 URL 与最终 URL(跟随重定向后)
  • HTTP 状态码与 Content-Type
  • 抓取时间、下载字节数
  • 页面文本(必要时会截断)

部署到 Deno Deploy

main.ts 作为入口部署即可,目前最新的deno deploy注册后,直接把main.ts拷贝到playgroud中,点击deplop即可。

img

部署完成后会得到一个域名,直接拿来就可以使用了,例如:https://webfetch.xiaogenban.deno.net/mcp这个是我部署的域名,可以直接使用。

配置到 Claude Code

Claude Code 命令添加:

# 这里地址可以替换为你自己部署的,也可以直接用我的
claude mcp add --transport http webfetch https://webfetch.xiaogenban.deno.net/mcp

或者自行修改~/.claude.json

{
  "mcpServers": {
    "webfetch": {
      "type": "url",
      "url": "https://webfetch.xiaogenban.deno.net/mcp"
    }
  }
}

验证:

claude mcp list

或在 Claude Code 会话中输入 /mcp,看到 webfetch 处于可用状态即可。

Releases

No releases published

Packages

 
 
 

Contributors