MCP Server Development, Demystified with a macOS Maps Search Tool
MCP is the protocol that lets AI assistants call external tools, and a working server can be written in a few dozen lines. This example gives developers a clear template for turning any local command or script into a model-invocable tool, without needing a cloud API key.
MCP (Model Context Protocol) is the wire protocol that lets AI models call external tools. This example walks through a complete MCP server that opens Apple Maps for a location query. The server registers a single tool `search_map`, which takes a `query` string. When an AI assistant receives a request like 'Search West Lake scenic area in the map', it invokes the tool, and the server builds an Apple Maps URL and hands it to the system's `open` command, bringing the Maps app to the foreground.
The code is split into three files: `package.json` points to the entry `src/index.js`, which uses the official `@modelcontextprotocol/server` SDK and Zod for parameter definitions. `src/maps.js` contains only the map-specific logic, keeping the protocol layer separate. Configuration in Cursor is done via `.cursor/mcp.json`, either project-level or user-level. Publishing to npm is straightforward: `npm login` and `npm publish`, after which users can run it via `npx -y local-maps-mcp` or a global install.
The example deliberately keeps tooling minimal, showing that MCP servers don't require complex infrastructure. The use of the system's `open` command means no API key is needed, and it works entirely on the local machine. The article also covers the distinction between project-level and user-level MCP configuration, which is useful when working across multiple environments.
The separation between protocol handling and business logic in this example (index.js vs maps.js) is a pattern that scales to more complex MCP servers.
Using system commands like `open` avoids API key overhead but ties the tool to macOS, showing the trade-off between simplicity and portability.