Quickstart
Creating and hosting an MCP server in three simple steps
Section titled “Creating and hosting an MCP server in three simple steps”Gram takes your OpenAPI document and, in just three steps, generates a fully functional, scoped MCP server, ready to use across environments, teams, and agents.
Expose your MCP server as an internal or public service without managing infrastructure, while Gram handles hosting, distribution, and security.
Let’s see how easy it is to create an MCP server with Gram.
Step 1: Create an MCP server
Section titled “Step 1: Create an MCP server”First, upload an OpenAPI document.
Step 2: Create a toolset
Section titled “Step 2: Create a toolset”A toolset is a curated bundle of tools for a specific use case or team. In the Gram interface, you can select which tools to include and which to ignore based on your needs.
Step 3: Set environment variables
Section titled “Step 3: Set environment variables”Click Environments in the sidebar, and then + New Environment.
Now you can interact with your MCP server in real time in the Gram Playground.
Public and authenticated servers
Section titled “Public and authenticated servers”To configure your MCP server as public or authenticated, go to MCP in the sidebar and select MCP Config for your hosted server.
- A public server can be instantly used by any of your customers, simply by copying the configuration provided into an MCP client.
- An authenticated server requires a Gram API key in the project configuration, making it suitable for internal use cases where access needs to be restricted to authorized users.
Connect your MCP server to AI agents
Section titled “Connect your MCP server to AI agents”In addition to MCP Clients like Claude, your customers can automate interactions with your MCP server using AI agents. The Gram Python and TypeScript SDKs support OpenAI Agents, LangChain, and other function-based tooling, and Gram provides sample code to help you create agents within your existing framework.
Here is an example Python snippet that shows how to integrate your MCP server with LangChain:
import asyncioimport osfrom langchain import hubfrom langchain_openai import ChatOpenAIfrom langchain.agents import AgentExecutor, create_openai_functions_agentfrom gram_ai.langchain import GramLangchain
key = "<GRAM_API_KEY>"
gram = GramLangchain(api_key=key)
llm = ChatOpenAI( model="gpt-4", temperature=0, openai_api_key=os.getenv("OPENAI_API_KEY"))
tools = gram.tools( project="default", toolset="marketing", environment="demo-environment",)
prompt = hub.pull("hwchase17/openai-functions-agent")
agent = create_openai_functions_agent(llm=llm, tools=tools, prompt=prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=False)
async def main(): response = await agent_executor.ainvoke({ "input": "Can you tell me about my tools?" }) print(response)
if __name__ == "__main__": asyncio.run(main())
In the Agents tab in the Playground dashboard, you can build agentic workflows by selecting a language and integration type.
What’s next?
Section titled “What’s next?”Gram also offers:
- API key management
- Custom domains for distribution
- Integrations with popular platforms like Slack and GitHub
Try Gram now and see how easy it is to host and share your MCP server.