crewai-mapmap 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""MapMap tools for CrewAI agents.
|
|
2
|
+
|
|
3
|
+
A thin wrapper over ``crewai-tools``' ``MCPServerAdapter`` that connects to
|
|
4
|
+
the hosted MapMap MCP server (https://mcp.mapmap.ai/mcp) and yields every
|
|
5
|
+
tool it registers (route, check_adr_tunnel, geocode, matrix, optimise_routes,
|
|
6
|
+
plan_day, reachable_area, nearby_places, start_navigation, check_navigation_progress,
|
|
7
|
+
end_navigation, place_entrances, map styling, local geometry) as
|
|
8
|
+
CrewAI tools. Whatever ``tools/list`` answers is what you get, so this
|
|
9
|
+
wrapper does not name a count that a release could leave behind.
|
|
10
|
+
|
|
11
|
+
No key is needed to connect (fair use). For metered volume, get a card-free
|
|
12
|
+
key in one call (POST https://api.mapmap.ai/v1/keys) and pass it as
|
|
13
|
+
``api_key``.
|
|
14
|
+
|
|
15
|
+
Data rights: agents may cache, store, index and train on MapMap responses,
|
|
16
|
+
forever. See https://mapmap.ai/.well-known/agent-terms.json.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from typing import Any
|
|
22
|
+
|
|
23
|
+
from crewai_tools import MCPServerAdapter
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"MAPMAP_MCP_URL",
|
|
27
|
+
"mapmap_server_params",
|
|
28
|
+
"mapmap_tools",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
__version__ = "0.1.0"
|
|
32
|
+
|
|
33
|
+
MAPMAP_MCP_URL = "https://mcp.mapmap.ai/mcp"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def mapmap_server_params(
|
|
37
|
+
url: str = MAPMAP_MCP_URL,
|
|
38
|
+
api_key: str | None = None,
|
|
39
|
+
) -> dict[str, Any]:
|
|
40
|
+
"""Server parameters for ``MCPServerAdapter`` pointing at MapMap.
|
|
41
|
+
|
|
42
|
+
Use this directly if you want to combine MapMap with other MCP servers
|
|
43
|
+
in one adapter; otherwise :func:`mapmap_tools` is all you need.
|
|
44
|
+
"""
|
|
45
|
+
params: dict[str, Any] = {"url": url, "transport": "streamable-http"}
|
|
46
|
+
if api_key:
|
|
47
|
+
params["headers"] = {"Authorization": f"Bearer {api_key}"}
|
|
48
|
+
return params
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def mapmap_tools(
|
|
52
|
+
url: str = MAPMAP_MCP_URL,
|
|
53
|
+
api_key: str | None = None,
|
|
54
|
+
) -> MCPServerAdapter:
|
|
55
|
+
"""MapMap's MCP tools as a CrewAI ``MCPServerAdapter``.
|
|
56
|
+
|
|
57
|
+
Use as a context manager so the MCP session is cleanly closed::
|
|
58
|
+
|
|
59
|
+
with mapmap_tools() as tools:
|
|
60
|
+
agent = Agent(..., tools=tools)
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
url: MCP endpoint. Defaults to the hosted server; point it at your
|
|
64
|
+
self-hosted gateway's ``:8200/mcp`` to use your own deployment.
|
|
65
|
+
api_key: Optional MapMap API key (``snk_...``) sent as a bearer
|
|
66
|
+
token for metered calls.
|
|
67
|
+
"""
|
|
68
|
+
return MCPServerAdapter(mapmap_server_params(url, api_key))
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: crewai-mapmap
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MapMap tools for CrewAI agents: car, truck and ADR routing, geocoding, places, matrices, isochrones and map styling through the hosted MapMap MCP server.
|
|
5
|
+
Project-URL: Homepage, https://mapmap.ai/agents
|
|
6
|
+
Project-URL: Documentation, https://mapmap.ai/docs/mcp
|
|
7
|
+
Project-URL: Agent data rights, https://mapmap.ai/.well-known/agent-terms.json
|
|
8
|
+
Author-email: Mapmap AI Ltd <hello@mapmap.ai>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: adr,agents,crewai,geocoding,mapmap,maps,mcp,routing,truck-routing
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: crewai-tools[mcp]>=0.45.0
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
25
|
+
Requires-Dist: uvicorn>=0.30; extra == 'test'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# crewai-mapmap
|
|
29
|
+
|
|
30
|
+
MapMap tools for CrewAI agents: routing for cars, trucks, bikes and walking,
|
|
31
|
+
truck routing with ADR dangerous-goods restrictions, geocoding, travel-time matrices, isochrones,
|
|
32
|
+
multi-stop day planning and hosted map styling, exposed through the hosted
|
|
33
|
+
[MapMap MCP server](https://mapmap.ai/docs/mcp).
|
|
34
|
+
|
|
35
|
+
The hosted server connects without a key for evaluation, under fair use. For
|
|
36
|
+
metered volume an agent gets a card-free key in one API call (see "With a
|
|
37
|
+
key" below). Responses may be cached, stored, indexed and used for training;
|
|
38
|
+
the machine-readable terms are at
|
|
39
|
+
[`/.well-known/agent-terms.json`](https://mapmap.ai/.well-known/agent-terms.json).
|
|
40
|
+
|
|
41
|
+
## 60-second quickstart
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install crewai-mapmap crewai
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from crewai import Agent, Crew, Task
|
|
49
|
+
from crewai_mapmap import mapmap_tools
|
|
50
|
+
|
|
51
|
+
with mapmap_tools() as tools: # keyless connect, fair use
|
|
52
|
+
dispatcher = Agent(
|
|
53
|
+
role="Fleet dispatcher",
|
|
54
|
+
goal="Plan compliant truck routes",
|
|
55
|
+
backstory="Plans ADR-compliant routes for a haulage fleet.",
|
|
56
|
+
tools=tools,
|
|
57
|
+
)
|
|
58
|
+
task = Task(
|
|
59
|
+
description=(
|
|
60
|
+
"Route a 4.0 m tall truck carrying ADR tunnel-code C goods "
|
|
61
|
+
"from Dover to Birmingham and explain which restrictions "
|
|
62
|
+
"shaped the route."
|
|
63
|
+
),
|
|
64
|
+
expected_output="A route summary with the avoided restrictions.",
|
|
65
|
+
agent=dispatcher,
|
|
66
|
+
)
|
|
67
|
+
print(Crew(agents=[dispatcher], tasks=[task]).kickoff())
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
That is the whole integration: every tool the server registers (`route`,
|
|
71
|
+
`check_adr_tunnel`, `geocode`, `matrix`, `optimise_routes`,
|
|
72
|
+
`search_along_route`, `plan_day`, `reachable_area`, `nearby_places`,
|
|
73
|
+
navigation sessions, place entrances, map-styling and local geometry tools) with their full JSON Schemas. The wrapper adapts whatever `tools/list`
|
|
74
|
+
returns, so it needs no update when the server gains a tool.
|
|
75
|
+
|
|
76
|
+
## Navigation sessions and place entrances
|
|
77
|
+
|
|
78
|
+
The server's tools for guiding someone to a place turn by turn, and for
|
|
79
|
+
finding a place's doors, come through like every other tool:
|
|
80
|
+
|
|
81
|
+
| Tool | What it does |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `start_navigation` | Opens a navigation session from an origin to a destination; answers the session id and the first instruction. `arrive_at` (`"point"` by default, `"entrance"` or `{place_id, entrance_kind, wheelchair}`) ends it at the place's best mapped door, and the answer's `arrival` says which. |
|
|
84
|
+
| `check_navigation_progress` | Sends one position fix to the session; answers where the traveller is against the route (`on_route`, `off_route`, `rerouted`, `arrived` or `lost_position`) and the next instruction to read out. |
|
|
85
|
+
| `end_navigation` | Ends the session and drops what it held. |
|
|
86
|
+
| `place_entrances` | Lists the mapped doors of one place by its id. |
|
|
87
|
+
|
|
88
|
+
Inputs on the existing tools: `include_entrances` on `nearby_places`,
|
|
89
|
+
`places_in_view` and `geocode` adds each place's entrances to the answer,
|
|
90
|
+
and `arrive_at: "entrance"` on `route` ends the route at the best mapped
|
|
91
|
+
door for the mode of travel instead of the middle of the building (the
|
|
92
|
+
answer's `arrival` block says which door, or why none was used). The same
|
|
93
|
+
`arrive_at` on `start_navigation` ends a session at the door, and every
|
|
94
|
+
reroute heads for the same door; with no door that suits, `arrival` is
|
|
95
|
+
`applied: false` with the reason and the session ends at the destination
|
|
96
|
+
as given.
|
|
97
|
+
|
|
98
|
+
Facts an agent should pass on, because they are how the service behaves:
|
|
99
|
+
|
|
100
|
+
- Sessions live in the gateway's memory only and do not survive a gateway
|
|
101
|
+
restart. A session that has gone answers as not found; open a new one
|
|
102
|
+
from where the traveller is.
|
|
103
|
+
- A session expires after 2 hours idle; every progress check resets the
|
|
104
|
+
clock.
|
|
105
|
+
- A session keeps the route and the last accepted fix only: no trail of
|
|
106
|
+
positions, and nothing about a position is written to disk or logged.
|
|
107
|
+
- Entrances are doors mapped in OpenStreetMap and tied to the place on
|
|
108
|
+
evidence; none are estimated today. An empty list means no door is tied
|
|
109
|
+
to the place, not that it has none.
|
|
110
|
+
|
|
111
|
+
Nothing in this package changes for these tools: it adapts whatever
|
|
112
|
+
`tools/list` returns, so they appear as soon as the server you connect to
|
|
113
|
+
registers them. A runnable agent: [`examples/navigate_to_entrance.py`](./examples/navigate_to_entrance.py).
|
|
114
|
+
|
|
115
|
+
## With a key (metered volume)
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
with mapmap_tools(api_key="snk_...") as tools:
|
|
119
|
+
...
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Get a card-free key in one call: `POST https://api.mapmap.ai/v1/keys` with
|
|
123
|
+
`{"email": "you@example.com", "accept_tos": true}`. Email verification
|
|
124
|
+
upgrades the same key to 50,000 included calls a month. Prices:
|
|
125
|
+
[mapmap.ai/pricing.json](https://mapmap.ai/pricing.json).
|
|
126
|
+
|
|
127
|
+
## Self-hosted
|
|
128
|
+
|
|
129
|
+
Point the wrapper at your own gateway's MCP endpoint:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
with mapmap_tools(url="https://maps.internal.example/mcp") as tools:
|
|
133
|
+
...
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Data rights
|
|
137
|
+
|
|
138
|
+
MapMap will never ToS-ban caching, storing, indexing or training on API
|
|
139
|
+
responses. Content derived from OpenStreetMap remains under ODbL: credit
|
|
140
|
+
`© OpenStreetMap contributors` when you republish. Full manifest:
|
|
141
|
+
<https://mapmap.ai/.well-known/agent-terms.json>.
|
|
142
|
+
|
|
143
|
+
## Publishing (maintainers)
|
|
144
|
+
|
|
145
|
+
Never from a laptop. `.github/workflows/publish-python-packages.yml` builds,
|
|
146
|
+
tests and `twine check`s this package on every pull request that touches it,
|
|
147
|
+
and publishes it to PyPI through trusted publishing (no stored token) when
|
|
148
|
+
dispatched on main with the version typed in full:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Dry run: build, test and twine check only
|
|
152
|
+
gh workflow run publish-python-packages.yml -R Mapmapai/mapmap --ref main \
|
|
153
|
+
-f package=crewai-mapmap
|
|
154
|
+
|
|
155
|
+
# Publish: confirm_version must equal the version in pyproject.toml
|
|
156
|
+
gh workflow run publish-python-packages.yml -R Mapmapai/mapmap --ref main \
|
|
157
|
+
-f package=crewai-mapmap -f confirm_version=0.1.0
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
For a later release, bump `version` in `pyproject.toml` (and the CHANGELOG)
|
|
161
|
+
first: PyPI never accepts the same version twice.
|
|
162
|
+
|
|
163
|
+
## Licence
|
|
164
|
+
|
|
165
|
+
MIT. The MapMap service itself is governed by <https://mapmap.ai/terms>.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
crewai_mapmap/__init__.py,sha256=wDCYmTPpd5UjoJ7ebEfaG3g2B69kWC9IihWUMoklLLI,2277
|
|
2
|
+
crewai_mapmap-0.1.0.dist-info/METADATA,sha256=Ek8Ypm25piKVDv29mVrkRsJhHdhQx69VBEWPRqziLBc,7209
|
|
3
|
+
crewai_mapmap-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
crewai_mapmap-0.1.0.dist-info/licenses/LICENSE,sha256=Bzd2wK4tanb9ondYoAbMY_RIegfS3xa16-WeLdT6WBk,1070
|
|
5
|
+
crewai_mapmap-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mapmap AI Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|