mcp-server
MCP Server — Сервер инструментов для ИИ
Образовательный проект, демонстрирующий, как ИИ может подключаться к серверу для выполнения реальных действий в операционной системе.
Что это за проект?
Этот проект имитирует MCP Server (Model Context Protocol Server) — HTTP-сервер, который предоставляет инструменты (tools), вызываемые искусственным интеллектом удаленно.
Основная идея проста: ИИ не выполняет команды в операционной системе напрямую. Вместо этого он отправляет HTTP-запрос на этот сервер с просьбой выполнить инструмент. Сервер получает запрос, выполняет его и возвращает результат.
IA → POST /tool { "tool": "get_ip" } → MCP Server → Sistema Operacional
IA ← { "success": true, "result": { "ips": [...] } } ← MCP ServerRelated MCP server: sshand
Цель проекта
Продемонстрировать архитектуру клиент-сервер применительно к ИИ
Показать, как инструменты могут динамически регистрироваться и выбираться
Служить базой для обучения для более крупных проектов
Быть простым для понимания, модификации и презентации
Используемый стек
Технология | Использование |
Node.js | Среда выполнения JavaScript |
Express.js | HTTP-фреймворк |
fs, os, path | Встроенные модули Node |
child_process | Выполнение системных команд |
Структура папок
mcp-server/
│
├── src/
│ ├── server.js ← Ponto de entrada — inicia o servidor
│ ├── routes/
│ │ └── tools.routes.js ← Define as rotas HTTP
│ ├── controllers/
│ │ └── tools.controller.js ← Valida o input e chama o serviço
│ ├── services/
│ │ └── tools.service.js ← Registry de tools + lógica de seleção
│ ├── tools/
│ │ ├── getIp.js ← Tool: retorna o IP da máquina
│ │ ├── getHostname.js ← Tool: retorna o hostname
│ │ ├── listFiles.js ← Tool: lista arquivos de um diretório
│ │ ├── createFile.js ← Tool: cria um arquivo
│ │ └── pingHost.js ← Tool: faz ping em um host
│ └── utils/
│ └── response.js ← Padroniza respostas JSON
│
├── docs/
│ ├── README.md ← Este arquivo
│ └── AI_CONTEXT.md ← Contexto arquitetural para IAs
│
├── package.json
└── .gitignoreКак установить
Предварительное требование: Установленный Node.js (рекомендуется версия 18 или выше).
# Clone ou copie o projeto para sua máquina
cd mcp-server
# Instale as dependências
npm installКак запустить
# Modo normal
npm start
# Modo desenvolvimento (reinicia ao salvar arquivos — Node 18+)
npm run devСервер запустится на порту 3000 по умолчанию.
Чтобы использовать другой порт:
PORT=8080 npm startКак проверить работоспособность
Перейдите в браузере или используйте curl:
curl http://localhost:3000/healthОжидаемый ответ:
{ "status": "ok", "message": "MCP Server rodando" }Как использовать — API
Существует два основных эндпоинта: один для перечисления инструментов, другой для их выполнения.
Список доступных инструментов
Возвращает все инструменты, зарегистрированные на сервере, с их полными схемами (описание и параметры). Этот формат облегчает интеграцию с ИИ (Tool Calling).
GET http://localhost:3000/toolsОтвет:
{
"success": true,
"result": [
{
"name": "create_file",
"description": "Cria um arquivo dentro da pasta /files.",
"parameters": {
"type": "object",
"properties": {
"filename": { "type": "string", "description": "..." },
"content": { "type": "string", "description": "..." }
},
"required": ["filename"]
}
}
]
}Выполнение инструмента
POST http://localhost:3000/tool
Content-Type: application/jsonФормат запроса
{
"tool": "nome_da_tool",
"args": {
"parametro": "valor"
}
}Доступные инструменты
get_ip
Возвращает локальные IP-адреса машины.
Запрос:
{ "tool": "get_ip", "args": {} }get_hostname
Возвращает имя хоста, платформу и архитектуру машины.
Запрос:
{ "tool": "get_hostname", "args": {} }list_files
Выводит список файлов и директорий по указанному пути. Если path опущен, используется текущая директория процесса.
Запрос:
{ "tool": "list_files", "args": { "path": "/home/user" } }create_file
Создает файл внутри папки /files в корне сервера. Эта папка работает как песочница для организации созданных файлов.
Запрос:
{
"tool": "create_file",
"args": {
"filename": "teste.txt",
"content": "Olá, MCP!"
}
}ping_host
Выполняет ping хоста или IP и возвращает результат. Безопасность: Для предотвращения инъекций команд в имени хоста разрешены только буквенно-цифровые символы, точки и дефисы.
Запрос:
{ "tool": "ping_host", "args": { "host": "8.8.8.8" } }Тестирование с помощью curl
# get_ip
curl -X POST http://localhost:3000/tool \
-H "Content-Type: application/json" \
-d '{"tool": "get_ip", "args": {}}'
# list_files
curl -X POST http://localhost:3000/tool \
-H "Content-Type: application/json" \
-d '{"tool": "list_files", "args": {"path": "/tmp"}}'
# create_file
curl -X POST http://localhost:3000/tool \
-H "Content-Type: application/json" \
-d '{"tool": "create_file", "args": {"filename": "ola.txt", "content": "Olá mundo!"}}'
# ping_host
curl -X POST http://localhost:3000/tool \
-H "Content-Type: application/json" \
-d '{"tool": "ping_host", "args": {"host": "8.8.8.8"}}'Полный поток — ИИ → MCP → Система
1. IA decide que precisa saber o IP da máquina
2. IA envia: POST /tool { "tool": "get_ip", "args": {} }
3. Express recebe a requisição
4. Route encaminha para o Controller
5. Controller valida o body e chama o Service
6. Service consulta o Registry e encontra a função getIp
7. getIp() usa o módulo "os" para ler as interfaces de rede
8. Resultado sobe de volta: getIp → Service → Controller → Response
9. IA recebe: { "success": true, "result": { "ips": [...] } }
10. IA usa o resultado para continuar sua tarefaВозможные улучшения в будущем
Добавить аутентификацию через API Key
Реализовать логирование вызовов (кто вызвал какой инструмент и когда)
Добавить поддержку WebSocket для потоковых результатов
Интегрировать с локальными моделями ИИ (Ollama, LM Studio)
Добавить новые инструменты: чтение CPU/памяти, выполнение скриптов и т.д.
Создать пример клиента, имитирующего ИИ, вызывающий инструменты
Замечания по безопасности
Этот проект является образовательным. Для использования в продакшене потребуется:
Аутентификация на маршрутах
Белый список путей для
list_filesиcreate_fileОграничение частоты запросов (Rate limiting)
Более надежная санитаризация входных данных
HTTPS
Проект разработан в академических и демонстрационных целях.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA modular MCP server providing file operations, web search, URL scraping, and sandboxed command execution for LLM interactions.Last updated1MIT
- AlicenseAqualityAmaintenanceAn open MCP server that gives any AI agent SSH access to remote Linux/Unix machines — shell commands, file read/write, and SFTP transfers.Last updated111MIT
- FlicenseAqualityCmaintenanceA simple MCP server that exposes a terminal tool, allowing AI agents to execute shell commands.Last updated1
- Alicense-qualityCmaintenanceA free, open-source MCP server that gives AI agents real filesystem, terminal, git, and process control over your machine for inspection, diagnosis, and repair.Last updatedMIT
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Gagocode/mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server