Harper MCP Server
Exposes HarperDB tables and custom resources as structured MCP resources, enabling read-only access and filtering through JSON-RPC calls.
README
Harper MCP Server
A server implementation of the Model Context Protocol (MCP), designed to expose data in HarperDB as structured "Resources" accessible via standardized JSON-RPC calls.
Note: Requires HarperDB version 4.5.10 or later.
What is Harper
Harper is a Composable Application Platform that merges database, cache, app logic, and messaging into a single runtime. Components like this plug directly into Harper, letting you build and scale distributed services fast, without managing separate systems. Built for geo-distributed apps with low latency and high uptime by default.
Features
- MCP-compatible API server for Harper
- Predefined static capabilities endpoint (
/capabilities.json) - Provides read-only access to data from Harper tables and custom resources
- Supports filtering data in Harper tables using query parameters
- Handles pagination (limit, start) for table data retrieval
- Provides standardized error responses
Getting Started
Prerequisites
- Harper stack installed globally.
- Ensure HarperDB v4.5.10 or later is configured and running with necessary databases and schemas.
- Environment variable
HOSTshould be set to the base URL of your server. This is used to construct resource URIs.
Deploying to Harper
The Harper mcp-server is published to NPM and can be installed using Harper's Operation API.
i.e.
POST https://harper-server.com:9925
{
"operation": "deploy_component",
"package": "@harperdb/mcp-server@1.0.0"
}
Security & Authentication
Harper employs role-based, attribute-level security to ensure users access only authorized data. Requests to the server are authenticated using HarperDB's built-in authentication mechanisms, which include Basic Auth, JWT, and mTLS. See Harper Security Docs for more details.
API
MCP Methods
The server implements the following MCP methods:
resources/list: Lists all available resources (HarperDB tables and custom resources).resources/read: Retrieves data for a specific resource based on its URI.
A single endpoint, /mcp handles all requests. The server uses JSON-RPC 2.0 for communication.
- Request Format: All requests are sent as JSON-RPC 2.0 formatted JSON objects.
- Response Format: The server responds with JSON-RPC 2.0 formatted JSON objects.
- Error Handling: The server returns standardized error responses.
Resource URIs
-
Tables: Resources representing HarperDB tables are accessed via URIs like:
{HOST}/{table_name}- Example:
http://localhost:9925/my_table
- Example:
-
Table Rows: Individual rows within a table can be accessed using the primary key:
{HOST}/{table_name}/{primary_key_value}- Example:
http://localhost:9925/my_table/123(where 123 is the primary key value)
- Example:
-
Custom Resources: Custom resources are accessed via URIs defined by their registered path:
{HOST}/{path}/{resource_name}- Example:
http://localhost:9925/custom/my_resource
- Example:
Usage
1. Listing Resources
POST /mcp
Sample Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "resources/list"
}
Sample Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"resources": [
{
"uri": "http://localhost:9926/CustomerOrders",
"name": "CustomerOrders",
"description": "CustomerOrders table with attributes: id (PK - Int), customerId (string), customer (Relationship from customerId - Customers), itemSku (String), item (Relationship from itemSku - Items), subTotal (Float), orderTotal (Float), date (DateTime). Results can be filtered with optional query parameters.",
"mimeType": "application/json"
},
{
"uri": "http://localhost:9926/Customers",
"name": "Customers",
"description": "Customers table with attributes: id (PK - Int), email (String), phoneNumber (String), customerName (String), country (String), orders (Relationship to customerId - array). Results can be filtered with optional query parameters.",
"mimeType": "application/json"
},
{
"uri": "http://localhost:9926/Items",
"name": "Items",
"description": "Items table with attributes: sku (PK - String), itemName (String), itemDescription (String), unitPrice (Int). Results can be filtered with optional query parameters.",
"mimeType": "application/json"
},
{
"uri": "http://localhost:9926/TestCustomer",
"name": "TestCustomer",
"description": "Customers table with attributes: id (PK - Int), email (String), phoneNumber (String), customerName (String), country (String), orders (Relationship to customerId - array). Results can be filtered with optional query parameters.",
"mimeType": "application/json"
},
{
"uri": "http://localhost:9926/api/test",
"name": "test",
"description": "REST Resource.",
"mimeType": "application/json"
}
]
}
}
2. Get resources data
POST /mcp
Sample Request:
{
"jsonrpc": "2.0",
"id": 2,
"method": "resources/read",
"params": {
"uri": "http://localhost:9926/Customers"
}
}
Sample Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"contents": [
{
"uri": "http://localhost:9926/Customers/11",
"mimeType": "application/json",
"text": "{\"id\":11,\"email\":\"kelly.williams@example.com\",\"phoneNumber\":\"214-555-1234\",\"customerName\":\"Kelly Williams\",\"country\":\"USA\"}"
},
{
"uri": "http://localhost:9926/Customers/12",
"mimeType": "application/json",
"text": "{\"id\":12,\"email\":\"liam.martinez@example.com\",\"phoneNumber\":\"972-555-5678\",\"customerName\":\"Liam Martinez\",\"country\":\"Canada\"}"
},
{
"uri": "http://localhost:9926/Customers/13",
"mimeType": "application/json",
"text": "{\"id\":13,\"email\":\"mia.anderson@example.com\",\"phoneNumber\":\"469-555-9012\",\"customerName\":\"Mia Anderson\",\"country\":\"UK\"}"
},
{
"uri": "http://localhost:9926/Customers/14",
"mimeType": "application/json",
"text": "{\"id\":14,\"email\":\"noah.thomas@example.com\",\"phoneNumber\":\"817-555-3456\",\"customerName\":\"Noah Thomas\",\"country\":\"Australia\"}"
},
{
"uri": "http://localhost:9926/Customers/15",
"mimeType": "application/json",
"text": "{\"id\":15,\"email\":\"olivia.jackson@example.com\",\"phoneNumber\":\"682-555-7890\",\"customerName\":\"Olivia Jackson\",\"country\":\"Germany\"}"
},
{
"uri": "http://localhost:9926/Customers/16",
"mimeType": "application/json",
"text": "{\"id\":16,\"email\":\"owen.white@example.com\",\"phoneNumber\":\"214-555-2345\",\"customerName\":\"Owen White\",\"country\":\"France\"}"
},
{
"uri": "http://localhost:9926/Customers/17",
"mimeType": "application/json",
"text": "{\"id\":17,\"email\":\"sophia.harris@example.com\",\"phoneNumber\":\"972-555-6789\",\"customerName\":\"Sophia Harris\",\"country\":\"Japan\"}"
}
]
}
}
Querying Tables
When retrieving data from tables using resources/read, you can use optional query parameters in the URI to filter data.
- Filtering: Use
attribute=valuepairs to filter based on column values. The comparator is always "equals".- Example:
http://localhost:9925/my_table?name=John&city=NewYork
- Example:
- Pagination: Use
limitandstartparameters for pagination.limit: Maximum number of results to return.start: Offset to start returning results from.- Example:
http://localhost:9925/my_table?limit=10&start=20
Error Responses
The server returns standardized JSON-RPC error responses:
{
"jsonrpc": "2.0",
"id": 2,
"error": {
"code": -32602,
"message": "Invalid params."
}
}
Error Codes:
-32601: Method not found.-32602: Invalid params.-32603: Internal server error.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。