JSON Path MCP Server

JSON Path MCP Server

MCP server that provides tools to read JSON files and query data using jsonPath expressions.

Category
Visit Server

README

MCP-сервер для работы с JSON-файлами

Модельный контекстный протокол (MCP) сервер, который предоставляет инструменты для работы с JSON-файлами с использованием jsonPath.

Функциональность

Инструменты (Tools)

1. read_json_file

Читает JSON-файл и возвращает данные по указанному jsonPath.

Параметры:

  • file_path (str): Путь к JSON-файлу
  • json_path (str, optional): Опциональный jsonPath для получения конкретного значения
    • Примеры: "user.name", "items[0].price", "data.users[1].email"

Возвращает:

{
  "success": true,
  "data": {...},
  "file_path": "/path/to/file.json",
  "path_used": "user.name"
}

2. list_json_files

Перечисляет все JSON-файлы в указанной директории.

Параметры:

  • directory (str): Путь к директории для поиска JSON-файлов

Возвращает:

{
  "success": true,
  "files": ["/path/to/file1.json", "/path/to/file2.json"],
  "count": 2,
  "directory": "/path/to/dir"
}

Логирование

Все операции сервера логируются в файл mcp_json_server.log и выводятся в консоль.

Формат логов:

2024-01-01 12:00:00 - __main__ - INFO - Запрос на чтение JSON-файла: /app/data/config.json, jsonPath: user.name
2024-01-01 12:00:00 - __main__ - INFO - Успешно загружен JSON-файл: /app/data/config.json, размер: 1234 байт
2024-01-01 12:00:00 - __main__ - INFO - Успешно получено значение по jsonPath: user.name

Установка и запуск

Требования

  • Docker
  • Docker Compose

Шаги установки

  1. Клонирование или копирование проекта

    cd C:\_Work\ML\MCPJSON\mcp-json
    
  2. Создание директории для данных

    mkdir data
    mkdir logs
    
  3. Запуск через Docker Compose

    docker-compose up -d
    
  4. Проверка работы

    docker-compose logs -f
    

Остановка

docker-compose down

Перезапуск

docker-compose restart

Структура проекта

mcp-json/
├── main.py              # Основной файл MCP-сервера
├── requirements.txt     # Зависимости Python
├── Dockerfile           # Docker-образ
├── docker-compose.yml   # Конфигурация Docker Compose
├── .dockerignore        # Исключения для Docker
├── README.md            # Документация
├── data/                # Директория для JSON-файлов (создается вручную)
└── logs/                # Директория для логов (создается автоматически)

Использование jsonPath

Сервер поддерживает стандартный синтаксис jsonPath:

  • field - доступ к полю объекта
  • field.subfield - доступ к вложенному полю
  • array[0] - доступ к элементу массива по индексу
  • array[0].field - доступ к полю внутри элемента массива

Примеры

Если у вас есть JSON-файл data/config.json:

{
  "user": {
    "name": "John",
    "email": "john@example.com"
  },
  "items": [
    {"id": 1, "price": 100},
    {"id": 2, "price": 200}
  ]
}

Использование:

  • read_json_file("data/config.json", "user.name") → "John"
  • read_json_file("data/config.json", "items[0].price") → 100
  • read_json_file("data/config.json") → все данные

Безопасность

  • Доступ к файлам ограничен директорией data (монтируется как read-only)
  • Логи записываются в директорию logs
  • Используется минимальный набор зависимостей

Технологии

  • Python 3.11
  • FastMCP - библиотека для создания MCP-серверов
  • Docker - контейнеризация
  • Docker Compose - оркестрация контейнеров

Лицензия

MIT License

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured