JSON Path MCP Server
MCP server that provides tools to read JSON files and query data using jsonPath expressions.
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
Шаги установки
-
Клонирование или копирование проекта
cd C:\_Work\ML\MCPJSON\mcp-json -
Создание директории для данных
mkdir data mkdir logs -
Запуск через Docker Compose
docker-compose up -d -
Проверка работы
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")→100read_json_file("data/config.json")→ все данные
Безопасность
- Доступ к файлам ограничен директорией
data(монтируется как read-only) - Логи записываются в директорию
logs - Используется минимальный набор зависимостей
Технологии
- Python 3.11
- FastMCP - библиотека для создания MCP-серверов
- Docker - контейнеризация
- Docker Compose - оркестрация контейнеров
Лицензия
MIT License
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.