You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add note clarifying operator independence is out of scope (RunConfig
format stability would need separate consideration)
- Add future sharing opportunities: pkg/oauth refactoring, pkg/networking
patterns (HTTP builder, endpoint validation)
- Add guiding principle about packages being genuinely reusable
- Add pkg/recovery to Tier 1 immediate graduation candidates
- Add auth/metadata to Tier 2 for protected resource metadata extraction
- Add registry/types, container/verifier, and cache to Tier 3
- Add cache consolidation opportunity note
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: rfcs/THV-0032-toolhive-core-shared-library.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
-**Status**: Draft
4
4
-**Author(s)**: Juan Antonio Osorio (@JAORMX)
5
5
-**Created**: 2026-01-29
6
-
-**Last Updated**: 2026-01-29
6
+
-**Last Updated**: 2026-01-30
7
7
-**Target Repository**: multiple (new repository: `toolhive-core`)
8
8
-**Related Issues**: N/A
9
9
@@ -19,6 +19,8 @@ The ToolHive ecosystem spans multiple Go repositories:
19
19
-**toolhive-registry-server** - Registry API server
20
20
-**dockyard** - Container packaging for MCP servers
21
21
22
+
> **Note**: This RFC focuses on shared library extraction. While a stable core library could eventually enable components like the operator to be versioned independently, that would require additional considerations (e.g., RunConfig format stability, API versioning) beyond the scope of this proposal.
23
+
22
24
Additionally, TypeScript projects exist (toolhive-studio, toolhive-cloud-ui) but are out of scope for a Go shared library.
|**toolhive-registry-server**| Only `pkg/versions` + `pkg/registry` types | Uses stdlib `log/slog` instead of toolhive's zap logger; custom error handling |
31
33
34
+
> **Future sharing opportunities**: Beyond the packages listed above, `pkg/auth` contains OAuth-related utilities (protected resource metadata, auth middleware) that could be refactored into a standalone `pkg/oauth` package. Similarly, `pkg/networking` has HTTP builder patterns and endpoint validation utilities that could benefit multiple projects.
35
+
32
36
**Current limitations:**
33
37
34
38
1.**No stability guarantees**: Projects like dockyard import toolhive's `pkg/` packages directly, but these are internal packages with no API stability commitment. A breaking change in toolhive could break dockyard unexpectedly.
@@ -93,6 +97,8 @@ flowchart TB
93
97
94
98
### Package Graduation Criteria
95
99
100
+
**Guiding Principle**: Packages graduating to `toolhive-core` must provide genuinely reusable value and be designed as reusable from the start. This means they should not be tied to the inner workings of toolhive in either their API surface or internal logic. A package that requires knowledge of toolhive internals to use correctly is not a good candidate for graduation.
101
+
96
102
Packages can graduate via two tracks depending on complexity:
97
103
98
104
#### Fast Track (Simple Packages)
@@ -178,6 +184,7 @@ These packages meet all graduation criteria (zero ToolHive-specific coupling, we
|**recovery**|`pkg/recovery/`| Beta | Panic recovery middleware, zero deps |
181
188
182
189
> **Note**: All packages start as Beta in v0.x releases. Once the library reaches v1.0.0, packages meeting all graduation criteria will be promoted to Stable.
183
190
@@ -190,6 +197,7 @@ These packages have solid implementations but need minor changes to remove ToolH
> **Cache Consolidation Opportunity**: The codebase has several bespoke cache implementations that could be consolidated into a generic, configurable cache package:
219
+
> -`TokenCache` interface in `pkg/vmcp/cache/cache.go` (planned memory/Redis implementations)
220
+
> -`CachedAPIRegistryProvider` in `pkg/registry/provider_cached.go` (in-memory registry cache)
221
+
> -`DefaultManager` cache in `pkg/vmcp/discovery/manager.go` (capability discovery cache with TTL)
222
+
>
223
+
> Consolidating on a generic cache implementation would improve testability, simplify application code (e.g., the cache handles synchronization instead of requiring mutexes in each consumer), reduce cognitive load, and enable reuse of backend implementations (e.g., a Redis-backed cache could be shared across all use cases).
0 commit comments