Skip to main content

linview's MCP server tools for web utilities

Project description

Web Tool MCP Server

一个基于FastMCP框架的Web工具MCP服务器,提供网页内容获取和搜索功能。

功能特性

  • 网页内容获取: 获取指定URL的网页内容
  • 内容搜索: 在网页内容中搜索特定关键词
  • HTML解析: 自动解析HTML并提取文本内容
  • 错误处理: 完善的错误处理和超时机制

安装

从源码安装

# 克隆项目
git clone https://github.com/linview/sandbox_agent.git
cd sandbox_agent/mcp/web_tool

# 安装依赖
pip install -e .

从PyPI安装(发布后)

pip install web-tool-mcp-server

使用方法

命令行使用

# 直接运行
python -m web_tool.server

# 或使用安装的命令
web-tool-server

在Cursor中配置

在Cursor的MCP配置文件中添加:

{
  "web-tools": {
    "command": "python",
    "args": ["-m", "web_tool.server"]
  }
}

或者如果通过pip安装:

{
  "web-tools": {
    "command": "web-tool-server"
  }
}

可用工具

1. get_web_page

获取网页内容

参数:

  • url (str): 要获取的网页URL

返回:

  • 网页的标题和文本内容

示例:

result = get_web_page("https://example.com")

2. search_web_content

在网页内容中搜索关键词

参数:

  • url (str): 要搜索的网页URL
  • search_term (str): 搜索关键词

返回:

  • 包含关键词的上下文内容

示例:

result = search_web_content("https://example.com", "python")

开发

项目结构

web_tool/
├── src/
│   └── web_tool/
│       ├── __init__.py
│       └── server.py
├── setup.py
├── pyproject.toml
└── README.md

本地开发

# 安装开发依赖
pip install -e .

# 运行测试
python -m web_tool.server

# 构建包
python -m build

# 检查包
twine check dist/*

依赖

  • fastmcp >= 1.0.0
  • pydantic >= 2.0.0
  • requests >= 2.28.0
  • beautifulsoup4 >= 4.11.0

许可证

MIT License

作者

linview (linview@gmail.com)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web_tool_mcp_server-0.0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

web_tool_mcp_server-0.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file web_tool_mcp_server-0.0.1.tar.gz.

File metadata

  • Download URL: web_tool_mcp_server-0.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for web_tool_mcp_server-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a484d72fcb083f323ad00faed6a657e8d90a0fd942591fb2b4cea5785b2fbed8
MD5 b7e1938c2c80dec4f28f890f50df059a
BLAKE2b-256 4c209b35364cfb77e30721e6918235a363689f6699684dfc4960a7143fbd01a8

See more details on using hashes here.

File details

Details for the file web_tool_mcp_server-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for web_tool_mcp_server-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2b18d2391e4e4c30cdb2987ad0adc721bdcdcdab74c2c3f8f1371ea9c3cfa60e
MD5 c07f64565e5ad1c95254172c88aff963
BLAKE2b-256 1b37227d3f8ea219c79b62463b6de12343a1e22ad6f4b841193200f1d448f406

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page