gram

module
v0.0.0-...-9b8f59a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: AGPL-3.0

README

Gram

Gram - The MCP Cloud Platform


Learn more »

Built by Speakeasy
Documentation · Tech Stack · Contributing · Login


Introduction

Gram is a platform for creating, curating, and hosting Model Context Protocol (MCP) servers with ease. We currently support both OpenAPI documents as well as custom TypeScript functions as sources for tools.

What can you do with Gram?

With Gram you can empower your LLM and Agents to access the right data at the right time. Gram provides a high-level TypeScript SDK and OpenAPI support to define tools, compose higher order custom tools and group tools together into toolsets. Every toolset is instantly available as a hosted and secure MCP server.

If you are looking to get started on the hosted platform you can Sign up, or check out the Quickstart guide.

Features

└ Minimal, lightweight, and open source.
└ High-level TypeScript framework that makes working with MCP easy.
└ Use a custom tool builder to create higher-order tools by chaining lower level tools.
└ OAuth support out-of-the-box: DCR, BYO Authorisation, and standard flows.
└ First class support for OpenAPI 3.0.X and 3.1.X.
└ Follows the MCP specification.

Gram Functions

Create agentic tools from simple TypeScript code using the Gram Functions Framework. Refer to the Getting Started guide to learn more.

The fastest way to get started is with the npm create @gram-ai/function@latest command, which creates a complete TypeScript project with a working Gram function. Deployable and runnable locally as a MCP server.

# Install the CLI and follow the prompts
npm create @gram-ai/function@latest

# Once created, move into your newly created function directory
cd my_function

# Build and Deploy
npm run build
npm run push

A default function is created for you.

import { Gram } from "@gram-ai/functions";
import * as z from "zod/mini";

const gram = new Gram().tool({
  name: "add",
  description: "Add two numbers together",
  inputSchema: { a: z.number(), b: z.number() },
  async execute(ctx, input) {
    return ctx.json({ sum: input.a + input.b });
  },
});

export default gram;

In addition you get a:

  • A server.ts is created so you can run the tool locally as a MCP server with MCP inspector with pnpm run dev
  • A README and CONTRIBUTING guide for next steps on building out your custom tool.
Common use cases include:

└ Host one or more remote MCP servers at a custom domain like mcp.{your-company}.com.
└ Power your in-application chat by exposing context from your internal APIs or 3rd Party APIs through tools.
└ Add data to your AI workflows in Zapier, N8N and other workflow platforms
└ Manage and secure MCP servers for your entire organization through a unified control plane.

Check out the examples folder in this repo for working examples. Or open a pull request if you have one to share!

Gram CLI

The CLI allows for programmatic access to Gram, enabling you to manage the process of pushing sources (either OpenAPI documents or Gram Functions) for your MCP servers. Get started with documentation here.

curl -fsSL https://go.getgram.ai/cli.sh | bash

And then:

gram auth

Support

  • Slack: Join our slack for support and discussions
  • In-App: When using the application you can engage with the core maintainers of the product.
  • GitHub: Contribute or report issues on this repository.
  • Documentation for Gram is also open source. View it here and contribute here.

Contributing

Contributions are welcome! Please open an issue or discussion for questions or suggestions before starting significant work.

See CONTRIBUTING.md for development setup and detailed contribution guidelines.

Techstack

TypeScript – dashboard language.
Golang - backend language.
Goa - design-first API framework.
Temporal - workflow engine.
Polar - usage based billing.
OpenRouter - LLM gateway.
Speakeasy - Generated SDKs. Spec hosted here.

Directories

Path Synopsis
cli
internal/flags
Package flags defines common flags to keep CLI commands consistent.
Package flags defines common flags to keep CLI commands consistent.
internal/profile
Package profile provides profile-based configuration management for the Gram CLI.
Package profile provides profile-based configuration management for the Gram CLI.
Package main is the dev-idp binary entrypoint.
Package main is the dev-idp binary entrypoint.
design
Package design declares the Goa API for the dev-idp management surface.
Package design declares the Goa API for the dev-idp management surface.
internal/bootstrap
Package bootstrap opens dev-idp's SQLite database and applies the embedded schema on every start.
Package bootstrap opens dev-idp's SQLite database and applies the embedded schema on every start.
internal/config
Package config parses dev-idp's runtime configuration.
Package config parses dev-idp's runtime configuration.
internal/conv
Package conv has dev-idp's tiny set of *string <-> sql.NullString and related helpers.
Package conv has dev-idp's tiny set of *string <-> sql.NullString and related helpers.
internal/defaultuser
Package defaultuser implements the dev-idp's "default user" bootstrap.
Package defaultuser implements the dev-idp's "default user" bootstrap.
internal/keystore
Package keystore owns the dev-idp's single RSA keypair (idp-design.md §5.3): the only signing key the dev-idp uses, sourced from GRAM_DEVIDP_RSA_PRIVATE_KEY (PEM) at boot or freshly generated when the env var is unset.
Package keystore owns the dev-idp's single RSA keypair (idp-design.md §5.3): the only signing key the dev-idp uses, sourced from GRAM_DEVIDP_RSA_PRIVATE_KEY (PEM) at boot or freshly generated when the env var is unset.
internal/middleware
Package middleware provides the small set of HTTP/Goa middleware dev-idp needs.
Package middleware provides the small set of HTTP/Goa middleware dev-idp needs.
internal/modes/mockworkos
Package mockworkos implements the dev-idp's mock-workos mode — a mock WorkOS REST surface backed by the dev-idp's shared SQLite store.
Package mockworkos implements the dev-idp's mock-workos mode — a mock WorkOS REST surface backed by the dev-idp's shared SQLite store.
internal/modes/oauth2
Package oauth2 implements the dev-idp's oauth2 mode (idp-design.md §7.4): an OAuth 2.0 authorization server with optional PKCE (honored when present), no DCR, and OIDC compliance.
Package oauth2 implements the dev-idp's oauth2 mode (idp-design.md §7.4): an OAuth 2.0 authorization server with optional PKCE (honored when present), no DCR, and OIDC compliance.
internal/modes/oauth21
Package oauth21 implements the dev-idp's oauth2-1 mode (idp-design.md §7.3): an OAuth 2.1 authorization server with PKCE-required (S256), stateless DCR, and OIDC compliance.
Package oauth21 implements the dev-idp's oauth2-1 mode (idp-design.md §7.3): an OAuth 2.1 authorization server with PKCE-required (S256), stateless DCR, and OIDC compliance.
internal/modes/workos
Package workos implements the dev-idp's workos mode — proxies WorkOS REST API calls to the live WorkOS dev environment.
Package workos implements the dev-idp's workos mode — proxies WorkOS REST API calls to the live WorkOS dev environment.
internal/oops
Package oops is dev-idp's lightweight error helper.
Package oops is dev-idp's lightweight error helper.
internal/service
Package service contains the dev-idp's Goa service implementations (organizations, users, memberships, devIdp).
Package service contains the dev-idp's Goa service implementations (organizations, users, memberships, devIdp).
internal/workos
Package workos is dev-idp's tiny WorkOS client.
Package workos is dev-idp's tiny WorkOS client.
pkg/devidptest
Package devidptest spins up a real dev-idp HTTP server inside a test.
Package devidptest spins up a real dev-idp HTTP server inside a test.
pkg/testidp
Package testidp serves an in-process mock identity provider for tests.
Package testidp serves an in-process mock identity provider for tests.
functions
cmd/runner command
imports
Package imports provides reusable helpers for emitting analysis.TextEdit values that add or remove imports from a Go source file.
Package imports provides reusable helpers for emitting analysis.TextEdit values that add or remove imports from a Go source file.
main command
Package plog provides pretty-printing for JSON lines logs with colorized output.
Package plog provides pretty-printing for JSON lines logs with colorized output.
cmd/plog command
Command plog pretty-prints JSON lines logs with colorized output.
Command plog pretty-prints JSON lines logs with colorized output.
cmd/gen-webhooks command
Command gen-webhooks generates both catalog artifacts for the outbox events package:
Command gen-webhooks generates both catalog artifacts for the outbox events package:
internal/auth/speakeasyclient
Package speakeasyclient is a thin HTTP client for the Speakeasy auth provider's IDP wire endpoints (`/v1/speakeasy_provider/{exchange,validate}`) plus the post-IDP user-bootstrap side effects every Speakeasy-authenticated caller should run.
Package speakeasyclient is a thin HTTP client for the Speakeasy auth provider's IDP wire endpoints (`/v1/speakeasy_provider/{exchange,validate}`) plus the post-IDP user-bootstrap side effects every Speakeasy-authenticated caller should run.
internal/authz/repo
Package repo writes authz challenge rows to ClickHouse.
Package repo writes authz challenge rows to ClickHouse.
internal/background/activities/outbox_relay
Package outbox_relay drains the global event outbox.
Package outbox_relay drains the global event outbox.
internal/background/activities/risk_analysis/presidiotest
Package presidiotest provides an in-process mock of the Presidio Analyzer HTTP API.
Package presidiotest provides an in-process mock of the Presidio Analyzer HTTP API.
internal/dns
Package dns provides a Resolver interface for DNS lookups whose method signatures match net.Resolver.
Package dns provides a Resolver interface for DNS lookups whose method signatures match net.Resolver.
internal/email
Package email is the application-facing facade for sending transactional emails.
Package email is the application-facing facade for sending transactional emails.
internal/externalmcptest
Package externalmcptest provides helpers for constructing externalmcp.RegistryClient instances in tests.
Package externalmcptest provides helpers for constructing externalmcp.RegistryClient instances in tests.
internal/functionstest
Package functionstest provides helpers for constructing functions.Orchestrator instances in tests.
Package functionstest provides helpers for constructing functions.Orchestrator instances in tests.
internal/guardian
Package guardian provides HTTP client construction with network security policy enforcement, OpenTelemetry instrumentation, and optional retry logic.
Package guardian provides HTTP client construction with network security policy enforcement, OpenTelemetry instrumentation, and optional retry logic.
internal/mv
Package mv, short for "model views", provides functions for rendering views over database models that can be used by other services to produce consistent representations of API resources.
Package mv, short for "model views", provides functions for rendering views over database models that can be used by other services to produce consistent representations of API resources.
internal/oauth/wellknown
Package wellknown resolves OAuth 2.1 well-known metadata for toolsets.
Package wellknown resolves OAuth 2.1 well-known metadata for toolsets.
internal/oauthtest
Package oauthtest provides helpers for creating OAuth-configured toolsets in tests.
Package oauthtest provides helpers for creating OAuth-configured toolsets in tests.
internal/openapi
Workaround: Anti-Gravity rejects tool inputSchema properties that use integer enums (e.g.
Workaround: Anti-Gravity rejects tool inputSchema properties that use integer enums (e.g.
internal/orderedmap
Package orderedmap provides a map implementation that maintains the order of keys as they are added.
Package orderedmap provides a map implementation that maintains the order of keys as they are added.
internal/outbox
Package outbox provides the producer-side helpers for writing events to the outbox table and waking the per-org Svix relay workflow.
Package outbox provides the producer-side helpers for writing events to the outbox table and waking the per-org Svix relay workflow.
internal/outbox/cataloggen
Package cataloggen generates server/internal/outbox/events/catalog_gen.go and server/internal/outbox/events/catalog_gen.yaml from the event definition files.
Package cataloggen generates server/internal/outbox/events/catalog_gen.go and server/internal/outbox/events/catalog_gen.yaml from the event definition files.
internal/platformtools/memory
Package memory implements the gram://memory/* platform tools that wrap the MemoryService for use by assistant agents at runtime.
Package memory implements the gram://memory/* platform tools that wrap the MemoryService for use by assistant agents at runtime.
internal/remotemcp/proxy
Package proxy forwards MCP client requests to an upstream Remote MCP Server and relays its responses back to the client.
Package proxy forwards MCP client requests to an upstream Remote MCP Server and relays its responses back to the client.
internal/remotemcp/remotemcptest
Package remotemcptest provides helpers for seeding remote_mcp_servers rows in tests across packages that depend on a remote MCP server FK.
Package remotemcptest provides helpers for seeding remote_mcp_servers rows in tests across packages that depend on a remote MCP server FK.
internal/remotesessions
Package remotesessions implements the management API services that surface remote_session_issuer / remote_session_client / remote_session resources — Gram-as-OAuth-Client configuration and the upstream sessions Gram is holding on a principal's behalf.
Package remotesessions implements the management API services that surface remote_session_issuer / remote_session_client / remote_session resources — Gram-as-OAuth-Client configuration and the upstream sessions Gram is holding on a principal's behalf.
internal/risk/categories
Package categories is the single source of truth for the (source, rule_id) → risk category mapping shown across the dashboard.
Package categories is the single source of truth for the (source, rule_id) → risk category mapping shown across the dashboard.
internal/testmcp
Package testmcp provides an in-process mock MCP server backed by the official MCP Go SDK.
Package testmcp provides an in-process mock MCP server backed by the official MCP Go SDK.
internal/thirdparty/loops
Package loops is a thin transport wrapper around the Loops transactional email API (https://loops.so).
Package loops is a thin transport wrapper around the Loops transactional email API (https://loops.so).
internal/toolconfig
Package toolconfig provides configuration types for tool execution.
Package toolconfig provides configuration types for tool execution.
internal/usersessions
Package usersessions implements the management API services that surface user_session_issuer / user_session_client / user_session_consent / user_session resources.
Package usersessions implements the management API services that surface user_session_issuer / user_session_client / user_session_consent / user_session resources.
internal/xmcp
Package xmcp implements the experimental MCP runtime endpoint at /x/mcp/{slug}.
Package xmcp implements the experimental MCP runtime endpoint at /x/mcp/{slug}.
cmd/cli/gram module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL