@aristanetworks/eos-mcp-server 0.6.1-beta

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.
Files changed (170) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/LICENSE +203 -0
  3. package/README.md +652 -0
  4. package/dist/cli.d.ts +16 -0
  5. package/dist/cli.js +188 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/printServerInfo.d.ts +2 -0
  8. package/dist/commands/printServerInfo.js +14 -0
  9. package/dist/commands/printServerInfo.js.map +1 -0
  10. package/dist/commands/probe.d.ts +2 -0
  11. package/dist/commands/probe.js +26 -0
  12. package/dist/commands/probe.js.map +1 -0
  13. package/dist/commands/validateInventory.d.ts +9 -0
  14. package/dist/commands/validateInventory.js +59 -0
  15. package/dist/commands/validateInventory.js.map +1 -0
  16. package/dist/config/loadConfig.d.ts +3 -0
  17. package/dist/config/loadConfig.js +84 -0
  18. package/dist/config/loadConfig.js.map +1 -0
  19. package/dist/config/schema.d.ts +151 -0
  20. package/dist/config/schema.js +54 -0
  21. package/dist/config/schema.js.map +1 -0
  22. package/dist/configuration/getRunningConfig.d.ts +24 -0
  23. package/dist/configuration/getRunningConfig.js +38 -0
  24. package/dist/configuration/getRunningConfig.js.map +1 -0
  25. package/dist/connection/eosDeviceReader.d.ts +18 -0
  26. package/dist/connection/eosDeviceReader.js +13 -0
  27. package/dist/connection/eosDeviceReader.js.map +1 -0
  28. package/dist/connection/resolveConnection.d.ts +4 -0
  29. package/dist/connection/resolveConnection.js +58 -0
  30. package/dist/connection/resolveConnection.js.map +1 -0
  31. package/dist/connection/validateStartupConnections.d.ts +4 -0
  32. package/dist/connection/validateStartupConnections.js +28 -0
  33. package/dist/connection/validateStartupConnections.js.map +1 -0
  34. package/dist/core/errors.d.ts +8 -0
  35. package/dist/core/errors.js +22 -0
  36. package/dist/core/errors.js.map +1 -0
  37. package/dist/core/version.d.ts +2 -0
  38. package/dist/core/version.js +7 -0
  39. package/dist/core/version.js.map +1 -0
  40. package/dist/eapi/client.d.ts +8 -0
  41. package/dist/eapi/client.js +159 -0
  42. package/dist/eapi/client.js.map +1 -0
  43. package/dist/eapi/commands.d.ts +2 -0
  44. package/dist/eapi/commands.js +25 -0
  45. package/dist/eapi/commands.js.map +1 -0
  46. package/dist/eapi/transport.d.ts +21 -0
  47. package/dist/eapi/transport.js +143 -0
  48. package/dist/eapi/transport.js.map +1 -0
  49. package/dist/eapi/types.d.ts +49 -0
  50. package/dist/eapi/types.js +15 -0
  51. package/dist/eapi/types.js.map +1 -0
  52. package/dist/facts/getFacts.d.ts +33 -0
  53. package/dist/facts/getFacts.js +50 -0
  54. package/dist/facts/getFacts.js.map +1 -0
  55. package/dist/index.d.ts +2 -0
  56. package/dist/index.js +66 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/inventory/buildModel.d.ts +3 -0
  59. package/dist/inventory/buildModel.js +79 -0
  60. package/dist/inventory/buildModel.js.map +1 -0
  61. package/dist/inventory/effectiveVars.d.ts +2 -0
  62. package/dist/inventory/effectiveVars.js +52 -0
  63. package/dist/inventory/effectiveVars.js.map +1 -0
  64. package/dist/inventory/graph.d.ts +6 -0
  65. package/dist/inventory/graph.js +81 -0
  66. package/dist/inventory/graph.js.map +1 -0
  67. package/dist/inventory/internalTypes.d.ts +17 -0
  68. package/dist/inventory/internalTypes.js +2 -0
  69. package/dist/inventory/internalTypes.js.map +1 -0
  70. package/dist/inventory/internalUtils.d.ts +10 -0
  71. package/dist/inventory/internalUtils.js +68 -0
  72. package/dist/inventory/internalUtils.js.map +1 -0
  73. package/dist/inventory/listInventoryView.d.ts +23 -0
  74. package/dist/inventory/listInventoryView.js +22 -0
  75. package/dist/inventory/listInventoryView.js.map +1 -0
  76. package/dist/inventory/loadInventory.d.ts +4 -0
  77. package/dist/inventory/loadInventory.js +87 -0
  78. package/dist/inventory/loadInventory.js.map +1 -0
  79. package/dist/inventory/normalize.d.ts +4 -0
  80. package/dist/inventory/normalize.js +251 -0
  81. package/dist/inventory/normalize.js.map +1 -0
  82. package/dist/inventory/parse.d.ts +6 -0
  83. package/dist/inventory/parse.js +31 -0
  84. package/dist/inventory/parse.js.map +1 -0
  85. package/dist/inventory/policy.d.ts +11 -0
  86. package/dist/inventory/policy.js +27 -0
  87. package/dist/inventory/policy.js.map +1 -0
  88. package/dist/inventory/resolveTarget.d.ts +14 -0
  89. package/dist/inventory/resolveTarget.js +55 -0
  90. package/dist/inventory/resolveTarget.js.map +1 -0
  91. package/dist/inventory/types.d.ts +50 -0
  92. package/dist/inventory/types.js +2 -0
  93. package/dist/inventory/types.js.map +1 -0
  94. package/dist/inventory/validateNormalized.d.ts +2 -0
  95. package/dist/inventory/validateNormalized.js +64 -0
  96. package/dist/inventory/validateNormalized.js.map +1 -0
  97. package/dist/inventory/varValidation.d.ts +2 -0
  98. package/dist/inventory/varValidation.js +60 -0
  99. package/dist/inventory/varValidation.js.map +1 -0
  100. package/dist/inventory/writePolicy.d.ts +2 -0
  101. package/dist/inventory/writePolicy.js +36 -0
  102. package/dist/inventory/writePolicy.js.map +1 -0
  103. package/dist/logging/loggingQuery.d.ts +15 -0
  104. package/dist/logging/loggingQuery.js +38 -0
  105. package/dist/logging/loggingQuery.js.map +1 -0
  106. package/dist/logging/showLogging.d.ts +28 -0
  107. package/dist/logging/showLogging.js +37 -0
  108. package/dist/logging/showLogging.js.map +1 -0
  109. package/dist/mcp/createServer.d.ts +3 -0
  110. package/dist/mcp/createServer.js +82 -0
  111. package/dist/mcp/createServer.js.map +1 -0
  112. package/dist/mcp/toolResult.d.ts +7 -0
  113. package/dist/mcp/toolResult.js +13 -0
  114. package/dist/mcp/toolResult.js.map +1 -0
  115. package/dist/mcp/tools/getFacts.d.ts +21 -0
  116. package/dist/mcp/tools/getFacts.js +17 -0
  117. package/dist/mcp/tools/getFacts.js.map +1 -0
  118. package/dist/mcp/tools/getRunningConfig.d.ts +21 -0
  119. package/dist/mcp/tools/getRunningConfig.js +17 -0
  120. package/dist/mcp/tools/getRunningConfig.js.map +1 -0
  121. package/dist/mcp/tools/getServerInfo.d.ts +10 -0
  122. package/dist/mcp/tools/getServerInfo.js +9 -0
  123. package/dist/mcp/tools/getServerInfo.js.map +1 -0
  124. package/dist/mcp/tools/listInventory.d.ts +16 -0
  125. package/dist/mcp/tools/listInventory.js +15 -0
  126. package/dist/mcp/tools/listInventory.js.map +1 -0
  127. package/dist/mcp/tools/probeDevices.d.ts +21 -0
  128. package/dist/mcp/tools/probeDevices.js +14 -0
  129. package/dist/mcp/tools/probeDevices.js.map +1 -0
  130. package/dist/mcp/tools/runShow.d.ts +30 -0
  131. package/dist/mcp/tools/runShow.js +34 -0
  132. package/dist/mcp/tools/runShow.js.map +1 -0
  133. package/dist/mcp/tools/showLogging.d.ts +24 -0
  134. package/dist/mcp/tools/showLogging.js +20 -0
  135. package/dist/mcp/tools/showLogging.js.map +1 -0
  136. package/dist/operations/readExecution.d.ts +57 -0
  137. package/dist/operations/readExecution.js +132 -0
  138. package/dist/operations/readExecution.js.map +1 -0
  139. package/dist/probe/probeDevices.d.ts +24 -0
  140. package/dist/probe/probeDevices.js +24 -0
  141. package/dist/probe/probeDevices.js.map +1 -0
  142. package/dist/serverInfo/buildServerInfo.d.ts +2 -0
  143. package/dist/serverInfo/buildServerInfo.js +49 -0
  144. package/dist/serverInfo/buildServerInfo.js.map +1 -0
  145. package/dist/serverInfo/types.d.ts +46 -0
  146. package/dist/serverInfo/types.js +2 -0
  147. package/dist/serverInfo/types.js.map +1 -0
  148. package/dist/show/runShow.d.ts +29 -0
  149. package/dist/show/runShow.js +40 -0
  150. package/dist/show/runShow.js.map +1 -0
  151. package/dist/utils/json.d.ts +1 -0
  152. package/dist/utils/json.js +4 -0
  153. package/dist/utils/json.js.map +1 -0
  154. package/dist/utils/path.d.ts +2 -0
  155. package/dist/utils/path.js +14 -0
  156. package/dist/utils/path.js.map +1 -0
  157. package/dist/utils/value.d.ts +6 -0
  158. package/dist/utils/value.js +28 -0
  159. package/dist/utils/value.js.map +1 -0
  160. package/docs/CHECKPOINT.md +46 -0
  161. package/docs/CODE_WALKTHROUGH.md +112 -0
  162. package/docs/DESIGN.md +56 -0
  163. package/docs/DEVELOPMENT.md +72 -0
  164. package/docs/EXAMPLES.md +178 -0
  165. package/docs/IMPLEMENTATION_PLAN.md +32 -0
  166. package/docs/QUICKSTART.md +152 -0
  167. package/example-inventories/canonical-fabric.yaml +45 -0
  168. package/example-inventories/multi-password.yaml +35 -0
  169. package/example-inventories/simplified-lab.yaml +33 -0
  170. package/package.json +57 -0
@@ -0,0 +1,152 @@
1
+ # Quickstart: eos-mcp-server with Claude Code
2
+
3
+ This guide gets you from the npm package to a working MCP server inside Claude Code.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js 24+
8
+ - Claude Code installed (`npm install -g @anthropic-ai/claude-code`)
9
+ - One or more Arista EOS devices reachable via eAPI (HTTPS)
10
+
11
+ ## 1. Install the package globally
12
+
13
+ ```bash
14
+ npm install -g @aristanetworks/eos-mcp-server
15
+ ```
16
+
17
+ Verify it's on your PATH:
18
+
19
+ ```bash
20
+ eos-mcp-server --help
21
+ ```
22
+
23
+ ## 2. Create an inventory file
24
+
25
+ Create `inventory.yml` with your EOS devices. Replace the hostnames, IPs, and credentials to match your environment.
26
+
27
+ ```yaml
28
+ all:
29
+ children:
30
+ eos:
31
+ vars:
32
+ ansible_user: admin
33
+ ansible_network_os: eos
34
+ mcp_password_env: EOS_MCP_PASSWORD
35
+ hosts:
36
+ leaf1:
37
+ ansible_host: 192.0.2.11
38
+ leaf2:
39
+ ansible_host: 192.0.2.12
40
+ ```
41
+
42
+ If your devices use self-signed certificates, add `mcp_validate_certs: false` (or `ansible_httpapi_validate_certs: false`) under `vars`:
43
+
44
+ ```yaml
45
+ vars:
46
+ ansible_user: admin
47
+ ansible_network_os: eos
48
+ mcp_password_env: EOS_MCP_PASSWORD
49
+ mcp_validate_certs: false
50
+ ```
51
+
52
+ ## 3. Export the password
53
+
54
+ The `mcp_password_env` value is an environment variable **name**, not the password itself. Export the actual password:
55
+
56
+ ```bash
57
+ export EOS_MCP_PASSWORD='your-device-password'
58
+ ```
59
+
60
+ ## 4. Validate and test
61
+
62
+ Validate the inventory:
63
+
64
+ ```bash
65
+ eos-mcp-server validate-inventory --inventory inventory.yml
66
+ ```
67
+
68
+ Probe a device to confirm connectivity:
69
+
70
+ ```bash
71
+ eos-mcp-server probe --inventory inventory.yml --target leaf1
72
+ ```
73
+
74
+ You should see:
75
+
76
+ ```text
77
+ Probe target: leaf1
78
+ Devices: 1/1 succeeded
79
+ - leaf1: success
80
+ ```
81
+
82
+ ## 5. Add the MCP server to Claude Code
83
+
84
+ ```bash
85
+ claude mcp add eos -- eos-mcp-server serve --inventory /absolute/path/to/inventory.yml
86
+ ```
87
+
88
+ Use absolute paths for the inventory file since Claude Code may launch the server from any working directory.
89
+
90
+ For additional options such as timeouts, request limits, or a default connection, use a [server config file](../README.md#server-config-file) instead and point `--config` at it.
91
+
92
+ To make it available across all your projects, add `-s user`:
93
+
94
+ ```bash
95
+ claude mcp add -s user eos -- eos-mcp-server serve --inventory /absolute/path/to/inventory.yml
96
+ ```
97
+
98
+ ### Passing the password to Claude Code
99
+
100
+ The simplest approach is to export `EOS_MCP_PASSWORD` in your shell profile (`~/.bashrc`, `~/.zshrc`, etc.) so it's available whenever Claude Code starts the server.
101
+
102
+ Alternatively, add it inline when registering the server:
103
+
104
+ ```bash
105
+ claude mcp add -e EOS_MCP_PASSWORD=your-device-password eos -- eos-mcp-server serve --inventory /absolute/path/to/inventory.yml
106
+ ```
107
+
108
+ ## 6. Verify in Claude Code
109
+
110
+ Start Claude Code and ask it to use the server:
111
+
112
+ ```
113
+ > List my EOS inventory
114
+ ```
115
+
116
+ ```
117
+ > Probe leaf1
118
+ ```
119
+
120
+ ```
121
+ > Show me the version on leaf1
122
+ ```
123
+
124
+ Claude will call the `eos_list_inventory`, `eos_probe_devices`, and `eos_run_show` tools automatically.
125
+
126
+ ## Available MCP tools
127
+
128
+ Once connected, Claude Code has access to these tools:
129
+
130
+ | Tool | Description |
131
+ | ------------------------ | ---------------------------------------- |
132
+ | `eos_get_server_info` | Server runtime summary and capabilities |
133
+ | `eos_list_inventory` | List inventory hosts and groups |
134
+ | `eos_probe_devices` | Check device reachability |
135
+ | `eos_run_show` | Run `show` commands on devices |
136
+ | `eos_show_logging` | Retrieve bounded logging output |
137
+ | `eos_get_facts` | Collect device facts from `show version` |
138
+ | `eos_get_running_config` | Retrieve running configuration |
139
+
140
+ ## Troubleshooting
141
+
142
+ **`npm install -g` fails with permission errors** — Run with `sudo` or configure npm to use a user-writable prefix (`npm config set prefix ~/.npm-global`).
143
+
144
+ **`Password env var ... is not set`** — Export `EOS_MCP_PASSWORD` before launching Claude Code, or pass it via `-e` when adding the server.
145
+
146
+ **`Password env var ... does not match any allowed prefix`** — The env var name must start with `EOS_MCP_` by default. Use a name like `EOS_MCP_PASSWORD`, not the password itself.
147
+
148
+ **Certificate validation failure** — For a lab device, add `mcp_validate_certs: false` (or `ansible_httpapi_validate_certs: false`) to your inventory vars. To trust a real CA instead, set `caFile` in a [server config file](../README.md#server-config-file). See [TLS behavior](../README.md#tls-behavior) for details.
149
+
150
+ **`Unknown inventory target ...`** — Targets must be inventory host or group names (e.g., `leaf1`), not IP addresses.
151
+
152
+ See the full [README](../README.md) for detailed configuration options.
@@ -0,0 +1,45 @@
1
+ # Canonical Ansible-style inventory for eos-mcp-server.
2
+ #
3
+ # The addresses below use RFC 5737 TEST-NET space and are placeholders.
4
+ # Replace hostnames, addresses, and certificate policy for your environment.
5
+ all:
6
+ children:
7
+ FABRIC:
8
+ vars:
9
+ ansible_user: admin
10
+ ansible_network_os: eos
11
+ mcp_password_env: EOS_MCP_PASSWORD
12
+ # Useful for labs with self-signed eAPI certificates. Prefer a CA bundle
13
+ # and certificate validation in production.
14
+ mcp_validate_certs: false
15
+ children:
16
+ SPINES:
17
+ hosts:
18
+ spine1:
19
+ ansible_host: 192.0.2.11
20
+ spine2:
21
+ ansible_host: 192.0.2.12
22
+ LEAFS:
23
+ children:
24
+ LEAF_PAIR_1:
25
+ hosts:
26
+ leaf1:
27
+ ansible_host: 192.0.2.21
28
+ leaf2:
29
+ ansible_host: 192.0.2.22
30
+ LEAF_PAIR_2:
31
+ hosts:
32
+ leaf3:
33
+ ansible_host: 192.0.2.23
34
+ leaf4:
35
+ ansible_host: 192.0.2.24
36
+
37
+ # These groups intentionally reuse canonical groups defined above. The server
38
+ # merges repeated group definitions and treats the inventory as authoritative.
39
+ NETWORK_SERVICES:
40
+ children:
41
+ LEAFS:
42
+
43
+ CONNECTED_ENDPOINTS:
44
+ children:
45
+ LEAFS:
@@ -0,0 +1,35 @@
1
+ # Canonical inventory with a different password for every device.
2
+ #
3
+ # Keep passwords out of the inventory. Each mcp_password_env value is the name
4
+ # of an environment variable that must be set before starting the server.
5
+ # The variable names use the default allowed EOS_MCP_ prefix.
6
+ all:
7
+ children:
8
+ FABRIC:
9
+ vars:
10
+ ansible_user: admin
11
+ ansible_network_os: eos
12
+ mcp_validate_certs: false
13
+ hosts:
14
+ spine1:
15
+ ansible_host: 192.0.2.11
16
+ mcp_password_env: EOS_MCP_SPINE1_PASSWORD
17
+ spine2:
18
+ ansible_host: 192.0.2.12
19
+ mcp_password_env: EOS_MCP_SPINE2_PASSWORD
20
+ leaf1:
21
+ ansible_host: 192.0.2.21
22
+ mcp_password_env: EOS_MCP_LEAF1_PASSWORD
23
+ leaf2:
24
+ ansible_host: 192.0.2.22
25
+ mcp_password_env: EOS_MCP_LEAF2_PASSWORD
26
+
27
+ children:
28
+ SPINES:
29
+ hosts:
30
+ spine1:
31
+ spine2:
32
+ LEAFS:
33
+ hosts:
34
+ leaf1:
35
+ leaf2:
@@ -0,0 +1,33 @@
1
+ # Simplified inventory format for eos-mcp-server.
2
+ #
3
+ # The addresses below use RFC 5737 TEST-NET space and are placeholders.
4
+ version: 1
5
+
6
+ vars:
7
+ ansible_user: admin
8
+ mcp_password_env: EOS_MCP_PASSWORD
9
+ # Useful for labs with self-signed eAPI certificates. Prefer a CA bundle
10
+ # and certificate validation in production.
11
+ mcp_validate_certs: false
12
+
13
+ hosts:
14
+ leaf1:
15
+ ansible_host: 198.51.100.11
16
+ ansible_network_os: eos
17
+ leaf2:
18
+ ansible_host: 198.51.100.12
19
+ ansible_network_os: eos
20
+ spine1:
21
+ ansible_host: 198.51.100.21
22
+ ansible_network_os: eos
23
+ spine2:
24
+ ansible_host: 198.51.100.22
25
+ ansible_network_os: eos
26
+
27
+ groups:
28
+ leafs:
29
+ hosts: [leaf1, leaf2]
30
+ spines:
31
+ hosts: [spine1, spine2]
32
+ fabric:
33
+ children: [spines, leafs]
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@aristanetworks/eos-mcp-server",
3
+ "version": "0.6.1-beta",
4
+ "description": "MCP server for Arista EOS eAPI",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "homepage": "https://github.com/aristanetworks/eos-mcp-server#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/aristanetworks/eos-mcp-server.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/aristanetworks/eos-mcp-server/issues"
14
+ },
15
+ "keywords": [
16
+ "arista",
17
+ "eos",
18
+ "mcp",
19
+ "model-context-protocol",
20
+ "network-automation"
21
+ ],
22
+ "bin": {
23
+ "eos-mcp-server": "dist/index.js"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "docs",
28
+ "example-inventories",
29
+ "CHANGELOG.md"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "scripts": {
35
+ "build": "tsc -p tsconfig.json",
36
+ "dev": "tsx src/index.ts",
37
+ "lint": "node scripts/static-policy.mjs",
38
+ "prepack": "npm run build",
39
+ "static-policy": "node scripts/static-policy.mjs",
40
+ "typecheck": "tsc -p tsconfig.json --noEmit",
41
+ "test": "vitest run"
42
+ },
43
+ "engines": {
44
+ "node": ">=24"
45
+ },
46
+ "dependencies": {
47
+ "@modelcontextprotocol/sdk": "^1.29.0",
48
+ "yaml": "^2.8.0",
49
+ "zod": "^3.24.3"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^22.15.3",
53
+ "tsx": "^4.19.4",
54
+ "typescript": "^5.8.3",
55
+ "vitest": "^4.1.8"
56
+ }
57
+ }