Salesforce MCP Neo4j Demo

MCP搜索检索

提供方 belavaditech

搜索检索 未标注 会话登录 社区 / 第三方

通过MCP、RAG和LWC三种架构实现Salesforce与Neo4j图数据库的交互,支持自然语言查询、Cypher查询和智能RAG翻译。

一句话选型结论

按资料字段整理

Salesforce MCP Neo4j Demo 属于搜索检索类 MCP 服务器,传输方式未标注,会话登录,没有现成安装命令,需按官方文档接入。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类搜索检索 传输方式未标注 鉴权会话登录 部署方式未标注
GitHub 星标 1 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

搜索检索
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

适用场景

图数据库集成JavaScript本地部署自然语言处理RAGSalesforce扩展Neo4j

安装与配置

未标注 会话登录
上游未给出传输方式
  1. 1
    准备运行环境

    按官方文档确认运行环境(常见为 Node.js 或 Python),装好后再执行安装命令。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
联网搜索取证

让模型查最新资料并给出出处。

资料聚合

把一个主题的网页、文档集中抓回来整理。

情报与竞品检索

按关键词持续检索行业动态和竞品信息。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 基础信息齐全,可以先按官方文档接入试跑。

先想清楚的地方

  • 没有现成安装命令,需要按官方文档自己填启动命令和参数。
  • 使用前要准备好会话登录对应的凭据,并按最小权限配置。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在搜索检索场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Salesforce MCP Neo4j Demo当前 未标注 未标注 未标注 无 2026-05-17
Brave Search 433812ff 2 未标注 未标注 无 2026-05-17
Sequentialthinking 1 SSE · 服务端推送 远程部署 有 2026-05-18
Baidu Netdisk 未标注 未标注 未标注 无 2026-05-17
ragflow 未标注 stdio · 本地进程 本地部署 有 2026-04-11
mindsdb (430e18) 未标注 未标注 未标注 有 2026-05-17

服务器档案

搜索检索
字段来自项目仓库与公开索引,中文说明由本站标注
提供方belavaditech上游标注的维护方 belavaditech
分类搜索检索本站按上游分类展示
连接方式未标注上游未给出传输方式
鉴权方式会话登录远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型未标注上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

12.0 KB
来自项目仓库与上游目录的原文,未做删改

🚀 使用MCP、RAG和LWC将Salesforce与Neo4j集成——三种架构的实用演示

在这个演示中,我展示了 三种不同的架构 哪里 Salesforce与Neo4j图数据库进行交互 使用 现代上下文协议(MCP), GraphRAG,和 自定义 Node.js 网关逻辑。

我的目标很简单:\


🎯 三种整合方法

✅ 表示正确、确认或成功。 方法1 – 使用直接MCP-Neo4j-Cypher的RAG(检索增强生成)```

Salesforce → Grounding → Node.js Gateway → MCP-Neo4j-Cypher → Neo4j


在这种方法中,Salesforce发送一个 **自然语言请求**. 那个 **MCP工具将其转换为Cypher** 使用接地逻辑并直接在Neo4j上执行它。

______________________________________________________________________

### ✅ **方法2 – 使用GraphRag检索器的RAG(检索增强生成)**```
Salesforce → Grounding → Node.js Gateway → GraphRAG Retriever → Neo4j

✅ 方法3 – 直接执行Cypher查询(无RAG模式)```

Salesforce → Node.js Gateway → MCP-Neo4j-Cypher → Neo4j


这是 *开发者模式*我们 **绕过接地和RAG(快速访问指南/风险评估小组/其他根据上下文确定的缩写)**Salesforce 直接提交 Cypher 查询,通过 MCP 进行路由。

______________________________________________________________________

## 🏗 架构概述

| 层 | 组件 |
|-------|----------|
| 用户界面层 | **闪电网络组件(LWC)** |
| 后端(Salesforce) | **Apex 控制器 → 命名凭据 → HTTP 调用** |
| 网关 | **Node.js MCP 客户端网关(端口 9005)** |
|MCP服务| **Python MCP 服务器(端口 8005)** 暴露;揭露 `text2cypher` 并且 `read-cypher` |
| 数据层 | **Neo4j 图数据库** |

- LWC 发送请求 → Apex
- Apex 使用 **命名凭据 + ngrok HTTPS 端点**
- Node.js网关将Salesforce的HTTP请求转换为MCP请求

______________________________________________________________________

## 🎛 为什么选择Apex + 命名凭据?

- **Apex 发出了呼叫(或提示)**
- **命名凭证暴露了网关URL**
- **Ngrok 提供临时 HTTPS URL**,因为已命名凭据 **不接受HTTP**

##

## 🛠 已实现的MCP工具(Python)```python
# -----------------------
# Tool: text2cypher (GraphRAG)
# -----------------------

@mcp.tool(name="text2cypher")
def text2cypher_tool(query: str, top_k: int = 3):
"""
Use Neo4j GraphRAG Text2CypherRetriever to generate Cypher via rag.search().
"""
try:
# ✅ Call correct official API for latest neo4j-graphrag
result = rag.search(query_text=query)

# The retriever can also be used without using graphRag
# result = retriever.search(query_text=query)

print (result)

# fallback if result.cypher_query is missing

cypher_query = (
getattr(result, "cypher_query", None)
or getattr(result, "cypher", None)
or getattr(result, "query", None)
or (getattr(result, "metadata", {}) or {}).get("cypher")
or (getattr(result, "metadata", {}) or {}).get("cypher_text")
)

# ✅ Extract fields safely

graph_data = getattr(result, "records", None)

if not cypher_query:
return {"error": "No Cypher generated", "raw": str(result)}

# ✅ Execute Cypher via standard Neo4j session
with driver.session() as session:
data_rows = session.run(cypher_query)
final_data = [record.data() for record in data_rows]

return {
"input": query,
"cypher": cypher_query,
"graphData": final_data
}

except Exception as e:
return {"error": str(e)}

# -----------------------
# Helpers
# -----------------------
def _execute_cypher_return_rows(cypher_text: str, params: dict | None = None):
"""Execute a cypher string in read mode and return list of record.data() dicts."""
params = params or {}
with driver.session(default_access_mode="READ") as session:
result = session.run(cypher_text, **params)
return [rec.data() for rec in result]

# -----------------------
# Tool: read_neo4j_cypher
# -----------------------
@mcp.tool(name="read_neo4j_cypher")
def read_neo4j_cypher(query: str):
"""
Execute read-only Cypher and return rows.
"""
try:
rows = _execute_cypher_return_rows(query)
return {"ok": True, "rows": rows}
except Exception as e:
return {"ok": False, "error": str(e), "trace": traceback.format_exc()}


🛠 网关已实现(使用Node.js)```

// 1) Method 1: LWC -> Gateway -> translateToCypher(LM) -> MCP read_neo4j_cypher -> groundedAnswer -> return
app.post('/method1', async (req, res) => {
try {
const { naturalLanguage } = req.body;
const cypherQuery = await translateToCypher(naturalLanguage);

const client = await mcpClientPromise;
const result = await client.callTool({ name: 'read_neo4j_cypher', arguments: { query: cypherQuery } });

console.log(result);

const grounded = await groundedAnswer(naturalLanguage, result.content?.json || result.content?.text || result, cypherQuery);

res.json({ mode: 'method1', cypher: cypherQuery, rawGrounding: result.content || null, groundedAnswer: grounded });
} catch (err) {
console.error(err);
res.status(500).json({ error: err.message });
}
});

// 2) Method 2: LWC -> Gateway -> MCP text2cyphertool -> returns cypher + grounding -> groundedAnswer -> return
app.post('/method2', async (req, res) => {

console.log("method2 LWC -> Gateway -> MCP text2cyphertool");
try {
const { naturalLanguage } = req.body;
const client = await mcpClientPromise;

// Call the MCP tool that exposes text2cypher retriever on the Neo4j side
const toolResult = await client.callTool({ name: 'text2cypher', arguments: { query: naturalLanguage } });

console.log(toolResult);
// Expect toolResult.content to include { cypherQuery, graphData }
// const cypherQuery = toolResult.content?.json?.cypherQuery || toolResult.content?.json?.cypher || (toolResult.content?.text || '').slice(0, 2000);

const contentBlock = toolResult.content?.[0];
if (contentBlock?.type === 'text' && contentBlock.text) {
const parsed = JSON.parse(contentBlock.text);
cypherQuery = parsed.cypher || parsed.cypherQuery || parsed.metadata?.cypher;
graphData = parsed.graphData || parsed.rows || parsed.records || parsed.data;
}

console.log("cypherQuery = " + cypherQuery);
// const graphData = toolResult.content?.json?.graphData || toolResult.content?.json?.rows || toolResult.content?.text || toolResult.content || {};

console.log("graphData = " + graphData);

const grounded = await groundedAnswer(naturalLanguage, graphData, cypherQuery);

console.log("grounded = " + grounded);

res.json({ mode: 'method2', cypher: cypherQuery, rawGrounding: graphData, groundedAnswer: grounded });
} catch (err) {
console.error(err);
res.status(500).json({ error: err.message });
}
});

// 3) No-RAG: direct query to DB
app.post('/no-rag', async (req, res) => {
try {
const { naturalLanguage } = req.body;
const cypherQuery = await translateToCypher(naturalLanguage);

const client = await mcpClientPromise;
const result = await client.callTool({ name: 'read_neo4j_cypher', arguments: { query: cypherQuery } });

console.log(result);

res.json({ mode: 'no-rag', cypher: cypherQuery, rawGrounding: naturalLanguage, groundedAnswer: result.content || null });
} catch (err) {
console.error(err);
res.status(500).json({ error: err.message });
}
});


## 🌍 使用 cURL 进行测试```bash
curl -X POST https://a4f561090ffb.ngrok-free.app/method2   -H "Content-Type: application/json"   -d @naturaldemo.json

输入JSON(naturaldemo.json)```json
{"naturalLanguage": "Find list of cases"}


**回应**```json

curl -X POST https://a4f561090ffb.ngrok-free.app/method2   -H "Content-Type: application/json"   -d @naturaldemo.json
{"mode":"method2","cypher":"MATCH (c:Case) RETURN c","rawGrounding":[{"c":{"product":"LoginApp","subject":"Timeout issue","case_id":"001","email":"john@example.com"}},{"c":{"createdDate":"2025-09-09T13:20:55.501000000+00:00","subject":"Cannot login","caseNumber":"00012345","id":"5005j00001ABC123","priority":"High","status":"Closed"}},{"c":{"createdDate":"2025-09-09T13:20:55.501000000+00:00","subject":"Payment failed","caseNumber":"00012346","id":"5005j00001ABC456","priority":"Medium","status":"In Progress"}},{"c":{"subject":"The server is crashing in weekend"}}],"groundedAnswer":"To find the list of cases from the provided grounding data, we can extract the relevant information from each case entry. The grounding data contains several cases with different attributes. Here’s a concise summary of the cases identified:\n\n1. **Case ID: 001**\n   - **Product:** LoginApp\n   - **Subject:** Timeout ....
...
}


💻 Apex 代码以访问网关(RagGatewayController)```apex

public with sharing class RagGatewayController {
@AuraEnabled(cacheable=false)
public static Object getMcpResponse(String input, String mode) {
Http http = new Http();
HttpRequest req = new HttpRequest();

String baseUrl = 'callout:RagNeo4jGateway/'; // Replace with actual host

String endpoint = baseUrl + '/' + mode; // mode = method1, method2, no-rag

req.setEndpoint(endpoint);
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');

Map payload = new Map{ 'naturalLanguage' => input };
req.setBody(JSON.serialize(payload));

HttpResponse res = http.send(req);
if (res.getStatusCode() == 200) {
return JSON.deserializeUntyped(res.getBody());
} else {
throw new AuraHandledException('Gateway error: ' + res.getStatus());
}
}
}


______________________________________________________________________

## 💻 Apex 测试代码(匿名执行)```apex
try {
String input = 'Find suppliers in Bangalore';
String mode = 'method1'; // method2, no-rag also valid

Object result = RagGatewayController.getMcpResponse(input, mode);
System.debug('✅ Result:
' + JSON.serializePretty(result));

} catch (Exception e) {
System.debug('❌ Exception: ' + e.getMessage());
}

🔌 网关(Node.js MCP 客户端)– 运行在 9005 端口

> 作为HTTP到MCP的桥梁。接收 /method1, /method2, /no-rag POST(发布)并转发到MCP服务器。


🐍 Python MCP 服务器 – 运行在 8005 端口

> 揭露;曝光 GraphRAG Text2CypherRetriever(可译为“GraphRAG 文本转Cypher检索器”) 和 只读 Cypher 执行。


🎨 LWC 应用 – 用户界面层

  • 自然语言输入框
  • 通过网关显示来自Neo4j的JSON结果```

import { LightningElement, track } from 'lwc';
import getMcpResponse from '@salesforce/apex/RagGatewayController.getMcpResponse';

export default class RagGatewayDemo extends LightningElement {
@track userInput = '';
@track selectedMode = 'method1';
@track response;

modeOptions = [
{ label: 'Method 1: (RAG) LLM → Cypher → MCP', value: 'method1' },
{ label: 'Method 2: (RAG) MCP Text2Cypher', value: 'method2' },
{ label: 'Method 3: (No-RAG) (Just cypher)', value: 'no-rag' }
];

handleInput(event) {
this.userInput = event.target.value;
}

handleModeChange(event) {
this.selectedMode = event.detail.value;
}

async handleSubmit() {
try {
const result = await getMcpResponse({ input: this.userInput, mode: this.selectedMode });
this.response = JSON.stringify(result, null, 2);
} catch (error) {
this.response = 'Error: ' + error.body.message;
}
}
}


## LWC HTML(Lightweight Components 的 HTML,即轻量级组件的 HTML)```

Response:

{response}


📸 截图

  • 📷 带有3个选项卡的LWC(Lightweight Component,轻量级组件)

🔮 总结思考

这个实验证明了 Salesforce不再仅仅是一个CRM(客户关系管理)平台 – 它可以 通过MCP和Neo4j实现图智能调度. 随着 GraphRAG, 基于实际情境的密码生成,以及 结构化MCP工具我们可以将Salesforce转变为一个 图感知智能控制台。

常见问题

5 问
答案由本站依据条目字段整理,不引用上游原文
Salesforce MCP Neo4j Demo 怎么安装?

资料没有给出安装命令,请到官方仓库或文档按说明接入;这类条目多数是生态应用,或尚未发布可安装包。

Salesforce MCP Neo4j Demo 怎么在客户端里配置?

它的传输方式未标注,在客户端 MCP 配置里按官方文档填写启动命令和参数,保存后重启客户端生效。

Salesforce MCP Neo4j Demo 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Salesforce MCP Neo4j Demo 需要 API Key 吗?

资料标注需要会话登录认证,使用前准备好对应凭据,并按最小权限配置。

Salesforce MCP Neo4j Demo 能提供哪些能力?

资料显示能力标签包括 自然语言处理、JavaScript、RAG。具体工具清单以官方文档为准。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。