Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcp-tools

It's a small "web toolkit" — two tools that fetch a web page and return it in a form a model can actually use. No search API, no keys, just plain HTTP + the standard library.

What it does

The server is called web-toolkit and exposes two tools:

  • fetch_url — download a page and return its readable text (strips out <script>/<style>, pulls the <title>, collapses whitespace, truncates to max_chars). Returns a structured result, not a blob of HTML.
  • extract_links — return every link on a page as {href, text}, with hrefs made absolute.

fetch_url also reports live progress while it works (connecting → parsing → extracting), so a client can show status instead of staring at a frozen call.

How it's laid out

server.py                    # entrypoint: builds the server and runs it over HTTP
client.py                    # a real MCP client that calls the tools over HTTP
try_fetch.py                 # quick scratch script: calls a tool in-process (no server)
web_toolkit/
  app.py                     # build_server() — creates the server, registers tools
  tools/
    __init__.py              # register_all() — one line per tool
    fetch.py                 # fetch_url + the HTML-to-text parser
    links.py                 # extract_links
requirements.txt

I went with a register pattern instead of scattering @mcp.tool() decorators around: each tool module has a register(mcp) function, and register_all() calls them. Adding a tool is one new file + one line.

Running it

Needs two terminals — one for the server, one for the client.

# one-time setup
python -m venv .venv
.venv/bin/pip install -r requirements.txt

Terminal 1 — start the server (stays running):

.venv/bin/python server.py
# serves on http://127.0.0.1:8000/mcp

Terminal 2 — run the client:

.venv/bin/python -m client

You should see it connect, list the two tools, then call both. fetch_url streams progress lines as it goes:

Calling fetch_url on example.com ...
  [progress 0/3] Connecting to URL: https://example.com
  [progress 1/3] Downloaded, parsing HTML...
  [progress 2/3] Extracting text...
  title : Example Domain
  status: 200

If you just want to poke a tool without running the server, try_fetch.py calls it in-process:

.venv/bin/python try_fetch.py

Versions

Python 3.12, mcp==2.0.0, httpx2, pydantic v2. Full pin list in requirements.txt.

About

This is a MCP server for LLM to call this as a tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors