@anyknown/mcp 0.2.0 → 0.3.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 CHANGED
@@ -9,7 +9,7 @@ Each server has one `auth`: `none`, `bearer`, `api_key` (a header or query param
9
9
 
10
10
  It has no public URL. The only way in is product's `MCP` service binding, which calls the `Hub` `WorkerEntrypoint` over RPC (`src/rpc/`). Product owns authentication, scope checks (`mcp:use`, `product:admin`), request validation, activity and the OAuth cookie; the hub trusts the `userId` product passes.
11
11
 
12
- Tokens, API keys, basic credentials and OAuth client secrets are sealed to the user's public key under the server id and opened only through product's `KeyringMcp` entrypoint (`KEYRING`, a service binding to `product` / `product-staging` that exposes only `seal` / `open` for kind `mcp`), so that entrypoint has to be deployed before this worker. The OAuth cookie carries the client id but never the secret; the hub opens the client secret itself when it exchanges the code. Disconnecting or removing a server drops its OAuth client along with its credential. A locked Keyring is `key_locked` (423); a user with no public key yet is `no_user_key` (409).
12
+ Tokens, API keys, basic credentials and OAuth client secrets are sealed to the user's public key under the server id and opened only through product's `KeyringMcp` entrypoint (`KEYRING`, a service binding to `product` / `product-staging` that exposes only `seal` / `open` for kind `mcp`), so that entrypoint has to be deployed before this worker. The OAuth cookie carries the client id and, when connect brings a new client, its secret sealed the same way (never in the clear); the hub opens it itself when it exchanges the code, and saves the client with the credential only once the sign-in completes, so an abandoned sign-in leaves the working client alone. A refresh sends the saved secret only when it belongs to the credential's client id. Disconnecting or removing a server drops its OAuth client along with its credential. A locked Keyring is `key_locked` (423); a user with no public key yet is `no_user_key` (409).
13
13
 
14
14
  ## Where tools come from
15
15
 
@@ -5,6 +5,7 @@ export declare const JSON_MAX_BYTES = 4000000;
5
5
  export declare const YAML_MAX_BYTES = 512000;
6
6
  export declare const SDL_MAX_BYTES = 512000;
7
7
  export declare const INTROSPECTION_MAX_BYTES = 8000000;
8
+ export declare const OAUTH_JSON_MAX_BYTES = 1000000;
8
9
  export declare const TOOLS_MAX = 500;
9
10
  export declare const INPUT_SCHEMA_MAX = 64000;
10
11
  export declare const DESCRIPTION_MAX = 1000;
@@ -1,6 +1,6 @@
1
1
  export { applyAuth } from "./apply-auth";
2
2
  export { callTool } from "./call-tool";
3
- export { ARG_ERRORS_MAX, DELETE_BATCH, DESCRIPTION_MAX, INPUT_SCHEMA_MAX, INTROSPECTION_MAX_BYTES, JSON_MAX_BYTES, KINDS, MAX_PAGES, NO_SESSION, RESULT_TEXT_MAX, SDL_MAX_BYTES, TOOL_NAME_MAX, TOOLS_MAX, YAML_MAX_BYTES, } from "./constants";
3
+ export { ARG_ERRORS_MAX, DELETE_BATCH, DESCRIPTION_MAX, INPUT_SCHEMA_MAX, INTROSPECTION_MAX_BYTES, JSON_MAX_BYTES, KINDS, MAX_PAGES, NO_SESSION, OAUTH_JSON_MAX_BYTES, RESULT_TEXT_MAX, SDL_MAX_BYTES, TOOL_NAME_MAX, TOOLS_MAX, YAML_MAX_BYTES, } from "./constants";
4
4
  export { callGraphql, readGraphql } from "./graphql";
5
5
  export { callMcpTool, listMcpTools, mcpRequest } from "./mcp";
6
6
  export type { McpSession } from "./mcp";
@@ -3,4 +3,5 @@ import type { McpSession } from "./types";
3
3
  export declare function listMcpTools(upstream: Upstream, session: McpSession): Promise<{
4
4
  tools: UpstreamTool[];
5
5
  session: McpSession;
6
+ complete: boolean;
6
7
  }>;
@@ -0,0 +1 @@
1
+ export declare function cappedJson(response: Response): Promise<unknown>;
@@ -64,6 +64,7 @@ export type ReadResult = {
64
64
  dropped: number;
65
65
  defaults: SpecDefaults;
66
66
  session: McpSession | null;
67
+ complete: boolean;
67
68
  };
68
69
  export type ToolRow = {
69
70
  server_id: string;
package/dist/public.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { AdminServerItem, ApiKeySettings, CallInput, CompleteOauthInput, ConnectInput, ConnectResult, CreatedServer, CreateServerInput, DescribedItem, HubResult, McpServerRow, OauthSettings, OwnServerInput, SearchInput, ServerItem, ToolHit, ToolItem, Transient, } from "./rpc/types";
1
+ export type { AdminServerItem, ApiKeySettings, CallInput, CompleteOauthInput, ConnectInput, ConnectResult, CreatedServer, CreateServerInput, DescribedItem, HubResult, McpServerRow, OauthSettings, SearchInput, ServerItem, ToolHit, ToolItem, Transient, } from "./rpc/types";
2
2
  export type { McpHubRpc } from "./rpc/hub-rpc";
3
3
  export type { McpAuth, McpConnectionStatus, McpKind } from "./schema";
4
4
  export type { McpErrorCode } from "./errors";
@@ -1,4 +1,4 @@
1
- import type { AdminServerInput, AdminServerItem, CallInput, CompleteOauthInput, ConnectInput, ConnectResult, CreatedServer, CreateServerInput, DescribedItem, HubResult, McpServerRow, OwnServerInput, SearchInput, ServerItem, ToolHit, ToolItem } from "./types";
1
+ import type { AdminServerInput, AdminServerItem, CallInput, CompleteOauthInput, ConnectInput, ConnectResult, CreatedServer, CreateServerInput, DescribedItem, HubResult, McpServerRow, SearchInput, ServerItem, ToolHit, ToolItem } from "./types";
2
2
  export interface McpHubRpc {
3
3
  search(userId: string, input: SearchInput): Promise<HubResult<ToolHit[]>>;
4
4
  describe(userId: string, tools: string[]): Promise<HubResult<{
@@ -10,7 +10,6 @@ export interface McpHubRpc {
10
10
  serverTools(userId: string, serverId: string): Promise<HubResult<{
11
11
  items: ToolItem[];
12
12
  }>>;
13
- addServer(userId: string, input: OwnServerInput): Promise<McpServerRow>;
14
13
  createServer(userId: string, input: CreateServerInput): Promise<HubResult<CreatedServer>>;
15
14
  connectServer(userId: string, serverId: string, input: ConnectInput): Promise<HubResult<ConnectResult>>;
16
15
  completeOauth(userId: string, input: CompleteOauthInput): Promise<HubResult<{
@@ -20,6 +20,7 @@ export type Transient = {
20
20
  token_endpoint: string;
21
21
  resource: string;
22
22
  client_id: string;
23
+ client_secret_sealed?: string | null;
23
24
  exp: number;
24
25
  };
25
26
  export type SearchInput = {
@@ -59,11 +60,6 @@ export type ToolItem = {
59
60
  description: string;
60
61
  annotations: unknown;
61
62
  };
62
- export type OwnServerInput = {
63
- name: string;
64
- url: string;
65
- auth: McpAuth;
66
- };
67
63
  export type ApiKeySettings = {
68
64
  in: "header" | "query";
69
65
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anyknown/mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/anyknown-com/mcp.git"