Simple MCP Tool Server

Simple MCP Tool Server

A server that provides a website fetching tool via SSE transport, allowing users to retrieve content from specified URLs.

Category
访问服务器

README

Simple MCP Tool Server

A simple MCP server that exposes a website fetching tool using SSE transport.

Requirements

  • Python 3.10 or higher (tested on Python 3.13)

Installation

# Create a virtual environment
python3 -m venv venv

# Activate the virtual environment
source venv/bin/activate

# Install the package and dependencies
pip install -r requirements.txt

MCP Python SDK Documentation

The MCP Python SDK documentation has been split into smaller files and organized in the mcp_python_sdk_docs/ directory. This structure makes it easier for AI agents to navigate and understand the SDK. The documentation covers:

  • Core concepts (servers, resources, tools, etc.)
  • Running MCP servers in different modes
  • Examples and advanced usage
  • And more!

Check out the index file for the complete table of contents.

Usage

The package provides a command-line interface (CLI) with several commands to manage the MCP server:

Starting the server

Start the server on the default port (7000) or specify a custom port:

# Using default port (7000)
python -m mcp_simple_tool start

# Using custom port
python -m mcp_simple_tool start --port 8000

Managing the server

# Check if server is running
python -m mcp_simple_tool check [--port PORT]

# Stop the server
python -m mcp_simple_tool stop [--port PORT]

# Restart the server (stop and start)
python -m mcp_simple_tool restart [--port PORT]

The restart command will:

  1. Stop any existing server on the specified port
  2. Start a new server in the background
  3. Wait until the server is responsive
  4. Log output to server.log

CLI quick reference

Command Purpose
start Start the server
stop Stop the server
check Health-check
restart Stop & start
call Invoke a tool locally or against a running server

Server Tools

The server exposes the following tools:

  • fetch: Fetches a website and returns its content

    • url: The URL of the website to fetch (required)
  • search_docs: Semantic search across SDK documentation files

    • query: Search phrase or question (required)
    • k: Number of top matches to return (optional, default = 3)

Testing a tool

You can test the tools using the CLI:

# Test the fetch tool
python -m mcp_simple_tool call --tool fetch --args '{"url":"https://awesome-testing.com"}'

# Test the search_docs tool
python -m mcp_simple_tool call --tool search_docs --args '{"query":"Context object"}'

Development Setup

For development, install additional tools:

pip install -e .
pip install -r requirements.txt

Use the Makefile for common tasks:

# Format code
make fmt

# Run linters
make lint

# Run tests
make test

The test suite has a built-in 20-second timeout for all tests to prevent hanging, especially with SSE endpoints. For individual tests, a more strict timeout can be specified using the @pytest.mark.timeout(seconds) decorator.

Semantic Search Index

For the search_docs tool, you can manually build or rebuild the vector index:

# Build or rebuild the semantic search index
python scripts/build_doc_index.py

The index is built automatically on first tool use if it doesn't exist.

Project Architecture

mcp_simple_tool/
    __init__.py          # Package initialization
    __main__.py          # Entry point when run as module
    cli.py               # Command-line interface
    server/              # Server implementation
        __init__.py      # Server package initialization
        app.py           # ASGI application setup
        config.py        # Configuration settings
        handlers.py      # Tool implementations
        http.py          # HTTP utilities
    semantic_search/     # Semantic search functionality
        __init__.py      # Package initialization
        indexing.py      # Build and persist vector store
        search.py        # Load index and query helpers

Using with Cursor

This MCP server can be used with Cursor as a client. For setup:

  1. Run the server in a terminal:
source venv/bin/activate
python -m mcp_simple_tool start
# or use the restart command
python -m mcp_simple_tool restart
  1. Configure Cursor by creating a .cursor/mcp.json file:
{
  "mcpServers": {
    "website-fetcher-sse": {
      "url": "http://localhost:7000/sse"
    }
  }
}
  1. Mention the server in your prompts when using Cursor

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选