Italian Cities MCP Server
Provides CRUD tools for managing a database of Italian cities backed by Elasticsearch. It enables AI assistants to search, create, update, and delete city records through a standardized Model Context Protocol interface.
README
Italian Cities MCP Server
A Model Context Protocol (MCP) server for managing Italian cities with CRUD operations backed by Elasticsearch.
Architecture
The project consists of three main components:
- Elasticsearch Database: Stores Italian cities data with a simple schema (city name only)
- CRUD API Server: Express.js REST API for managing cities
- MCP Server: MCP interface that communicates with the CRUD API to provide tools for AI assistants
┌─────────────────┐
│ MCP Server │
│ (stdio mode) │
└────────┬────────┘
│ HTTP
▼
┌─────────────────┐
│ CRUD API │
│ (Express.js) │
└────────┬────────┘
│ REST
▼
┌─────────────────┐
│ Elasticsearch │
│ (Database) │
└─────────────────┘
Prerequisites
- Node.js 20+
- Docker and Docker Compose
- npm or yarn
Installation
- Clone the repository and install dependencies:
npm install
- Create environment file:
cp .env.example .env
- Build the TypeScript code:
npm run build
Running with Docker
Start all services (Elasticsearch + CRUD API)
npm run docker:up
This will:
- Start Elasticsearch on port 9200
- Start the CRUD API on port 3000
- Create the index and initialize the database with 30 Italian cities
Check logs
npm run docker:logs
Stop services
npm run docker:down
Running Locally (Development)
Option 1: Docker for Elasticsearch only
- Start only Elasticsearch:
docker-compose up -d elasticsearch
- Run the CRUD API in development mode:
npm run dev:api
Option 2: All local (requires local Elasticsearch)
Ensure Elasticsearch is running locally on port 9200, then:
npm run dev:api
CRUD API Endpoints
The API server runs on http://localhost:3000 by default.
Health Check
GET /health
Cities Endpoints
-
Create a city
POST /api/cities Content-Type: application/json {"nome": "Venezia"} -
Get all cities
GET /api/cities -
Get city by ID
GET /api/cities/:id -
Search cities by name
GET /api/cities/search/:name -
Update a city
PUT /api/cities/:id Content-Type: application/json {"nome": "Venezia Mestre"} -
Delete a city
DELETE /api/cities/:id
MCP Server
Running the MCP Server
For development (with auto-reload):
npm run dev:mcp
For production:
npm run start:mcp
Configuring in Claude Desktop
Add this to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"varolio-cities": {
"command": "node",
"args": [
"/absolute/path/to/varolio/dist/mcp-server/index.js"
]
}
}
}
Or for development with tsx:
{
"mcpServers": {
"varolio-cities": {
"command": "npx",
"args": [
"tsx",
"/absolute/path/to/varolio/src/mcp-server/index.ts"
]
}
}
}
Important: Ensure the CRUD API server is running before using the MCP server.
MCP Tools
The MCP server provides the following tools:
1. create_city
Create a new Italian city in the database.
Parameters:
nome(string, required): Name of the Italian city
Example:
Create a new city called "Siena"
2. list_cities
List all Italian cities in the database.
Example:
Show me all cities in the database
3. get_city
Get a specific Italian city by ID.
Parameters:
id(string, required): ID of the city
Example:
Get the city with ID "abc123"
4. search_cities
Search for Italian cities by name (supports fuzzy matching).
Parameters:
name(string, required): Name or partial name to search
Example:
Search for cities named "Milan"
5. update_city
Update an existing Italian city name.
Parameters:
id(string, required): ID of the city to updatenome(string, required): New name for the city
Example:
Update city with ID "abc123" to "Milano"
6. delete_city
Delete an Italian city from the database.
Parameters:
id(string, required): ID of the city to delete
Example:
Delete the city with ID "abc123"
Database Initialization
The database is automatically initialized with 30 major Italian cities when the CRUD API starts for the first time. Cities include: Roma, Milano, Napoli, Torino, Palermo, Genova, Bologna, Firenze, and more.
To manually reinitialize the database:
npm run init:db
Project Structure
varolio/
├── src/
│ ├── types/ # TypeScript type definitions
│ ├── elasticsearch/ # Elasticsearch client and utilities
│ ├── crud-api/ # Express.js REST API
│ └── mcp-server/ # MCP server implementation
├── data/
│ └── init-cities.json # Initial cities data
├── docker-compose.yml # Docker orchestration
├── Dockerfile # Node.js backend container
├── package.json # Dependencies and scripts
└── tsconfig.json # TypeScript configuration
Environment Variables
ELASTICSEARCH_HOST: Elasticsearch host URL (default: http://localhost:9200)ELASTICSEARCH_INDEX: Index name for cities (default: citta_italiane)API_PORT: CRUD API port (default: 3000)API_HOST: CRUD API host (default: localhost)NODE_ENV: Node environment (default: development)
Development
Watch mode for API
npm run dev:api
Watch mode for MCP server
npm run dev:mcp
Build TypeScript
npm run build
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。