This example shows how to use an app generation prompt to create a JavaScript or Python client application to access MCP for ArcGIS Location Services. The application is responsible for establishing a connection to the MCP server and invoking the available tools including geocoding, reverse geocoding, routing, and elevation.

No mapping library is needed for this example and the application generates static map images from the MCP server to display results.

Interactive Map Example

Resulting static map application built using MCP for ArcGIS Location Services.

Prerequisites

Your MCP client must be properly configured to access MCP for ArcGIS Location Services. For setup instructions, go to Get started.

Example

Run the following prompt to build the application. Use the dropdown to select the language you want to use.

Node.js Node.js Python
Build a standalone Node.js + Express static map app using MCP for ArcGIS Location Services.
Create:
- server.js
- package.json
- mcp.example.json
- README.md
- public/index.html
- public/app.js
- public/styles.css
Core features:
- Geocode (find_address_candidates)
- Reverse geocode (reverse_geocode)
- Route solve (solve_route)
- Elevation (elevation_at_locations)
- Static map rendering via MCP:
- map_with_points (points)
- map_with_polyline (routes)
MCP requirements:
- Read mcp.json from local folder, fallback to ../mcp.json
- Use servers.alp-mcp-server.url + headers
- JSON-RPC initialize + tools/call
- Support JSON and SSE responses
- Normalize errors/output
API endpoints:
- GET /api/health
- GET /api/tools
- POST /api/geocode
- POST /api/reverse
- POST /api/route
- POST /api/elevation
- POST /api/static-map
Map/render behavior:
- Use MCP image output only (base64 PNG)
- Blue circle markers from MCP args (not client overlays)
- Marker color 3284FF, scale 0.5
- Route style: line color 4285F4, width 5, blue start/end markers scale 0.5
- If route has >1024 vertices, simplify/downsample before map_with_polyline
Zoom/layout/UX:
- Zoom slider 1-22
- Convert zoom to radius on server (effective zoom = zoom - 2, clamped)
- For route maps, prefer polyline fit + padding instead of forced radius
- Responsive split layout: controls + result panel + map viewport
- Busy overlay while requests run; disable controls during requests
Run:
- express dependency
- scripts: start/dev = node server.js
- default port 3001 with PORT override
Acceptance:
- All operations work end-to-end
- Route displays reliably even when original route geometry exceeds 1024 vertices
- Navigation and navigation-night styles work
- Zoom, busy indicator, and responsive layout behave correctly

The agent should:

  • Create a folder containing the application.
  • Provide instructions on how to run the application.
  • Implement a custom connector to MCP for ArcGIS Location Services using the provided URL and access token.
  • Use the connector to call MCP tools for geocoding, reverse geocoding, routing, and elevation based on user input.
  • Generate and display static map images from MCP-driven results instead of using an interactive map.
  • Ask the user for missing implementation decisions before writing code.