](https://mseep.ai/app/thirdstrandstudio-mcp-xpath)
XPath MCP服务器

用于对XML内容执行XPath查询的MCP服务器。
](https://smithery.ai/server/@thirdstrandstudio/mcp-xpath)
工具
xpath
- 使用XPath表达式查询XML内容 - 输入: - xml (string):要查询的XML内容 - query (string):要执行的XPath查询 - mimeType (可选,字符串):MIME类型(例如text/xml、application/xml、text/html、application/xhtml+xml) - 返回:XPath查询的结果为字符串
xpathwithurl
- 从URL获取内容,并使用XPath表达式进行查询 - 输入: - url (string):从中获取XML/HTML内容的URL - query (string):要执行的XPath查询 - mimeType (可选,字符串):MIME类型(例如text/xml、application/xml、text/html、application/xhtml+xml) - 返回:XPath查询的结果为字符串
安装
通过Smithery安装
通过以下方式自动安装mcp-xpath for Claude Desktop 史密瑟里:
npx -y @smithery/cli install @thirdstrandstudio/mcp-xpath --client claude# Install dependencies
npm install
# Build the package
npm run build设置
使用Claude Desktop
将以下内容添加到您的 claude_desktop_config.json:
新巴拿马型船舶
{
"mcpServers": {
"xpath": {
"command": "npx",
"args": [
"@thirdstrandstudio/mcp-xpath"
]
}
}
}直接Node.js
{
"mcpServers": {
"xpath": {
"command": "node",
"args": [
"/path/to/mcp-xpath/dist/index.js"
]
}
}
}替换 /path/to/mcp-xpath 使用存储库的实际路径。
例子
查询XML内容
// Select all elements from XML
const result = await callTool("xpath", {
xml: "value1value2",
query: "//item/text()",
mimeType: "text/xml"
});查询HTML内容
// Get all links from HTML
const result = await callTool("xpath", {
xml: "Link 1Link 2",
query: "//a/@href",
mimeType: "text/html"
});查询URL内容
// Get all links from a webpage
const result = await callTool("xpathwithurl", {
url: "https://example.com",
query: "//a/@href",
mimeType: "text/html"
});发展
# Install dependencies
npm install
# Start the server in development mode
npm start许可证
此MCP服务器根据MIT许可证获得许可。这意味着您可以根据MIT许可证的条款和条件自由使用、修改和分发软件。有关更多详细信息,请参阅项目存储库中的LICENSE文件。
