@meldocio/mcp-stdio-proxy 1.0.21 → 1.0.23
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.
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"source": "github",
|
|
15
15
|
"repo": "meldoc-io/mcp-stdio-proxy"
|
|
16
16
|
},
|
|
17
|
-
"version": "1.0.
|
|
17
|
+
"version": "1.0.23",
|
|
18
18
|
"description": "Connect Claude Desktop, Claude Code, and other MCP clients to your Meldoc documentation workspace. Read, search, create, and update your documentation directly from AI conversations.",
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Meldoc",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meldoc-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "Connect Claude Desktop, Claude Code, and other MCP clients to your Meldoc documentation workspace. Read, search, create, and update your documentation directly from AI conversations through the Model Context Protocol.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Meldoc",
|
package/bin/meldoc-mcp-proxy.js
CHANGED
|
@@ -68,7 +68,6 @@ const { getAccessToken, getAuthStatus } = require('../lib/auth');
|
|
|
68
68
|
const { resolveWorkspaceAlias } = require('../lib/workspace');
|
|
69
69
|
const { getApiUrl, getAppUrl } = require('../lib/constants');
|
|
70
70
|
const { setWorkspaceAlias, getWorkspaceAlias } = require('../lib/config');
|
|
71
|
-
const { interactiveLogin, canOpenBrowser } = require('../lib/device-flow');
|
|
72
71
|
|
|
73
72
|
// Configuration
|
|
74
73
|
const apiUrl = getApiUrl();
|
|
@@ -77,10 +76,6 @@ const rpcEndpoint = `${apiUrl}/mcp/v1/rpc`;
|
|
|
77
76
|
const REQUEST_TIMEOUT = 25000; // 25 seconds (less than Claude Desktop's 30s timeout)
|
|
78
77
|
const LOG_LEVEL = getLogLevel(process.env.LOG_LEVEL || 'ERROR');
|
|
79
78
|
|
|
80
|
-
// Track if we've attempted auto-authentication
|
|
81
|
-
let autoAuthAttempted = false;
|
|
82
|
-
let autoAuthInProgress = false;
|
|
83
|
-
|
|
84
79
|
// Get log level from environment
|
|
85
80
|
function getLogLevel(level) {
|
|
86
81
|
const upper = (level || '').toUpperCase();
|
|
@@ -793,7 +788,7 @@ async function handleToolsCall(request) {
|
|
|
793
788
|
}
|
|
794
789
|
return;
|
|
795
790
|
}
|
|
796
|
-
|
|
791
|
+
|
|
797
792
|
// All other tools are forwarded to backend
|
|
798
793
|
log(LOG_LEVELS.DEBUG, `Forwarding tool ${toolName} to backend (not a local tool)`);
|
|
799
794
|
await processSingleRequest(request);
|
|
@@ -809,57 +804,6 @@ async function handleToolsCall(request) {
|
|
|
809
804
|
}
|
|
810
805
|
}
|
|
811
806
|
|
|
812
|
-
/**
|
|
813
|
-
* Attempt automatic authentication if conditions are met
|
|
814
|
-
* @returns {Promise<boolean>} True if authentication was attempted and succeeded
|
|
815
|
-
*/
|
|
816
|
-
async function attemptAutoAuth() {
|
|
817
|
-
// Only attempt once per session
|
|
818
|
-
if (autoAuthAttempted || autoAuthInProgress) {
|
|
819
|
-
return false;
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
// Only in interactive mode (TTY) and not in CI
|
|
823
|
-
if (!canOpenBrowser()) {
|
|
824
|
-
return false;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
// Check if NO_AUTO_AUTH is set
|
|
828
|
-
if (process.env.NO_AUTO_AUTH === '1' || process.env.NO_AUTO_AUTH === 'true') {
|
|
829
|
-
return false;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
// Check if token already exists
|
|
833
|
-
const tokenInfo = await getAccessToken();
|
|
834
|
-
if (tokenInfo) {
|
|
835
|
-
return false;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
autoAuthAttempted = true;
|
|
839
|
-
autoAuthInProgress = true;
|
|
840
|
-
|
|
841
|
-
try {
|
|
842
|
-
log(LOG_LEVELS.INFO, '🔐 First time setup - authentication required');
|
|
843
|
-
process.stderr.write('\n');
|
|
844
|
-
|
|
845
|
-
await interactiveLogin({
|
|
846
|
-
autoOpen: true,
|
|
847
|
-
showQR: false,
|
|
848
|
-
timeout: 120000,
|
|
849
|
-
apiBaseUrl: apiUrl,
|
|
850
|
-
appUrl: appUrl
|
|
851
|
-
});
|
|
852
|
-
|
|
853
|
-
autoAuthInProgress = false;
|
|
854
|
-
return true;
|
|
855
|
-
} catch (error) {
|
|
856
|
-
autoAuthInProgress = false;
|
|
857
|
-
log(LOG_LEVELS.WARN, `Auto-authentication failed: ${error.message}`);
|
|
858
|
-
log(LOG_LEVELS.INFO, 'You can authenticate manually: npx @meldocio/mcp-stdio-proxy@latest auth login');
|
|
859
|
-
return false;
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
|
|
863
807
|
/**
|
|
864
808
|
* Process a single JSON-RPC request
|
|
865
809
|
* Forwards the request to the backend MCP API
|
|
@@ -867,18 +811,9 @@ async function attemptAutoAuth() {
|
|
|
867
811
|
async function processSingleRequest(request) {
|
|
868
812
|
// Get access token with priority and auto-refresh
|
|
869
813
|
let tokenInfo = await getAccessToken();
|
|
870
|
-
|
|
871
|
-
// If no token and we haven't attempted auto-auth, try it
|
|
872
|
-
if (!tokenInfo && !autoAuthAttempted && !autoAuthInProgress) {
|
|
873
|
-
const authSucceeded = await attemptAutoAuth();
|
|
874
|
-
if (authSucceeded) {
|
|
875
|
-
// Retry getting token after successful auth
|
|
876
|
-
tokenInfo = await getAccessToken();
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
|
|
814
|
+
|
|
880
815
|
if (!tokenInfo) {
|
|
881
|
-
sendError(request.id, CUSTOM_ERROR_CODES.AUTH_REQUIRED,
|
|
816
|
+
sendError(request.id, CUSTOM_ERROR_CODES.AUTH_REQUIRED,
|
|
882
817
|
'Meldoc token not found. Set MELDOC_ACCESS_TOKEN environment variable or run: npx @meldocio/mcp-stdio-proxy@latest auth login', {
|
|
883
818
|
code: 'AUTH_REQUIRED',
|
|
884
819
|
hint: 'Use meldoc.auth_login_instructions tool to get login command'
|
package/package.json
CHANGED