Skip to main content

MapTech MCP Server (Python) - stdio transport for Cursor / Claude Desktop

Project description

mcp-server-maptec

Maptec的webapi服务已全面兼容MCP协议。 Maptec MCP Server支持10个LBS服务能力,包含了地点检索、周边检索、输入提示、地点详情、地理编码、逆地理编码、路线规划、距离矩阵、轨迹纠偏、IP定位。

环境变量

变量 默认值 说明
MAPTEC_API_KEY 必填mp_1_... 格式
MAPTEC_BASE_URL https://api.maptec.cn WebAPI 地址
MAPTEC_TIMEOUT_MS 30000 HTTP 超时(毫秒)

快速开始

1. 注册账号并申请 AK

前往 Maptec 开发者中心 注册账号,创建应用并申请 API Key(AK,mp_1_... 格式)。

2. 安装 Python 包

推荐使用 uv 一键运行(无需预先安装):

uvx mcp-server-maptec

或通过 pip 安装:

pip install mcp-server-maptec

安装后可执行:mcp-server-maptecmaptec-mcp-python(二者等价)。

3. 在 Cursor 中配置 MCP

以 Cursor 为例,在其 MCP 配置中加入以下内容,填入上一步申请的 API Key 后保存,进入 Settings → MCP → Reload

{
  "mcpServers": {
    "maptec": {
      "command": "uvx",
      "args": ["mcp-server-maptec@1.0.1"],
      "env": {
        "MAPTEC_API_KEY": "mp_1_YOUR_KEY",
        "MAPTEC_BASE_URL": "https://api.maptec.cn"
      }
    }
  }
}

确认 maptec 为绿点 Connected,展开可见 10 个 Tool。

上述 mcpServers 为 MCP stdio 通用配置,Claude Desktop、Cline、Windsurf 等支持 MCP 的客户端同样适用,差异仅在于配置文件位置与重载方式。

4. 应用场景示例:第三方智能体调用 MCP 查询美食

除 Cursor 等 IDE 外,任何支持 MCP 的第三方智能体(如基于 LangChain、OpenAI Agents SDK、Claude Agent、或自研 Agent 框架)都可通过官方 MCP 客户端以 stdio 方式拉起本服务,把 10 个 LBS Tool 暴露给大模型自动编排。下面以「查询美食」为例。

第三方 Agent 接入(stdio 启动 + 传入 API Key):

以官方 MCP Python SDK 为例,Agent 在初始化时以子进程方式拉起 MCP Server,随后 list_tools() 拿到工具清单交给大模型:

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
    server_params = StdioServerParameters(
        command="uvx",
        args=["mcp-server-maptec@1.0.1"],
        env={
            "MAPTEC_API_KEY": "mp_1_YOUR_KEY",
            "MAPTEC_BASE_URL": "https://api.maptec.cn",
        },
    )
    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # 交给大模型:把工具清单作为 function/tool 列表
            tools = await session.list_tools()

            # 大模型决定调用某个工具时:
            result = await session.call_tool(
                "map_search_nearby",
                arguments={
                    "query": "火锅",
                    "locationLimit": {
                        "center": {"latitude": 1.3048, "longitude": 103.8318},
                        "radius": 2000,
                    },
                    "resultLimit": 5,
                    "region": "SG",
                },
            )
            print(result)

asyncio.run(main())

Node.js 智能体同理:用 @modelcontextprotocol/sdkStdioClientTransportcommand/args/env 改为 npx -y @maptec/mcp-server-node 即可。

用户提问(发给第三方智能体):

我在新加坡乌节路附近,想找评分高的火锅店,推荐几家,并告诉我从这里去最近一家怎么走。

Agent 编排流程:

sequenceDiagram
    participant U as 用户
    participant LLM as 智能体大模型
    participant MCP as Maptec MCP
    U->>LLM: 找乌节路附近评分高的火锅店并给出路线
    LLM->>MCP: map_search_geocode(乌节路)
    MCP-->>LLM: 坐标
    LLM->>MCP: map_search_nearby(火锅, center, resultLimit)
    MCP-->>LLM: POI 列表(placeId...)
    LLM->>MCP: map_search_places(placeId)
    MCP-->>LLM: 店铺详情
    LLM->>MCP: map_routes_directions(origin, destination, walking)
    MCP-->>LLM: 步行路线
    LLM-->>U: 自然语言推荐 + 导航

关键工具调用示例:

  1. map_search_geocode 把地址转为坐标:
{
  "address": "乌节路, 新加坡",
  "region": "SG"
}
  1. map_search_nearby 以坐标为中心检索周边火锅店:
{
  "query": "火锅",
  "locationLimit": {
    "center": { "latitude": 1.3048, "longitude": 103.8318 },
    "radius": 2000
  },
  "resultLimit": 5,
  "region": "SG"
}
  1. map_search_places 取 Top 店铺详情,placeId 来自上一步结果:
{
  "placeId": "PLACE_ID_FROM_NEARBY",
  "language": "zh-CN",
  "region": "SG"
}
  1. map_routes_directions 规划到最近一家的步行路线:
{
  "origin": { "latitude": 1.3048, "longitude": 103.8318 },
  "destination": { "latitude": 1.3021, "longitude": 103.8360 },
  "mode": "walking"
}

Agent 最终回答示例:

已为你找到乌节路附近 3 家评分较高的火锅店:

  1. 海底捞火锅(ION Orchard)— 评分 4.6,营业至 22:30,步行约 6 分钟;
  2. 小龙坎老火锅(313@Somerset)— 评分 4.5,营业至 23:00,步行约 9 分钟;
  3. 谭鸭血老火锅(Orchard Central)— 评分 4.4,营业至 22:00,步行约 11 分钟。

最近的是海底捞(ION Orchard),从你当前位置沿乌节路向东步行约 450 米、6 分钟即可到达。

以上全部由大模型自动调用 MCP 工具完成,用户无需关心任何接口参数。

Tool 列表

Tool 说明
map_search_text 关键字检索
map_search_nearby 周边检索
map_search_suggest 输入提示
map_search_places 地点详情
map_search_geocode 地理编码
map_search_reverse 逆地理编码
map_routes_directions 路线规划
map_matrix_distance 距离矩阵
map_track_snap_to_roads 轨迹纠偏
map_location_ip IP 定位

License

MIT © 2026 Maptec

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server_maptec-1.0.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_maptec-1.0.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_maptec-1.0.1.tar.gz.

File metadata

  • Download URL: mcp_server_maptec-1.0.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for mcp_server_maptec-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e97bcc0728343e12be003bf0fff9724ada8c6f3ceb6c1bc0ae6f1c4593fec0bb
MD5 00b7558117c46f80206048b756a6439e
BLAKE2b-256 76a594b81a645e44326b517d250033d333d25248ef3a02a40105abaec58244af

See more details on using hashes here.

File details

Details for the file mcp_server_maptec-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_maptec-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 471354f514275d950ea085e834f491d35332dbfe12fcd510315d037faca28009
MD5 ca48059c67b2194a9f41a6f75945cc89
BLAKE2b-256 08072bee33fc59c2468c7091a65201070b23e12a993a465245b1c844d5a6b6d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page