MCPSERV.CLUB
strowk

Foxy Contexts

MCP Server

Declarative MCP servers in Go

Stale(55)
108stars
1views
Updated 13 days ago

About

Foxy Contexts is a Golang library that enables developers to build Model Context Protocol (MCP) servers declaratively. It supports tools, resources, and prompts with dependency injection via Uber’s fx, simplifying the creation of robust context servers.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

Foxy Contexts Demo

Overview

Foxy Contexts is a Golang‑centric library that simplifies the construction of Model Context Protocol (MCP) servers. By providing a declarative API for defining tools, resources, and prompts, it lets developers embed rich context capabilities directly into their Go applications. The library is built on top of Uber’s fx dependency injection framework, which means every tool or resource can share common clients, database connections, or other services without boilerplate wiring. This approach keeps the business logic of a tool (e.g., reading files, querying an API) tightly coupled to its MCP definition, improving maintainability and reducing the cognitive load of keeping codebases in sync.

The server solves a common pain point for AI‑enabled applications: seamless, typed integration of external data and actions. Rather than writing ad‑hoc HTTP handlers or custom adapters, developers can declare a tool’s input schema with the package and expose it via a single MCP endpoint. Resources—both static assets and dynamic content served by providers—are equally straightforward to register, allowing assistants to retrieve structured data on demand. Prompts are first‑class citizens too: developers can predefine prompt templates that the assistant can fill automatically, ensuring consistent tone and format across interactions.

Key capabilities include:

  • Multiple transports: support for Stdio, Server‑Sent Events (SSE), and a streamable HTTP transport (beta) gives flexibility in how clients communicate with the server.
  • Declarative tool and resource registration: tools expose typed input schemas, resources can be static or generated on the fly via providers, and prompts can be completed automatically.
  • Functional testing support: the package enables end‑to‑end tests that exercise the MCP interface without needing a running server.
  • Lifecycle and health checks: built‑in ping endpoints and an extensible lifecycle hook system keep the server robust in production.

In practice, a SaaS platform might expose a customer‑search tool that queries its database and returns results in a structured format. An AI assistant could then invoke this tool via MCP, providing natural language queries that are automatically translated into the tool’s schema. Similarly, a documentation site could expose static resources (e.g., API docs) and dynamic templates that render real‑time usage statistics. Because the server is written in Go, it can run as a lightweight microservice or be embedded directly into larger applications, making it ideal for high‑performance environments.

Foxy Contexts stands out by marrying the power of Go’s type system and dependency injection with the evolving MCP standard. It removes repetitive boilerplate, enforces strict contracts between AI assistants and external services, and offers a clear path to testability—all while remaining fully compatible with existing MCP clients such as Claude, Gemini, or any custom assistant that speaks the protocol.