{"id":30749848,"url":"https://github.com/ackness/fetch-jsonpath-mcp","last_synced_at":"2025-09-04T06:47:24.639Z","repository":{"id":309912279,"uuid":"1037997073","full_name":"ackness/fetch-jsonpath-mcp","owner":"ackness","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-14T13:45:01.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-14T15:08:01.612Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ackness.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-14T13:03:22.000Z","updated_at":"2025-08-14T13:45:05.000Z","dependencies_parsed_at":"2025-08-14T15:08:03.995Z","dependency_job_id":"c509e056-59cf-4c99-95bc-4e53d51398c3","html_url":"https://github.com/ackness/fetch-jsonpath-mcp","commit_stats":null,"previous_names":["ackness/fetch-jsonpath-mcp"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ackness/fetch-jsonpath-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ackness%2Ffetch-jsonpath-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ackness%2Ffetch-jsonpath-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ackness%2Ffetch-jsonpath-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ackness%2Ffetch-jsonpath-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ackness","download_url":"https://codeload.github.com/ackness/fetch-jsonpath-mcp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ackness%2Ffetch-jsonpath-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273567712,"owners_count":25128634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-04T06:47:08.212Z","updated_at":"2025-09-04T06:47:24.622Z","avatar_url":"https://github.com/ackness.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fetch JSONPath MCP\n\n[![PyPI Downloads](https://img.shields.io/pypi/dm/fetch-jsonpath-mcp)](https://pypi.org/project/fetch-jsonpath-mcp/)\n[![简体中文](https://img.shields.io/badge/docs-简体中文-red)](./docs/README.zh-CN.md)\n\nA Model Context Protocol (MCP) server that provides tools for fetching JSON data and web content from URLs. Features intelligent content extraction, multiple HTTP methods, and browser-like headers for reliable web scraping.\n\n## 🎯 Why Use This?\n\n**Reduce LLM Token Usage \u0026 Hallucination** - Instead of fetching entire JSON responses and wasting tokens, extract only the data you need.\n\n### Traditional Fetch vs JSONPath Extract\n\n**❌ Traditional fetch (wasteful):**\n```json\n// API returns 2000+ tokens\n{\n  \"data\": [\n    {\n      \"id\": 1,\n      \"name\": \"Alice\",\n      \"email\": \"alice@example.com\", \n      \"avatar\": \"https://...\",\n      \"profile\": {\n        \"bio\": \"Long bio text...\",\n        \"settings\": {...},\n        \"preferences\": {...},\n        \"metadata\": {...}\n      },\n      \"posts\": [...],\n      \"followers\": [...],\n      \"created_at\": \"2023-01-01\",\n      \"updated_at\": \"2024-01-01\"\n    },\n    // ... 50 more users\n  ],\n  \"pagination\": {...},\n  \"meta\": {...}\n}\n```\n\n**✅ JSONPath extract (efficient):**\n```json\n// Only 10 tokens - exactly what you need!\n[\"Alice\", \"Bob\", \"Charlie\"]\n```\n\nUsing pattern: `data[*].name` saves **99% tokens** and eliminates model hallucination from irrelevant data.\n\n## Installation\n\nFor most IDEs, use the `uvx` tool to run the server.\n\n```json\n{\n  \"mcpServers\": {\n    \"fetch-jsonpath-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"fetch-jsonpath-mcp\"\n      ]\n    }\n  }\n}\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eInstall in Claude Code\u003c/b\u003e\u003c/summary\u003e\n\n```bash\nclaude mcp add fetch-jsonpath-mcp -- uvx fetch-jsonpath-mcp\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eInstall in Cursor\u003c/b\u003e\u003c/summary\u003e\n\n```json\n{\n  \"mcpServers\": {\n    \"fetch-jsonpath-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\"fetch-jsonpath-mcp\"]\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eInstall in Windsurf\u003c/b\u003e\u003c/summary\u003e\n\nAdd this to your Windsurf MCP config file. See [Windsurf MCP docs](https://docs.windsurf.com/windsurf/cascade/mcp) for more info.\n\n#### Windsurf Local Server Connection\n\n```json\n{\n  \"mcpServers\": {\n    \"fetch-jsonpath-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\"fetch-jsonpath-mcp\"]\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eInstall in VS Code\u003c/b\u003e\u003c/summary\u003e\n\n```json\n\"mcp\": {\n  \"servers\": {\n    \"fetch-jsonpath-mcp\": {\n      \"type\": \"stdio\",\n      \"command\": \"uvx\",\n      \"args\": [\"fetch-jsonpath-mcp\"]\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n## Development Setup\n\n### 1. Install Dependencies\n\n```bash\nuv sync\n```\n\n### 2. Start Demo Server (Optional)\n\n```bash\n# Install demo server dependencies\nuv add fastapi uvicorn\n\n# Start demo server on port 8080\nuv run demo-server\n```\n\n### 3. Run MCP Server\n\n```bash\nuv run fetch-jsonpath-mcp\n```\n\n## Demo Server Data\n\nThe demo server at `http://localhost:8080` returns:\n\n```json\n{\n  \"foo\": [{\"baz\": 1, \"qux\": \"a\"}, {\"baz\": 2, \"qux\": \"b\"}],\n  \"bar\": {\n    \"items\": [10, 20, 30], \n    \"config\": {\"enabled\": true, \"name\": \"example\"}\n  },\n  \"metadata\": {\"version\": \"1.0.0\"}\n}\n```\n\n## Available Tools\n\n### `fetch-json`\nExtract JSON data using JSONPath patterns with support for all HTTP methods.\n\n```json\n{\n  \"name\": \"fetch-json\",\n  \"arguments\": {\n    \"url\": \"http://localhost:8080\",\n    \"pattern\": \"foo[*].baz\",\n    \"method\": \"GET\"\n  }\n}\n```\nReturns: `[1, 2]`\n\n**Parameters:**\n- `url` (required): Target URL\n- `pattern` (optional): JSONPath pattern for data extraction\n- `method` (optional): HTTP method (GET, POST, PUT, DELETE, etc.) - Default: \"GET\"\n- `data` (optional): Request body for POST/PUT requests\n- `headers` (optional): Additional HTTP headers\n\n### `fetch-text`\nFetch web content with intelligent text extraction. **Defaults to Markdown format** for better readability.\n\n```json\n{\n  \"name\": \"fetch-text\",\n  \"arguments\": {\n    \"url\": \"http://localhost:8080\",\n    \"output_format\": \"clean_text\"\n  }\n}\n```\nReturns: Clean text representation of the JSON data\n\n**Output Formats:**\n- `\"markdown\"` (default): Converts HTML to clean Markdown format\n- `\"clean_text\"`: Pure text with HTML tags removed  \n- `\"raw_html\"`: Original HTML content\n\n**Parameters:**\n- `url` (required): Target URL\n- `method` (optional): HTTP method - Default: \"GET\"\n- `data` (optional): Request body for POST/PUT requests\n- `headers` (optional): Additional HTTP headers\n- `output_format` (optional): Output format - Default: \"markdown\"\n\n### `batch-fetch-json`\nProcess multiple URLs with different JSONPath patterns concurrently.\n\n```json\n{\n  \"name\": \"batch-fetch-json\",\n  \"arguments\": {\n    \"requests\": [\n      {\"url\": \"http://localhost:8080\", \"pattern\": \"foo[*].baz\"},\n      {\"url\": \"http://localhost:8080\", \"pattern\": \"bar.items[*]\"}\n    ]\n  }\n}\n```\nReturns: `[{\"url\": \"http://localhost:8080\", \"pattern\": \"foo[*].baz\", \"success\": true, \"content\": [1, 2]}, {\"url\": \"http://localhost:8080\", \"pattern\": \"bar.items[*]\", \"success\": true, \"content\": [10, 20, 30]}]`\n\n**Request Object Parameters:**\n- `url` (required): Target URL\n- `pattern` (optional): JSONPath pattern\n- `method` (optional): HTTP method - Default: \"GET\" \n- `data` (optional): Request body\n- `headers` (optional): Additional HTTP headers\n\n### `batch-fetch-text`\nFetch content from multiple URLs with intelligent text extraction.\n\n```json\n{\n  \"name\": \"batch-fetch-text\",\n  \"arguments\": {\n    \"requests\": [\n      \"http://localhost:8080\",\n      {\"url\": \"http://localhost:8080\", \"output_format\": \"raw_html\"}\n    ],\n    \"output_format\": \"markdown\"\n  }\n}\n```\nReturns: `[{\"url\": \"http://localhost:8080\", \"success\": true, \"content\": \"# Demo Server Data\\n\\n...\"}, {\"url\": \"http://localhost:8080\", \"success\": true, \"content\": \"{\\\"foo\\\": [{\\\"baz\\\": 1, \\\"qux\\\": \\\"a\\\"}, {\\\"baz\\\": 2, \\\"qux\\\": \\\"b\\\"}]...\"}]`\n\n**Supports:**\n- Simple URL strings\n- Full request objects with custom methods and headers\n- Mixed input types in the same batch\n\n## JSONPath Examples\n\nThis project uses [jsonpath-ng](https://github.com/h2non/jsonpath-ng) for JSONPath implementation.\n\n| Pattern | Result | Description | \n|---------|--------|-------------|\n| `foo[*].baz` | `[1, 2]` | Get all baz values | \n| `bar.items[*]` | `[10, 20, 30]` | Get all items | \n| `metadata.version` | `[\"1.0.0\"]` | Get version | \n\nFor complete JSONPath syntax reference, see the [jsonpath-ng documentation](https://github.com/h2non/jsonpath-ng#jsonpath-syntax).\n\n## 🚀 Performance Benefits\n\n- **Token Efficiency**: Extract only needed data, not entire JSON responses\n- **Faster Processing**: Smaller payloads = faster LLM responses  \n- **Reduced Hallucination**: Less irrelevant data = more accurate outputs\n- **Cost Savings**: Fewer tokens = lower API costs\n- **Better Focus**: Clean data helps models stay on task\n- **Smart Headers**: Default browser headers prevent blocking and improve access\n- **Markdown Conversion**: Clean, readable format that preserves structure\n\n## Configuration\n\nSet environment variables to customize behavior:\n\n```bash\n# Request timeout in seconds (default: 10.0)\nexport JSONRPC_MCP_TIMEOUT=30\n\n# SSL verification (default: true)\nexport JSONRPC_MCP_VERIFY=false\n\n# Follow redirects (default: true)\nexport JSONRPC_MCP_FOLLOW_REDIRECTS=true\n\n# Custom headers (will be merged with default browser headers)\nexport JSONRPC_MCP_HEADERS='{\"Authorization\": \"Bearer token\"}'\n\n# HTTP proxy configuration\nexport JSONRPC_MCP_PROXY=\"http://proxy.example.com:8080\"\n```\n\n**Default Browser Headers**: The server automatically includes realistic browser headers to prevent blocking:\n- User-Agent: Chrome browser simulation\n- Accept: Standard browser content types\n- Accept-Language, Accept-Encoding: Browser defaults\n- Security headers: Sec-Fetch-* headers for modern browsers\n\nCustom headers in `JSONRPC_MCP_HEADERS` will override defaults when there are conflicts.\n\n## Development\n\n```bash\n# Run tests\npytest\n\n# Check code quality\nruff check --fix\n\n# Build and test locally\nuv build\n```\n\n## What's New in v1.1.0\n\n- ✨ **Multi-Method HTTP Support**: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS\n- 🔄 **Tool Renaming**: `get-json` → `fetch-json`, `get-text` → `fetch-text` \n- 📄 **Markdown Conversion**: Default HTML to Markdown conversion with `markdownify`\n- 🌐 **Smart Browser Headers**: Automatic browser simulation headers\n- 🎛️ **Format Control**: Three output formats for text content (markdown, clean_text, raw_html)\n- 🚀 **Enhanced Batch Processing**: Support for different methods in batch operations","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fackness%2Ffetch-jsonpath-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fackness%2Ffetch-jsonpath-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fackness%2Ffetch-jsonpath-mcp/lists"}