@inner-security/mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Inner Security
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @inner-security/mcp — Inner MCP server
2
+
3
+ A **thin client** of Inner's Verdict API, exposed over the
4
+ [Model Context Protocol](https://modelcontextprotocol.io) (stdio). It lets a
5
+ coding agent get a verdict + a suggested safer alternative **before** it installs
6
+ a package.
7
+
8
+ All detection, scoring, and auth live **server-side**. This package ships no
9
+ detection logic — it only consumes the Verdict API. Real usage is **gated by an
10
+ Inner org API key** (the Datadog model).
11
+
12
+ ## Tools
13
+
14
+ | Tool | Purpose |
15
+ |------|---------|
16
+ | `check_package` | `(ecosystem, name, version)` → verdict + an alternative when blocked |
17
+ | `check_dependencies` | manifest/lockfile or explicit list → per-package verdicts + tally |
18
+ | `explain_verdict` | a package → deep-insight reasoning (behaviors + evidence) |
19
+ | `suggest_alternative` | a blocked package → a safer alternative |
20
+ | `request_review` | a package → records a review request |
21
+
22
+ ## Run
23
+
24
+ Requires **Node >= 20**. The server speaks MCP over stdio via the `inner-mcp` bin.
25
+
26
+ ```bash
27
+ npx @inner-security/mcp # or: npm i -g @inner-security/mcp && inner-mcp
28
+ ```
29
+
30
+ ### Wire into an MCP client
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "inner": {
36
+ "command": "npx",
37
+ "args": ["-y", "@inner-security/mcp"],
38
+ "env": {
39
+ "INNER_API_KEY": "ik_...",
40
+ "INNER_API_URL": "https://verdict.inner.example"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Configuration
48
+
49
+ Env-configurable; **defaults to dev values today** and flips to Inner's prod
50
+ hosts once they are live (PROD-WIRING 3/4/12):
51
+
52
+ | Env | Purpose | Default (dev) |
53
+ |-----|---------|---------------|
54
+ | `INNER_API_URL` | Verdict API base URL | `http://localhost:8787` (the local `verdict-api-mock`) |
55
+ | `INNER_API_KEY` | Org API key (gates real verdicts) | (none) |
56
+
57
+ ## How verdicts resolve
58
+
59
+ Package-verdict tools call `POST /v1/verdict` and handle the
60
+ `VerdictEnvelope | PendingResponse` envelope, polling `PENDING` items with a
61
+ per-request timeout. No local cache (unlike the CLI).
62
+
63
+ ## License
64
+
65
+ MIT © 2026 Inner Security. See [LICENSE](./LICENSE).
@@ -0,0 +1,136 @@
1
+ import { VerdictClient, VerdictClientOptions } from '@inner/verdict-client';
2
+ export { DEFAULT_API_URL, VerdictClient, VerdictClientOptions, isEnvelope, isPending } from '@inner/verdict-client';
3
+ import { Ecosystem, VerdictRequestItem, Status, Action, BehaviorFinding, VerdictEnvelope } from '@inner/contracts';
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+
6
+ interface AlternativeSuggestion {
7
+ ecosystem: Ecosystem;
8
+ /** The package the agent asked about. */
9
+ requested: string;
10
+ /** Suggested safer package name, or null when nothing confident is known. */
11
+ suggestion: string | null;
12
+ /** Why this suggestion (or why none). */
13
+ rationale: string;
14
+ /** How the suggestion was derived. 'curated' = hand-picked map; 'none' = no match. */
15
+ source: 'curated' | 'none';
16
+ }
17
+ /**
18
+ * Suggest a safer alternative for a (usually blocked) package.
19
+ * Pure + synchronous so it can be unit-tested and reused by check_package.
20
+ */
21
+ declare function suggestAlternative(ecosystem: Ecosystem, name: string): AlternativeSuggestion;
22
+
23
+ interface ParseDepsInput {
24
+ /** Raw file contents (package.json / package-lock.json / requirements.txt). */
25
+ content?: string;
26
+ /** Hint for which parser to use; inferred from content when omitted. */
27
+ format?: 'package.json' | 'package-lock.json' | 'requirements.txt';
28
+ /** Ecosystem hint for ambiguous inputs (default inferred, fallback 'npm'). */
29
+ ecosystem?: Ecosystem;
30
+ /** Explicit package list (bypasses parsing). */
31
+ packages?: VerdictRequestItem[];
32
+ }
33
+ /** Back-compat: just the resolvable items (warnings dropped). */
34
+ declare function parseDependencies(input: ParseDepsInput): VerdictRequestItem[];
35
+
36
+ interface PackageVerdict {
37
+ ecosystem: Ecosystem;
38
+ name: string;
39
+ version: string;
40
+ /** True when the verdict never resolved (still PENDING after polling). */
41
+ pending: boolean;
42
+ status?: Status;
43
+ action: Action;
44
+ confidence?: number;
45
+ behaviors?: BehaviorFinding[];
46
+ policy_decision?: VerdictEnvelope['policy_decision'];
47
+ provisional?: boolean;
48
+ /** Present when the package is blocked/under-review. */
49
+ suggested_alternative?: AlternativeSuggestion;
50
+ /** Human-readable one-liner the agent can act on. */
51
+ summary: string;
52
+ }
53
+ interface CheckPackageArgs {
54
+ ecosystem: Ecosystem;
55
+ name: string;
56
+ version: string;
57
+ }
58
+ declare function checkPackage(client: VerdictClient, args: CheckPackageArgs): Promise<PackageVerdict>;
59
+ interface CheckDependenciesArgs extends ParseDepsInput {
60
+ }
61
+ interface DependencyTally {
62
+ total: number;
63
+ allow: number;
64
+ review: number;
65
+ block: number;
66
+ pending: number;
67
+ }
68
+ interface CheckDependenciesResult {
69
+ tally: DependencyTally;
70
+ verdicts: PackageVerdict[];
71
+ /** True if any package is BLOCK/REVIEW or unresolved PENDING. */
72
+ has_risk: boolean;
73
+ /** Count of manifest entries skipped (unresolvable spec — NOT scanned). */
74
+ skipped: number;
75
+ /** One line per skipped entry, so the agent can surface what wasn't checked. */
76
+ warnings: string[];
77
+ }
78
+ declare function checkDependencies(client: VerdictClient, args: CheckDependenciesArgs): Promise<CheckDependenciesResult>;
79
+ interface ExplainVerdictArgs {
80
+ ecosystem: Ecosystem;
81
+ name: string;
82
+ version: string;
83
+ }
84
+ interface VerdictExplanation {
85
+ ecosystem: Ecosystem;
86
+ name: string;
87
+ version: string;
88
+ pending: boolean;
89
+ status?: Status;
90
+ action?: Action;
91
+ confidence?: number;
92
+ corroboration?: VerdictEnvelope['corroboration'];
93
+ assurance?: VerdictEnvelope['assurance'];
94
+ provisional?: boolean;
95
+ /** Each behavior with its severity + the trace it cites. */
96
+ behaviors?: {
97
+ category: string;
98
+ severity: string;
99
+ evidence_ref: string;
100
+ }[];
101
+ capabilities?: VerdictEnvelope['capabilities'];
102
+ reasoning?: string;
103
+ evidence_uri?: string;
104
+ /** Narrative explanation the agent can show the user. */
105
+ explanation: string;
106
+ }
107
+ declare function explainVerdict(client: VerdictClient, args: ExplainVerdictArgs): Promise<VerdictExplanation>;
108
+ interface SuggestAlternativeArgs {
109
+ ecosystem: Ecosystem;
110
+ name: string;
111
+ }
112
+ declare function suggestAlternativeHandler(args: SuggestAlternativeArgs): AlternativeSuggestion;
113
+ interface ReviewRequest {
114
+ id: string;
115
+ ecosystem: Ecosystem;
116
+ name: string;
117
+ version?: string;
118
+ reason?: string;
119
+ requested_at: string;
120
+ }
121
+ interface RequestReviewArgs {
122
+ ecosystem: Ecosystem;
123
+ name: string;
124
+ version?: string;
125
+ reason?: string;
126
+ }
127
+ declare class ReviewStore {
128
+ private readonly reviews;
129
+ record(args: RequestReviewArgs): ReviewRequest;
130
+ list(): ReviewRequest[];
131
+ }
132
+
133
+ /** Build the MCP server with all 5 tools registered. Injectable client opts for tests. */
134
+ declare function buildServer(clientOpts?: VerdictClientOptions): McpServer;
135
+
136
+ export { type AlternativeSuggestion, type CheckDependenciesArgs, type CheckDependenciesResult, type CheckPackageArgs, type DependencyTally, type ExplainVerdictArgs, type PackageVerdict, type ParseDepsInput, type RequestReviewArgs, type ReviewRequest, ReviewStore, type SuggestAlternativeArgs, type VerdictExplanation, buildServer, checkDependencies, checkPackage, explainVerdict, parseDependencies, suggestAlternative, suggestAlternativeHandler };