Opencage MCP server for AI agents and assistants

Securely connect your AI agents and chatbots (Claude, ChatGPT, Cursor, etc) with Opencage MCP or direct API to perform forward geocoding, reverse geocoding, bulk address lookups, and coordinate data enrichment through natural language.

Opencage logoOpencage
Api Key

Opencage is a geocoding service that turns addresses into coordinates and vice versa. It helps apps and agents get precise location data from open sources worldwide.

7 Tools

Try Opencage now

Type what you want done — sign in and watch it run live in the Tool Router playground.

TOOL ROUTER PLAYGROUND
Opencage
Try asking
TOOLS

Supported Tools

Every Opencage action and event your agent gets out of the box.

Forward Geocode Address

Geocode an address or place name to find geographic coordinates and related location details.

Geocode to GeoJSON

Geocode addresses or coordinates and return results in GeoJSON FeatureCollection format.

Geocode with JSONP

Geocode an address and return results wrapped in a JavaScript callback function (JSONP format).

Geocode Google v3 JSON

Request forward geocoding in OpenCage's Google v3-compatible JSON format for legacy integrations.

Reverse Geocode Coordinates

Reverse geocode a latitude and longitude to find a readable location and address details.

Geocode XML

Geocode a location query and return results in XML format.

Check API Health

Tool to check API health and connectivity.

SETUP GUIDE

Connect Opencage MCP Tool with your Agent

1

Install Composio

typescript
npm install @composio/core ai @ai-sdk/mcp @ai-sdk/openai
Install the Composio SDK and your agent framework
2

Create a session with MCP enabled

typescript
import { Composio } from "@composio/core";

const composio = new Composio();
const { mcp } = await composio.create("your-user-id", {
  toolkits: ["opencage"],
  mcp: true,
});
Create a session scoped to Opencage and read its MCP URL and headers
3

Connect your agent to the MCP server

typescript
import { createMCPClient } from "@ai-sdk/mcp";
import { openai } from "@ai-sdk/openai";
import { generateText, stepCountIs } from "ai";

const client = await createMCPClient({
  transport: { type: "http", url: mcp.url, headers: mcp.headers },
});

const { text } = await generateText({
  model: openai("gpt-5.6-sol"),
  tools: await client.tools(),
  prompt: "Get the latitude and longitude for \"1600 Amphitheatre Parkway, Mountain View, CA\"",
  stopWhen: stepCountIs(10),
});

console.log(text);
await client.close();
Pass the session's MCP URL and headers to your agent and run a Opencage request
SETUP GUIDE

Connect Opencage API Tool with your Agent

1

Install Composio

typescript
npm install @composio/core @composio/openai openai
Install the Composio SDK, the OpenAI provider, and the OpenAI SDK
2

Create a Composio session

typescript
import OpenAI from "openai";
import { Composio } from "@composio/core";
import { OpenAIResponsesProvider } from "@composio/openai";

const composio = new Composio({ provider: new OpenAIResponsesProvider() });
const client = new OpenAI();

const session = await composio.create("your-user-id", { toolkits: ["opencage"] });
const tools = await session.tools();
Initialize Composio with the OpenAI Responses provider and create a session scoped to Opencage
3

Run Opencage tools with your agent

typescript
let response = await client.responses.create({
  model: "gpt-5.6-sol",
  tools,
  input: [{ role: "user", content: "Get the latitude and longitude for \"1600 Amphitheatre Parkway, Mountain View, CA\"" }],
});

while (response.output.some((o) => o.type === "function_call")) {
  const outputs = await composio.provider.handleToolCalls(session, response.output);
  response = await client.responses.create({
    model: "gpt-5.6-sol",
    tools,
    previous_response_id: response.id,
    input: outputs,
  });
}

console.log(response.output_text);
Send a request, execute the Opencage tool calls through the session, and print the final answer

Why Use Composio?

AI Native Opencage Integration

  • Supports both Opencage MCP and direct API based integrations
  • Structured, LLM-friendly schemas for reliable tool execution
  • Rich coverage for converting addresses to coordinates and vice versa

Managed Auth

  • Built-in API key storage and rotation—no more manual key handling
  • Central place to manage, scope, and revoke Opencage access
  • Per user and per environment credentials—ditch hard-coded keys

Agent Optimized Design

  • Tools tuned for high success, low error rates in real-world agent workflows
  • Comprehensive execution logs so you always know what location queries ran and when

Enterprise Grade Security

  • RBAC so you control which agents or users can access Opencage
  • Scoped, least privilege access to geocoding endpoints
  • Full audit trail of location queries for compliance and review

Rolling this out across your team?

Give your team centralized access control across every framework with Composio’s MCP Gateway.

EXPLORE MCP GATEWAY
FAQ

Frequently asked questions

Start with Opencage.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Opencage tool your agent needs.Free to start.

Start building