arcgis-portal-mcp

arcgis-portal-mcp

Enables AI assistants to search, query, and manage ArcGIS Portal and Online content, feature layers, users, and groups via the Model Context Protocol.

Category
访问服务器

README

arcgis-portal-mcp

MCP server for ArcGIS Portal and ArcGIS Online. Lets AI assistants search content, query feature layers, manage features, handle content operations, and administer users and groups.

Built on the Model Context Protocol for integration with Claude Desktop, Cursor, VS Code Copilot, and other MCP clients.

Disclaimer: This is an independent open-source project. It is not affiliated with, endorsed by, or sponsored by Esri Inc. "ArcGIS" is a registered trademark of Esri.

Features

  • Connect to any ArcGIS Enterprise Portal or ArcGIS Online
  • Search for items (feature services, web maps, layers, dashboards)
  • Inspect item metadata, tags, and descriptions
  • List layers in a feature service with geometry types and counts
  • Query features with attribute filters, spatial filters, field selection, and pagination
  • Add, update, and delete features in hosted feature layers
  • Manage content: update item properties, share/unshare, delete items, read web map definitions
  • Manage users: list users, get detailed user profiles
  • Manage groups: list groups, create groups, invite users
  • Publish services: upload files and publish as hosted feature services
  • Run geoprocessing: execute synchronous and asynchronous GP tasks
  • Portal admin: system info, license management, usage statistics
  • Batch operations: bulk delete, share, and update multiple items
  • Health check portal system status (requires admin privileges)

Design Principles

  • No arcgis Python package dependency: uses raw REST API calls via requests for maximum compatibility (no need for arcgis package installation)
  • Works with Enterprise Portal AND ArcGIS Online: same tools, same API
  • Token-first auth: supports existing tokens, username/password, and OAuth2 for full flexibility
  • Auto-connect: reads .env file on startup, no manual auth needed per session
  • 2FA-friendly: works with Enterprise portals that require two-factor authentication (client_credentials, no browser)
  • Self-signed cert friendly: handles Enterprise portals with self-signed certificates

Installation

# From source
cd arcgis-portal-mcp
pip install -e .

# Or install from GitHub
pip install git+https://github.com/Asem-D/arcgis-portal-mcp.git

Windows users: pywin32 is installed automatically as a platform-specific dependency.

Configuration

.env File (recommended)

Create a .env file in the project root for automatic connection on startup. A template is provided:

cp .env.example .env
# Edit .env with your portal credentials
portal_url=https://gis.example.com/portal
# Option 1: Username/password (recommended for most users)
username=your-portal-username
password=your-portal-password
# Option 2: OAuth2 app credentials (app-level, limited permissions)
# oauth_client_id=your-oauth-app-client-id
# oauth_client_secret=your-oauth-app-client-secret

The server reads these on startup and connects automatically. If username + password are provided, it uses generateToken (user-level, full permissions). Otherwise, it falls back to client_credentials (app-level, limited). No manual connect_portal call needed.

Note: The .env file is gitignored. Never commit credentials. .env.example is safe to commit.

MCP Client Configuration

For MCP clients (Claude Desktop, Cursor, etc.), the simplest setup uses a .env file:

{
  "mcpServers": {
    "arcgis-portal": {
      "command": "python",
      "args": ["-m", "arcgis_portal_mcp.server"],
      "cwd": "/path/to/arcgis-portal-mcp"
    }
  }
}

The server auto-connects from .env in the working directory. No env vars needed in the MCP config.

Alternatively, pass credentials via MCP client env vars:

{
  "mcpServers": {
    "arcgis-portal": {
      "command": "python",
      "args": ["-m", "arcgis_portal_mcp.server"],
      "env": {
        "portal_url": "https://gis.example.com/portal",
        "username": "your-portal-username",
        "password": "your-portal-password"
      }
    }
  }
}

connect_portal Tool Parameters

The connect_portal tool accepts these auth_method values:

Value Behavior
auto Read from .env (default) — tries username/password first, then client_credentials
username_password Portal username + password -> generateToken (user-level)
token Use explicit portal token
client_credentials Use explicit client_id/secret
oauth2 Browser-based OAuth2 (blocks ~2 min)

Usage

Connect and Search

User: Search for all feature services in my portal
Agent: [calls connect_portal, then search_content with item_type="Feature Service"]

Query a Layer

User: Show me the first 10 parcels from the cadastral layer
Agent: [calls list_layers to find the parcel layer, then query_features with limit=10]

Audit Users

User: Who are the administrators in our portal?
Agent: [calls list_users, filters by role]

Add Features

User: Add these 3 buildings to the infrastructure layer
Agent: [calls add_features with the feature service URL and JSON features]

Share a Web Map

User: Share item abc123 with the "Planning Team" group and the whole org
Agent: [calls share_item with org=true and groups=<planning-team-id>]

Read a Web Map

User: What basemap and layers are in this web map?
Agent: [calls get_item_data to read the web map JSON, summarizes basemap and operational layers]

Publish a Shapefile

User: Publish this shapefile as a hosted feature service
Agent: [calls upload_item to upload the .zip, then publish_from_item to create the service]

Run a Geoprocessing Task

User: Run the buffer analysis on the parcels layer with a 100m distance
Agent: [calls execute_gp_task with the GP service URL and input parameters]

Bulk Operations

User: Delete all my draft items
Agent: [calls search_content to find items, then batch_delete_items to remove them]

Portal Administration

User: How many licenses do we have left?
Agent: [calls list_licenses to show license allocation and usage]

Available Tools

Phase 1: Read-only (v0.1)

Tool Description
connect_portal Authenticate with the portal (auto, token, client_credentials, or OAuth2)
search_content Search items by keyword, type, and owner
get_item_details Get detailed metadata for a specific item
list_layers List layers in a feature/map service
query_features Query features with filters and pagination
list_users List portal users with roles and status
list_groups List portal groups with access levels
portal_health Check portal health and system status
server_status Check MCP server connection state

Phase 2: Feature CRUD, User/Group & Content Management (v0.2)

Tool Description
add_features Add new features to a hosted feature layer
update_features Update existing features (by OBJECTID)
delete_features Delete features by OBJECTIDs or WHERE clause
get_user_details Get detailed user profile (role, privileges, storage, last login)
create_group Create a new group with access control
invite_to_group Invite users to a group with a role assignment
update_item Update item properties (title, description, tags, access)
delete_item Delete an item from the portal
share_item Share/unshare an item with everyone, org, or specific groups
get_item_data Read item data (web map JSON, app config, feature collections)

Phase 3: Publishing, Geoprocessing, Admin & Batch (v1.0)

Tool Description
upload_item Upload a local file (CSV, Shapefile, etc.) to portal content
publish_from_item Publish an uploaded item as a hosted feature service
create_service Create an empty hosted feature service with schema
execute_gp_task Run a synchronous geoprocessing task
submit_gp_job Submit an async GP job and get a job ID for polling
get_gp_job_status Check status of a running async geoprocessing job
portal_system_info Get portal version, platform, and system info (admin)
list_licenses Get license information and assignments (admin)
portal_usage Get portal usage statistics: users, API calls, storage (admin)
batch_delete_items Delete multiple items at once
batch_share_items Share/unshare multiple items with the same audiences
batch_update_items Update properties of multiple items at once

Authentication Methods

Method Pros Cons
Auto (default) Zero-config, reads .env on startup App-level only (no user identity)
Token Quick, no dependencies Tokens expire, must be obtained separately
Client Credentials No browser needed, auto-refresh App-level only (no user identity)
OAuth2 Full user permissions, 14-day tokens Opens browser, blocks for ~2 min

Recommendation for Enterprise portals with 2FA: Use auto (.env with client_credentials). Token auth won't work because 2FA blocks token generation. The client_credentials flow uses app-level OAuth2, no browser, no 2FA, no user interaction.

For ArcGIS Online or portals without 2FA: Token auth is the fastest for MCP. Use OAuth2 once to get a long-lived token, then use that token for MCP sessions.

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
ruff check arcgis_portal_mcp/

License

MIT. See LICENSE.

Author

Asem Daaboul (asem.daaboul@gmail.com)

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选