Tutorials/Intermediate
Intermediate30 minMCP

Give an AI agent grounded Mappls tools

Run the MCP server, scope credentials, call search and routing tools, and inspect provenance.

By the endAn agent that can reason about real places without inventing APIs.

Build against an explicit contract

An assistant must research solutions and answer place or routing questions with governed Mappls tools instead of invented endpoints or unapproved live-location access.

A Mappls developer projectA restricted MCP applicationFixture data with no production credentialsA request, aggregate, or correlation ID strategy
Step 1

Define the user and system contract

An assistant must research solutions and answer place or routing questions with governed Mappls tools instead of invented endpoints or unapproved live-location access. Record the region, data freshness, latency budget, privacy purpose, credential owner, and fallback before choosing an SDK or endpoint.

Step 2

Choose and isolate the transport

Start with the downloadable Spatial Operations Agent in fixture mode. Use its local stdio client for a same-host server or authenticated Streamable HTTP client for a remote resource. Keep inbound and provider credentials independent; the client accepts an absolute stdio entrypoint or exact HTTPS MCP URL, never a shell string or credential-bearing URL.

AI & Location · SDK or product slice
const nearbyPlacesTool = {
  name: "mappls_search_nearby",
  description: "Find real places near a validated Mappls Pin or coordinate.",
  inputSchema: {
    type: "object",
    required: ["location", "category"],
    properties: {
      location: { type: "string", description: "Mappls Pin or 'lat,lng'." },
      category: { type: "string" },
      radiusMeters: { type: "integer", minimum: 50, maximum: 10_000 }
    }
  }
};
Step 3

Prove offline research first

Select solution_research and the offline profile. Negotiate advertised tools, retrieve capability and deterministic industry/platform plans without a provider credential, require explicit catalog provenance, and make unavailable live tools a visible state.

Use the normalized source contract below as the executable boundary. Switch tabs to compare credential-safe languages without changing the operation.

GET /models
curl --request GET \
  --url 'https://ai.mappls.com/models' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Inspect parameters, responses, and source fingerprint
Step 4

Bind live-read authority

Deploy live-read separately. Validate asymmetric signature, exact issuer and resource audience, subject, client, expiry, and profile scope. Keep provider credentials only in the MCP workload and publish protected-resource metadata without issuing tokens from the MCP service.

Step 5

Bound every result

Allow-list planned tools, cap arguments, request time, transport buffers, and structured output, reject gateway-token reflection, and require valid provider provenance from live tools.

Step 6

Separate plan, approval, and execution

Hash the proposed tool plan, require approval for sensitive scopes, expire approval, reject any execution whose plan or arguments changed, and close the client on shutdown.

Step 7

Ground the answer

Store tool-call evidence without secrets, cite the provider or catalog result used for each claim, and surface uncertainty or unavailable tools instead of fabricating data.

Step 8

Prove the production behavior

Automate the happy path and every named failure. The release is ready only when fixture, real stdio, and remote http paths preserve one client contract; offline solution research completes without provider credentials; both real transports negotiate the intended read-only profile; wrong-audience, expired, insufficient-scope, hidden-tool, oversized-output, and token-reflection paths fail closed; unapproved plans cannot execute; every location claim has tool provenance; tool and gateway errors redact credentials and response bodies. Capture provider request identity without logging credentials or unnecessary precise location.

Failure modes you must exercise

remote client is rejected by auth, URL, host, origin, size, or capacity controls

Fail fast with a typed, user-safe outcome and preserve the original request identity.

authorization-server lifecycle or revocation is unavailable

Keep the last verified state, mark freshness honestly, and retry only within the documented idempotency boundary.

configured profile does not advertise a planned tool

Reconcile durable local and provider evidence before declaring success or issuing a compensating command.

approval expires before execution

Reconcile durable local and provider evidence before declaring success or issuing a compensating command.

provider result lacks provenance or conflicts with prior context

Reconcile durable local and provider evidence before declaring success or issuing a compensating command.

Never turn uncertainty into success

Timeout after a stateful command is an unknown outcome. Query by provider/idempotency identity or wait for authoritative events; do not blindly retry a new command.

Definition of done

fixture, real stdio, and remote HTTP paths preserve one client contractoffline solution research completes without provider credentialsboth real transports negotiate the intended read-only profilewrong-audience, expired, insufficient-scope, hidden-tool, oversized-output, and token-reflection paths fail closedunapproved plans cannot executeevery location claim has tool provenancetool and gateway errors redact credentials and response bodies

MCP production checks

Tools expose the least authority neededState-changing calls require explicit policy and approvalResponses identify source, freshness, and uncertaintyEvery tool call is tenant-scoped, metered, redacted, and traceable

Continue from source, contracts, and a full app

These links resolve to repository-derived evidence; unsupported package names and endpoints are not filled in from guesswork.

Study the complete Coordinated incident response state machine

Run it, break it, then observe it

Start with fixture credentials, execute the failure plan, and use request logs, usage, webhook evidence, and operational metrics before promoting traffic.