@markmnl/fmsg-mcp 1.2.2 → 1.2.3
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/dist/http.js +2 -2
- package/dist/oauth/errors.d.ts +2 -0
- package/dist/oauth/errors.js +4 -0
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/http.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createMcpHandler, hostHeaderValidationResponse, localhostAllowedHostnam
|
|
|
4
4
|
import { ApiKeyCallerProvider, FMSG_SCOPE } from "./auth.js";
|
|
5
5
|
import { createFmsgMcpServer } from "./server.js";
|
|
6
6
|
import { OAuthCallerProvider } from "./oauth/provider.js";
|
|
7
|
-
import { invalidToken, insufficientScope, missingToken, OAuthRequestError, oauthErrorResponse, oauthRequestState } from "./oauth/errors.js";
|
|
7
|
+
import { invalidToken, insufficientScope, missingToken, notBearer, OAuthRequestError, oauthErrorResponse, oauthRequestState } from "./oauth/errors.js";
|
|
8
8
|
import { MESSAGING_SCOPES, READ_SCOPE, WRITE_SCOPE, requestScopes } from "./oauth/scopes.js";
|
|
9
9
|
import { DOWNLOAD_PATH, downloadBaseUrl, downloadHeaders, parseDownloadPath } from "./download.js";
|
|
10
10
|
import { CHECKSUM_HEADER, UPLOAD_DRAIN_IDLE_MS, UPLOAD_PATH, UploadBodyError, decodedUploadBody, drainableBody, parseUploadPath, uploadEncoding } from "./upload.js";
|
|
@@ -350,7 +350,7 @@ export function createHttpServer(config, log = (l) => console.error(l)) {
|
|
|
350
350
|
try {
|
|
351
351
|
const bearer = /^Bearer ([A-Za-z0-9._~+\/-]+=*)$/iu.exec(authorization);
|
|
352
352
|
if (!bearer)
|
|
353
|
-
throw authorization ? invalidToken() :
|
|
353
|
+
throw !authorization ? missingToken() : /^Bearer\s/iu.test(authorization) ? invalidToken() : notBearer(!!apiKeyProvider);
|
|
354
354
|
const authenticated = await oauthProvider.verifyAccessToken(bearer[1]);
|
|
355
355
|
release = () => oauthProvider.release(authenticated);
|
|
356
356
|
let parsedBody;
|
package/dist/oauth/errors.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export declare class OAuthRequestError extends Error {
|
|
|
14
14
|
constructor(status: 401 | 403 | 500 | 503, code: string, message: string, scopes?: string[]);
|
|
15
15
|
}
|
|
16
16
|
export declare const invalidToken: () => OAuthRequestError;
|
|
17
|
+
/** An Authorization header without the Bearer scheme, such as a bare API key. */
|
|
18
|
+
export declare const notBearer: (apiKeys: boolean) => OAuthRequestError;
|
|
17
19
|
export declare const missingToken: () => OAuthRequestError;
|
|
18
20
|
export declare const insufficientScope: (scopes: string[]) => OAuthRequestError;
|
|
19
21
|
export declare function oauthErrorResponse(error: OAuthRequestError, metadataUrl: string): Response;
|
package/dist/oauth/errors.js
CHANGED
|
@@ -27,6 +27,10 @@ export class OAuthRequestError extends Error {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
export const invalidToken = () => new OAuthRequestError(401, "invalid_token", "The OAuth connection must be refreshed or reconnected.");
|
|
30
|
+
/** An Authorization header without the Bearer scheme, such as a bare API key. */
|
|
31
|
+
export const notBearer = (apiKeys) => new OAuthRequestError(401, "invalid_token", apiKeys
|
|
32
|
+
? "The Authorization header must be `Bearer <token>`; send an API key as `Authorization: Bearer fmsgk_...`."
|
|
33
|
+
: "The Authorization header must be `Bearer <token>`.");
|
|
30
34
|
export const missingToken = () => new OAuthRequestError(401, "invalid_token", "No access token was sent; send this MCP connection's Authorization header.");
|
|
31
35
|
export const insufficientScope = (scopes) => new OAuthRequestError(403, "insufficient_scope", "The OAuth connection does not authorize this operation.", scopes);
|
|
32
36
|
export function oauthErrorResponse(error, metadataUrl) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markmnl/fmsg-mcp",
|
|
3
3
|
"mcpName": "io.github.markmnl/fmsg-mcp",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.3",
|
|
5
5
|
"description": "MCP server for fmsg: send and receive federated messages from any AI agent via a deployed fmsg Web API",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
package/server.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"url": "https://github.com/markmnl/fmsg-mcp",
|
|
9
9
|
"source": "github"
|
|
10
10
|
},
|
|
11
|
-
"version": "1.2.
|
|
11
|
+
"version": "1.2.3",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "@markmnl/fmsg-mcp",
|
|
17
|
-
"version": "1.2.
|
|
17
|
+
"version": "1.2.3",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
},
|