mcpField
X
Xpath

Xpath

Local
github.com/JayArrowzDeveloper Tools1Updated 64w ago

About Xpath

Xpath is an MCP server for running XPath queries on XML content, with an additional tool to fetch and query content from a URL. It serves workflows that extract matching results from XML or HTML.

Key features

  1. 01Run XPath queries on XML
  2. 02Fetch URLs and query their content
  3. 03Accept an optional MIME type
  4. 04Return query results as strings

Use cases

  1. 01Extract matching nodes from XML
  2. 02Retrieve links from an HTML page
  3. 03Query XML or HTML fetched from a URL

MCP support

The MCP server provides xpath and xpathwithurl tools to query supplied XML and fetched URL content, respectively.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"xpath": {
"command": "npx",
"args": [
"-y",
"@jayarrowz/mcp-xpath"
]
}
}
}
Run commandnpx -y @jayarrowz/mcp-xpath

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@jayarrowz/mcp-xpath

Tools

2

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
xmlstringYesThe XML content to query
querystringYesThe XPath query to execute
mimeTypestringNoThe MIME type (e.g. text/xml, application/xml, text/html, application/xhtml+xml)

Details

From the project README

MseeP.ai Security Assessment Badge

XPath MCP Server

Third Strand Studio

MCP Server for executing XPath queries on XML content.

mcp-xpath MCP server

image

smithery badge

Tools

  1. xpath

    • Query XML content using XPath expressions
    • Inputs:
      • xml (string): The XML content to query
      • query (string): The XPath query to execute
      • mimeType (optional, string): The MIME type (e.g. text/xml, application/xml, text/html, application/xhtml+xml)
    • Returns: The result of the XPath query as a string
  2. xpathwithurl

    • Fetch content from a URL and query it using XPath expressions
    • Inputs:
      • url (string): The URL to fetch XML/HTML content from
      • query (string): The XPath query to execute
      • mimeType (optional, string): The MIME type (e.g. text/xml, application/xml, text/html, application/xhtml+xml)
    • Returns: The result of the XPath query as a string

Installation

Installing via Smithery

To install mcp-xpath for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @thirdstrandstudio/mcp-xpath --client claude
# Install dependencies
npm install

# Build the package
npm run build

Setup

Usage with Claude Desktop

Add the following to your claude_desktop_config.json:

npx
{
  "mcpServers": {
    "xpath": {
      "command": "npx",
      "args": [
        "@thirdstrandstudio/mcp-xpath"
      ]
    }
  }
}
Direct Node.js
{
  "mcpServers": {
    "xpath": {
      "command": "node",
      "args": [
        "/path/to/mcp-xpath/dist/index.js"
      ]
    }
  }
}

Replace /path/to/mcp-xpath with the actual path to your repository.

Examples

Query XML content
// Select all <item> elements from XML
const result = await callTool("xpath", {
  xml: "<root><item>value1</item><item>value2</item></root>",
  query: "//item/text()",
  mimeType: "text/xml"
});
Query HTML content
// Get all links from HTML
const result = await callTool("xpath", {
  xml: "<html><body><a href='link1.html'>Link 1</a><a href='link2.html'>Link 2</a></body></html>",
  query: "//a/@href",
  mimeType: "text/html"
});
Query URL content
// Get all links from a webpage
const result = await callTool("xpathwithurl", {
  url: "https://example.com",
  query: "//a/@href",
  mimeType: "text/html"
});

Development

# Install dependencies
npm install

# Start the server in development mode
npm start

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.