@meldocio/mcp-stdio-proxy 1.0.22 → 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();
|
|
@@ -604,16 +599,6 @@ function getToolsList() {
|
|
|
604
599
|
type: 'object',
|
|
605
600
|
properties: {}
|
|
606
601
|
}
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
name: 'auth_login',
|
|
610
|
-
description: 'Start interactive login process. Opens browser for authentication. This is equivalent to running: npx @meldocio/mcp-stdio-proxy@latest auth login',
|
|
611
|
-
inputSchema: {
|
|
612
|
-
type: 'object',
|
|
613
|
-
properties: {
|
|
614
|
-
timeout: { type: 'integer', description: 'Timeout in milliseconds (default: 120000)' }
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
602
|
}
|
|
618
603
|
];
|
|
619
604
|
}
|
|
@@ -804,87 +789,6 @@ async function handleToolsCall(request) {
|
|
|
804
789
|
return;
|
|
805
790
|
}
|
|
806
791
|
|
|
807
|
-
if (toolName === 'auth_login') {
|
|
808
|
-
try {
|
|
809
|
-
const timeout = arguments_.timeout || 120000;
|
|
810
|
-
|
|
811
|
-
// Check if we can open browser
|
|
812
|
-
if (!canOpenBrowser()) {
|
|
813
|
-
const response = {
|
|
814
|
-
jsonrpc: '2.0',
|
|
815
|
-
id: request.id,
|
|
816
|
-
result: {
|
|
817
|
-
content: [
|
|
818
|
-
{
|
|
819
|
-
type: 'text',
|
|
820
|
-
text: JSON.stringify({
|
|
821
|
-
success: false,
|
|
822
|
-
error: 'Cannot open browser automatically. Please run the command manually: npx @meldocio/mcp-stdio-proxy@latest auth login'
|
|
823
|
-
}, null, 2)
|
|
824
|
-
}
|
|
825
|
-
]
|
|
826
|
-
}
|
|
827
|
-
};
|
|
828
|
-
process.stdout.write(JSON.stringify(response) + '\n');
|
|
829
|
-
if (process.stdout.isTTY) {
|
|
830
|
-
process.stdout.flush();
|
|
831
|
-
}
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
// Start interactive login
|
|
836
|
-
await interactiveLogin({
|
|
837
|
-
autoOpen: true,
|
|
838
|
-
showQR: false,
|
|
839
|
-
timeout: timeout,
|
|
840
|
-
apiBaseUrl: apiUrl,
|
|
841
|
-
appUrl: appUrl
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
const response = {
|
|
845
|
-
jsonrpc: '2.0',
|
|
846
|
-
id: request.id,
|
|
847
|
-
result: {
|
|
848
|
-
content: [
|
|
849
|
-
{
|
|
850
|
-
type: 'text',
|
|
851
|
-
text: JSON.stringify({
|
|
852
|
-
success: true,
|
|
853
|
-
message: 'Authentication successful! You are now logged in to Meldoc.'
|
|
854
|
-
}, null, 2)
|
|
855
|
-
}
|
|
856
|
-
]
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
process.stdout.write(JSON.stringify(response) + '\n');
|
|
860
|
-
if (process.stdout.isTTY) {
|
|
861
|
-
process.stdout.flush();
|
|
862
|
-
}
|
|
863
|
-
} catch (error) {
|
|
864
|
-
const response = {
|
|
865
|
-
jsonrpc: '2.0',
|
|
866
|
-
id: request.id,
|
|
867
|
-
result: {
|
|
868
|
-
content: [
|
|
869
|
-
{
|
|
870
|
-
type: 'text',
|
|
871
|
-
text: JSON.stringify({
|
|
872
|
-
success: false,
|
|
873
|
-
error: error.message || 'Authentication failed',
|
|
874
|
-
hint: 'You can try again or run: npx @meldocio/mcp-stdio-proxy@latest auth login'
|
|
875
|
-
}, null, 2)
|
|
876
|
-
}
|
|
877
|
-
]
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
process.stdout.write(JSON.stringify(response) + '\n');
|
|
881
|
-
if (process.stdout.isTTY) {
|
|
882
|
-
process.stdout.flush();
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
return;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
792
|
// All other tools are forwarded to backend
|
|
889
793
|
log(LOG_LEVELS.DEBUG, `Forwarding tool ${toolName} to backend (not a local tool)`);
|
|
890
794
|
await processSingleRequest(request);
|
|
@@ -900,57 +804,6 @@ async function handleToolsCall(request) {
|
|
|
900
804
|
}
|
|
901
805
|
}
|
|
902
806
|
|
|
903
|
-
/**
|
|
904
|
-
* Attempt automatic authentication if conditions are met
|
|
905
|
-
* @returns {Promise<boolean>} True if authentication was attempted and succeeded
|
|
906
|
-
*/
|
|
907
|
-
async function attemptAutoAuth() {
|
|
908
|
-
// Only attempt once per session
|
|
909
|
-
if (autoAuthAttempted || autoAuthInProgress) {
|
|
910
|
-
return false;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
// Only in interactive mode (TTY) and not in CI
|
|
914
|
-
if (!canOpenBrowser()) {
|
|
915
|
-
return false;
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
// Check if NO_AUTO_AUTH is set
|
|
919
|
-
if (process.env.NO_AUTO_AUTH === '1' || process.env.NO_AUTO_AUTH === 'true') {
|
|
920
|
-
return false;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
// Check if token already exists
|
|
924
|
-
const tokenInfo = await getAccessToken();
|
|
925
|
-
if (tokenInfo) {
|
|
926
|
-
return false;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
autoAuthAttempted = true;
|
|
930
|
-
autoAuthInProgress = true;
|
|
931
|
-
|
|
932
|
-
try {
|
|
933
|
-
log(LOG_LEVELS.INFO, '🔐 First time setup - authentication required');
|
|
934
|
-
process.stderr.write('\n');
|
|
935
|
-
|
|
936
|
-
await interactiveLogin({
|
|
937
|
-
autoOpen: true,
|
|
938
|
-
showQR: false,
|
|
939
|
-
timeout: 120000,
|
|
940
|
-
apiBaseUrl: apiUrl,
|
|
941
|
-
appUrl: appUrl
|
|
942
|
-
});
|
|
943
|
-
|
|
944
|
-
autoAuthInProgress = false;
|
|
945
|
-
return true;
|
|
946
|
-
} catch (error) {
|
|
947
|
-
autoAuthInProgress = false;
|
|
948
|
-
log(LOG_LEVELS.WARN, `Auto-authentication failed: ${error.message}`);
|
|
949
|
-
log(LOG_LEVELS.INFO, 'You can authenticate manually: npx @meldocio/mcp-stdio-proxy@latest auth login');
|
|
950
|
-
return false;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
|
|
954
807
|
/**
|
|
955
808
|
* Process a single JSON-RPC request
|
|
956
809
|
* Forwards the request to the backend MCP API
|
|
@@ -958,18 +811,9 @@ async function attemptAutoAuth() {
|
|
|
958
811
|
async function processSingleRequest(request) {
|
|
959
812
|
// Get access token with priority and auto-refresh
|
|
960
813
|
let tokenInfo = await getAccessToken();
|
|
961
|
-
|
|
962
|
-
// If no token and we haven't attempted auto-auth, try it
|
|
963
|
-
if (!tokenInfo && !autoAuthAttempted && !autoAuthInProgress) {
|
|
964
|
-
const authSucceeded = await attemptAutoAuth();
|
|
965
|
-
if (authSucceeded) {
|
|
966
|
-
// Retry getting token after successful auth
|
|
967
|
-
tokenInfo = await getAccessToken();
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
|
|
814
|
+
|
|
971
815
|
if (!tokenInfo) {
|
|
972
|
-
sendError(request.id, CUSTOM_ERROR_CODES.AUTH_REQUIRED,
|
|
816
|
+
sendError(request.id, CUSTOM_ERROR_CODES.AUTH_REQUIRED,
|
|
973
817
|
'Meldoc token not found. Set MELDOC_ACCESS_TOKEN environment variable or run: npx @meldocio/mcp-stdio-proxy@latest auth login', {
|
|
974
818
|
code: 'AUTH_REQUIRED',
|
|
975
819
|
hint: 'Use meldoc.auth_login_instructions tool to get login command'
|
package/package.json
CHANGED