@thenextgennexus/redfin-mcp-server 1.0.0
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.
- package/README.md +71 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +134 -0
- package/package.json +40 -0
- package/smithery.yaml +13 -0
- package/src/index.ts +159 -0
- package/tsconfig.json +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Redfin Real Estate MCP Server
|
|
2
|
+
|
|
3
|
+
Search Redfin properties, get property details, and market statistics — powered by [nexgendata](https://apify.com/nexgendata) on Apify.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Using npx (recommended)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @nexgendata/redfin-mcp-server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Install globally
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @nexgendata/redfin-mcp-server
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configure with Claude Desktop
|
|
20
|
+
|
|
21
|
+
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"redfin-mcp-server": {
|
|
27
|
+
"command": "npx",
|
|
28
|
+
"args": [
|
|
29
|
+
"-y",
|
|
30
|
+
"@nexgendata/redfin-mcp-server"
|
|
31
|
+
],
|
|
32
|
+
"env": {
|
|
33
|
+
"APIFY_TOKEN": "your-apify-token-optional"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Configure with Cline
|
|
41
|
+
|
|
42
|
+
Add the same configuration to your Cline MCP settings.
|
|
43
|
+
|
|
44
|
+
## Available Tools
|
|
45
|
+
|
|
46
|
+
| Tool | Description |
|
|
47
|
+
|------|-------------|
|
|
48
|
+
| `search_properties` | Search for properties on Redfin |
|
|
49
|
+
| `get_property_details` | Get detailed information about a specific property |
|
|
50
|
+
| `get_market_stats` | Get real estate market statistics for an area |
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## Environment Variables
|
|
54
|
+
|
|
55
|
+
| Variable | Required | Description |
|
|
56
|
+
|----------|----------|-------------|
|
|
57
|
+
| `APIFY_TOKEN` | No | Your Apify API token for authenticated access. Without it, the server uses the public endpoint (rate-limited). |
|
|
58
|
+
|
|
59
|
+
## How It Works
|
|
60
|
+
|
|
61
|
+
This MCP server acts as a local stdio bridge to the [nexgendata Apify MCP endpoint](https://nexgendata--redfin-mcp-server.apify.actor/mcp). When you call a tool, it forwards the request to Apify and returns the results.
|
|
62
|
+
|
|
63
|
+
## Links
|
|
64
|
+
|
|
65
|
+
- [Apify Store](https://apify.com/nexgendata/redfin-mcp-server)
|
|
66
|
+
- [GitHub Repository](https://github.com/TheNextGenNexus/ecommerce-mcp-servers)
|
|
67
|
+
- [nexgendata Blog](https://thenextgennexus.com)
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const APIFY_ENDPOINT = "https://nexgendata--redfin-mcp-server.apify.actor/mcp";
|
|
6
|
+
const APIFY_TOKEN = process.env.APIFY_TOKEN || "";
|
|
7
|
+
async function callApifyTool(toolName, args) {
|
|
8
|
+
const url = new URL(APIFY_ENDPOINT);
|
|
9
|
+
if (APIFY_TOKEN) {
|
|
10
|
+
url.searchParams.set("token", APIFY_TOKEN);
|
|
11
|
+
}
|
|
12
|
+
const body = {
|
|
13
|
+
jsonrpc: "2.0",
|
|
14
|
+
id: 1,
|
|
15
|
+
method: "tools/call",
|
|
16
|
+
params: {
|
|
17
|
+
name: toolName,
|
|
18
|
+
arguments: args
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const response = await fetch(url.toString(), {
|
|
22
|
+
method: "POST",
|
|
23
|
+
headers: { "Content-Type": "application/json" },
|
|
24
|
+
body: JSON.stringify(body)
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const errorText = await response.text();
|
|
28
|
+
throw new Error(`Apify API error (${response.status}): ${errorText}`);
|
|
29
|
+
}
|
|
30
|
+
const data = await response.json();
|
|
31
|
+
if (data.error) {
|
|
32
|
+
throw new Error(`Tool error: ${JSON.stringify(data.error)}`);
|
|
33
|
+
}
|
|
34
|
+
// Extract text content from MCP response
|
|
35
|
+
const result = data.result;
|
|
36
|
+
if (result?.content && Array.isArray(result.content)) {
|
|
37
|
+
return result.content
|
|
38
|
+
.filter((c) => c.type === "text")
|
|
39
|
+
.map((c) => c.text)
|
|
40
|
+
.join("\n");
|
|
41
|
+
}
|
|
42
|
+
return JSON.stringify(data.result, null, 2);
|
|
43
|
+
}
|
|
44
|
+
const server = new McpServer({
|
|
45
|
+
name: "redfin-mcp-server",
|
|
46
|
+
version: "1.0.0"
|
|
47
|
+
});
|
|
48
|
+
server.registerTool("search_properties", {
|
|
49
|
+
title: "Search Properties",
|
|
50
|
+
description: "Search Redfin properties",
|
|
51
|
+
inputSchema: {
|
|
52
|
+
location: z.string().describe('City, ZIP, or address'),
|
|
53
|
+
maxPrice: z.number().optional().describe('Maximum price'),
|
|
54
|
+
minBeds: z.number().optional().describe('Minimum bedrooms'),
|
|
55
|
+
maxItems: z.number().default(20).describe('Maximum results')
|
|
56
|
+
},
|
|
57
|
+
annotations: {
|
|
58
|
+
readOnlyHint: true,
|
|
59
|
+
destructiveHint: false,
|
|
60
|
+
openWorldHint: true
|
|
61
|
+
}
|
|
62
|
+
}, async (args) => {
|
|
63
|
+
try {
|
|
64
|
+
const result = await callApifyTool("search_properties", args);
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: "text", text: result }]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
71
|
+
return {
|
|
72
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
73
|
+
isError: true
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
server.registerTool("get_property_details", {
|
|
78
|
+
title: "Get Property Details",
|
|
79
|
+
description: "Get property details",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
propertyUrl: z.string().describe('Redfin property URL')
|
|
82
|
+
},
|
|
83
|
+
annotations: {
|
|
84
|
+
readOnlyHint: true,
|
|
85
|
+
destructiveHint: false,
|
|
86
|
+
openWorldHint: true
|
|
87
|
+
}
|
|
88
|
+
}, async (args) => {
|
|
89
|
+
try {
|
|
90
|
+
const result = await callApifyTool("get_property_details", args);
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: "text", text: result }]
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
97
|
+
return {
|
|
98
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
99
|
+
isError: true
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
server.registerTool("get_market_stats", {
|
|
104
|
+
title: "Get Market Stats",
|
|
105
|
+
description: "Get market statistics",
|
|
106
|
+
inputSchema: {
|
|
107
|
+
location: z.string().describe('City or ZIP code')
|
|
108
|
+
},
|
|
109
|
+
annotations: {
|
|
110
|
+
readOnlyHint: true,
|
|
111
|
+
destructiveHint: false,
|
|
112
|
+
openWorldHint: true
|
|
113
|
+
}
|
|
114
|
+
}, async (args) => {
|
|
115
|
+
try {
|
|
116
|
+
const result = await callApifyTool("get_market_stats", args);
|
|
117
|
+
return {
|
|
118
|
+
content: [{ type: "text", text: result }]
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
123
|
+
return {
|
|
124
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
125
|
+
isError: true
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
async function main() {
|
|
130
|
+
const transport = new StdioServerTransport();
|
|
131
|
+
await server.connect(transport);
|
|
132
|
+
console.error("Redfin Real Estate MCP Server running on stdio");
|
|
133
|
+
}
|
|
134
|
+
main().catch(console.error);
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thenextgennexus/redfin-mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Search Redfin properties, get property details, and market statistics",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"redfin-mcp-server": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"start": "node dist/index.js",
|
|
12
|
+
"dev": "tsx src/index.ts"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
16
|
+
"zod": "^3.22.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^5.3.0",
|
|
20
|
+
"tsx": "^4.7.0",
|
|
21
|
+
"@types/node": "^20.11.0"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18.0.0"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"mcp",
|
|
28
|
+
"model-context-protocol",
|
|
29
|
+
"ai",
|
|
30
|
+
"apify",
|
|
31
|
+
"nexgendata"
|
|
32
|
+
],
|
|
33
|
+
"author": "nexgendata",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/TheNextGenNexus/ecommerce-mcp-servers"
|
|
38
|
+
},
|
|
39
|
+
"mcpName": "io.github.thenextgennexus/redfin-mcp-server"
|
|
40
|
+
}
|
package/smithery.yaml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
startCommand:
|
|
2
|
+
type: stdio
|
|
3
|
+
configSchema:
|
|
4
|
+
type: object
|
|
5
|
+
required:
|
|
6
|
+
- apifyToken
|
|
7
|
+
properties:
|
|
8
|
+
apifyToken:
|
|
9
|
+
type: string
|
|
10
|
+
description: Your Apify API token. Get one free at https://apify.com
|
|
11
|
+
commandFunction:
|
|
12
|
+
|-
|
|
13
|
+
(config) => ({{ command: 'npx', args: ['tsx', 'src/index.ts'], env: {{ APIFY_TOKEN: config.apifyToken }} }})
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
const APIFY_ENDPOINT = "https://nexgendata--redfin-mcp-server.apify.actor/mcp";
|
|
7
|
+
const APIFY_TOKEN = process.env.APIFY_TOKEN || "";
|
|
8
|
+
|
|
9
|
+
async function callApifyTool(toolName: string, args: Record<string, unknown>): Promise<string> {
|
|
10
|
+
const url = new URL(APIFY_ENDPOINT);
|
|
11
|
+
if (APIFY_TOKEN) {
|
|
12
|
+
url.searchParams.set("token", APIFY_TOKEN);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const body = {
|
|
16
|
+
jsonrpc: "2.0",
|
|
17
|
+
id: 1,
|
|
18
|
+
method: "tools/call",
|
|
19
|
+
params: {
|
|
20
|
+
name: toolName,
|
|
21
|
+
arguments: args
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const response = await fetch(url.toString(), {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: { "Content-Type": "application/json" },
|
|
28
|
+
body: JSON.stringify(body)
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
const errorText = await response.text();
|
|
33
|
+
throw new Error(`Apify API error (${response.status}): ${errorText}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const data = await response.json();
|
|
37
|
+
|
|
38
|
+
if (data.error) {
|
|
39
|
+
throw new Error(`Tool error: ${JSON.stringify(data.error)}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Extract text content from MCP response
|
|
43
|
+
const result = data.result;
|
|
44
|
+
if (result?.content && Array.isArray(result.content)) {
|
|
45
|
+
return result.content
|
|
46
|
+
.filter((c: { type: string }) => c.type === "text")
|
|
47
|
+
.map((c: { text: string }) => c.text)
|
|
48
|
+
.join("\n");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return JSON.stringify(data.result, null, 2);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const server = new McpServer({
|
|
55
|
+
name: "redfin-mcp-server",
|
|
56
|
+
version: "1.0.0"
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
server.registerTool(
|
|
60
|
+
"search_properties",
|
|
61
|
+
{
|
|
62
|
+
title: "Search Properties",
|
|
63
|
+
description: "Search Redfin properties",
|
|
64
|
+
inputSchema: {
|
|
65
|
+
location: z.string().describe('City, ZIP, or address'),
|
|
66
|
+
maxPrice: z.number().optional().describe('Maximum price'),
|
|
67
|
+
minBeds: z.number().optional().describe('Minimum bedrooms'),
|
|
68
|
+
maxItems: z.number().default(20).describe('Maximum results')
|
|
69
|
+
},
|
|
70
|
+
annotations: {
|
|
71
|
+
readOnlyHint: true,
|
|
72
|
+
destructiveHint: false,
|
|
73
|
+
openWorldHint: true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
async (args) => {
|
|
77
|
+
try {
|
|
78
|
+
const result = await callApifyTool("search_properties", args);
|
|
79
|
+
return {
|
|
80
|
+
content: [{ type: "text", text: result }]
|
|
81
|
+
};
|
|
82
|
+
} catch (error) {
|
|
83
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
86
|
+
isError: true
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
server.registerTool(
|
|
93
|
+
"get_property_details",
|
|
94
|
+
{
|
|
95
|
+
title: "Get Property Details",
|
|
96
|
+
description: "Get property details",
|
|
97
|
+
inputSchema: {
|
|
98
|
+
propertyUrl: z.string().describe('Redfin property URL')
|
|
99
|
+
},
|
|
100
|
+
annotations: {
|
|
101
|
+
readOnlyHint: true,
|
|
102
|
+
destructiveHint: false,
|
|
103
|
+
openWorldHint: true
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
async (args) => {
|
|
107
|
+
try {
|
|
108
|
+
const result = await callApifyTool("get_property_details", args);
|
|
109
|
+
return {
|
|
110
|
+
content: [{ type: "text", text: result }]
|
|
111
|
+
};
|
|
112
|
+
} catch (error) {
|
|
113
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
114
|
+
return {
|
|
115
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
116
|
+
isError: true
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
server.registerTool(
|
|
123
|
+
"get_market_stats",
|
|
124
|
+
{
|
|
125
|
+
title: "Get Market Stats",
|
|
126
|
+
description: "Get market statistics",
|
|
127
|
+
inputSchema: {
|
|
128
|
+
location: z.string().describe('City or ZIP code')
|
|
129
|
+
},
|
|
130
|
+
annotations: {
|
|
131
|
+
readOnlyHint: true,
|
|
132
|
+
destructiveHint: false,
|
|
133
|
+
openWorldHint: true
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
async (args) => {
|
|
137
|
+
try {
|
|
138
|
+
const result = await callApifyTool("get_market_stats", args);
|
|
139
|
+
return {
|
|
140
|
+
content: [{ type: "text", text: result }]
|
|
141
|
+
};
|
|
142
|
+
} catch (error) {
|
|
143
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
144
|
+
return {
|
|
145
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
146
|
+
isError: true
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
async function main() {
|
|
154
|
+
const transport = new StdioServerTransport();
|
|
155
|
+
await server.connect(transport);
|
|
156
|
+
console.error("Redfin Real Estate MCP Server running on stdio");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
main().catch(console.error);
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"src/**/*"
|
|
15
|
+
]
|
|
16
|
+
}
|