fms-odata-mcp 0.1.2
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/LICENSE +21 -0
- package/README.md +154 -0
- package/dist/config.d.ts +104 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +248 -0
- package/dist/config.js.map +1 -0
- package/dist/connection.d.ts +49 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +126 -0
- package/dist/connection.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +15 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +57 -0
- package/dist/logger.js.map +1 -0
- package/dist/odata-client.d.ts +102 -0
- package/dist/odata-client.d.ts.map +1 -0
- package/dist/odata-client.js +226 -0
- package/dist/odata-client.js.map +1 -0
- package/dist/odata-parser.d.ts +64 -0
- package/dist/odata-parser.d.ts.map +1 -0
- package/dist/odata-parser.js +126 -0
- package/dist/odata-parser.js.map +1 -0
- package/dist/tools/configuration.d.ts +69 -0
- package/dist/tools/configuration.d.ts.map +1 -0
- package/dist/tools/configuration.js +221 -0
- package/dist/tools/configuration.js.map +1 -0
- package/dist/tools/connection.d.ts +66 -0
- package/dist/tools/connection.d.ts.map +1 -0
- package/dist/tools/connection.js +230 -0
- package/dist/tools/connection.js.map +1 -0
- package/dist/tools/index.d.ts +319 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +48 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/odata.d.ts +233 -0
- package/dist/tools/odata.d.ts.map +1 -0
- package/dist/tools/odata.js +404 -0
- package/dist/tools/odata.js.map +1 -0
- package/dist/transport.d.ts +18 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +138 -0
- package/dist/transport.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
2
|
+
import express from "express";
|
|
3
|
+
import https from "https";
|
|
4
|
+
import http from "http";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
/**
|
|
7
|
+
* Parse transport configuration from environment variables
|
|
8
|
+
*/
|
|
9
|
+
export function getTransportConfig() {
|
|
10
|
+
const transportType = (process.env.MCP_TRANSPORT || "stdio");
|
|
11
|
+
const config = {
|
|
12
|
+
type: transportType,
|
|
13
|
+
port: process.env.MCP_PORT ? parseInt(process.env.MCP_PORT, 10) : 3000,
|
|
14
|
+
host: process.env.MCP_HOST || "localhost",
|
|
15
|
+
certPath: process.env.MCP_CERT_PATH,
|
|
16
|
+
keyPath: process.env.MCP_KEY_PATH,
|
|
17
|
+
};
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create and connect transport based on configuration
|
|
22
|
+
*/
|
|
23
|
+
export async function setupTransport(server, config) {
|
|
24
|
+
switch (config.type) {
|
|
25
|
+
case "stdio":
|
|
26
|
+
await setupStdioTransport(server);
|
|
27
|
+
break;
|
|
28
|
+
case "http":
|
|
29
|
+
await setupHttpTransport(server, config);
|
|
30
|
+
break;
|
|
31
|
+
case "https":
|
|
32
|
+
await setupHttpsTransport(server, config);
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
throw new Error(`Unknown transport type: ${config.type}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Setup stdio transport (default, for local use)
|
|
40
|
+
*/
|
|
41
|
+
async function setupStdioTransport(server) {
|
|
42
|
+
const transport = new StdioServerTransport();
|
|
43
|
+
await server.connect(transport);
|
|
44
|
+
console.error("FMS-ODATA-MCP Server running on stdio");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Custom HTTP transport wrapper for MCP server
|
|
48
|
+
*/
|
|
49
|
+
class HttpTransportWrapper {
|
|
50
|
+
server;
|
|
51
|
+
app;
|
|
52
|
+
constructor(server, app) {
|
|
53
|
+
this.server = server;
|
|
54
|
+
this.app = app;
|
|
55
|
+
this.setupRoutes();
|
|
56
|
+
}
|
|
57
|
+
setupRoutes() {
|
|
58
|
+
// Health check endpoint
|
|
59
|
+
this.app.get("/health", (req, res) => {
|
|
60
|
+
res.json({ status: "ok", transport: "http", server: "fms-odata-mcp" });
|
|
61
|
+
});
|
|
62
|
+
// MCP endpoint - handles both GET and POST
|
|
63
|
+
this.app.post("/mcp", async (req, res) => {
|
|
64
|
+
try {
|
|
65
|
+
const request = req.body;
|
|
66
|
+
// The server processes requests through its tool handlers
|
|
67
|
+
// This is a simple echo/passthrough for now
|
|
68
|
+
res.json({
|
|
69
|
+
status: "ok",
|
|
70
|
+
message: "MCP request received",
|
|
71
|
+
request: request,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error("Error handling MCP request:", error);
|
|
76
|
+
res.status(500).json({
|
|
77
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
this.app.get("/mcp", (req, res) => {
|
|
82
|
+
res.json({
|
|
83
|
+
info: "FileMaker Server OData MCP Server",
|
|
84
|
+
transport: "http",
|
|
85
|
+
methods: ["POST"],
|
|
86
|
+
endpoint: "/mcp",
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Setup HTTP transport
|
|
93
|
+
*/
|
|
94
|
+
async function setupHttpTransport(server, config) {
|
|
95
|
+
const app = express();
|
|
96
|
+
// Middleware
|
|
97
|
+
app.use(express.json());
|
|
98
|
+
// Create transport wrapper
|
|
99
|
+
new HttpTransportWrapper(server, app);
|
|
100
|
+
const port = config.port || 3000;
|
|
101
|
+
const host = config.host || "localhost";
|
|
102
|
+
http.createServer(app).listen(port, host, () => {
|
|
103
|
+
console.error(`FMS-ODATA-MCP Server running on http://${host}:${port}`);
|
|
104
|
+
console.error(`MCP endpoint: http://${host}:${port}/mcp`);
|
|
105
|
+
console.error(`Health check: http://${host}:${port}/health`);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Setup HTTPS transport
|
|
110
|
+
*/
|
|
111
|
+
async function setupHttpsTransport(server, config) {
|
|
112
|
+
const app = express();
|
|
113
|
+
// Middleware
|
|
114
|
+
app.use(express.json());
|
|
115
|
+
// Create transport wrapper
|
|
116
|
+
new HttpTransportWrapper(server, app);
|
|
117
|
+
// Load certificates
|
|
118
|
+
if (!config.certPath || !config.keyPath) {
|
|
119
|
+
throw new Error("HTTPS transport requires MCP_CERT_PATH and MCP_KEY_PATH environment variables");
|
|
120
|
+
}
|
|
121
|
+
let cert;
|
|
122
|
+
let key;
|
|
123
|
+
try {
|
|
124
|
+
cert = fs.readFileSync(config.certPath);
|
|
125
|
+
key = fs.readFileSync(config.keyPath);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
throw new Error(`Failed to load HTTPS certificates: ${error instanceof Error ? error.message : String(error)}`);
|
|
129
|
+
}
|
|
130
|
+
const port = config.port || 3443;
|
|
131
|
+
const host = config.host || "localhost";
|
|
132
|
+
https.createServer({ cert, key }, app).listen(port, host, () => {
|
|
133
|
+
console.error(`FMS-ODATA-MCP Server running on https://${host}:${port}`);
|
|
134
|
+
console.error(`MCP endpoint: https://${host}:${port}/mcp`);
|
|
135
|
+
console.error(`Health check: https://${host}:${port}/health`);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,OAAuC,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,MAAM,O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
4
|
+
"description": "Model Context Protocol (MCP) server providing FileMaker Server OData 4.01 API integration with database introspection for AI agents. Compatible with Claude, Windsurf, Cursor, Cline, and other MCP-enabled assistants.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"fms-odata-mcp": "dist/bin/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"start": "node dist/index.js",
|
|
18
|
+
"dev": "tsc && node dist/index.js",
|
|
19
|
+
"watch": "tsc --watch",
|
|
20
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
21
|
+
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
22
|
+
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"mcp",
|
|
27
|
+
"model-context-protocol",
|
|
28
|
+
"filemaker",
|
|
29
|
+
"filemaker-server",
|
|
30
|
+
"odata",
|
|
31
|
+
"odata-4",
|
|
32
|
+
"rest-api",
|
|
33
|
+
"ai",
|
|
34
|
+
"claude",
|
|
35
|
+
"chatgpt",
|
|
36
|
+
"windsurf",
|
|
37
|
+
"cursor",
|
|
38
|
+
"cline",
|
|
39
|
+
"llm"
|
|
40
|
+
],
|
|
41
|
+
"author": "Francesc Sans <fsans@ntwk.es>",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/fsans/FMS-ODATA-MCP.git"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/fsans/FMS-ODATA-MCP/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/fsans/FMS-ODATA-MCP#readme",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
56
|
+
"axios": "^1.7.9",
|
|
57
|
+
"commander": "^12.1.0",
|
|
58
|
+
"debug": "^4.4.3",
|
|
59
|
+
"dotenv": "^16.4.7",
|
|
60
|
+
"express": "^4.18.2"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@jest/globals": "^30.2.0",
|
|
64
|
+
"@types/debug": "^4.1.12",
|
|
65
|
+
"@types/express": "^4.17.21",
|
|
66
|
+
"@types/jest": "^30.0.0",
|
|
67
|
+
"@types/node": "^22.10.5",
|
|
68
|
+
"jest": "^30.2.0",
|
|
69
|
+
"ts-jest": "^29.4.5",
|
|
70
|
+
"typescript": "^5.7.3"
|
|
71
|
+
}
|
|
72
|
+
}
|