Gnesi
Open inbox hello@gnesi.io

Integrations

Claude Agent SDK

Add the Gnesi MCP server to query() with a bearer credential. No extra Gnesi package.

The Claude Agent SDK connects to MCP servers from query(). Add Gnesi there.

Bash
npm install @anthropic-ai/claude-agent-sdk

Python: pip install claude-agent-sdk.

Set GNESI_CREDENTIAL and ANTHROPIC_API_KEY.

TypeScript

TypeScript
import { query } from "@anthropic-ai/claude-agent-sdk";

for await (const message of query({
  prompt: "List my Gnesi conversations that need me.",
  options: {
    mcpServers: {
      gnesi: {
        type: "http",
        url: "https://api.gnesi.io/api/mcp",
        headers: { Authorization: `Bearer ${process.env.GNESI_CREDENTIAL}` },
      },
    },
    allowedTools: ["mcp__gnesi__*"],
  },
})) {
  if (message.type === "result" && message.subtype === "success") {
    console.log(message.result);
  }
}

Python

Python
import asyncio
import os

from claude_agent_sdk import ClaudeAgentOptions, ResultMessage, query

async def main() -> None:
    options = ClaudeAgentOptions(
        mcp_servers={
            "gnesi": {
                "type": "http",
                "url": "https://api.gnesi.io/api/mcp",
                "headers": {"Authorization": f"Bearer {os.environ['GNESI_CREDENTIAL']}"},
            }
        },
        allowed_tools=["mcp__gnesi__*"],
    )
    async for message in query(prompt="List my Gnesi conversations that need me.", options=options):
        if isinstance(message, ResultMessage) and message.subtype == "success":
            print(message.result)

asyncio.run(main())

allowedTools is required. Without it the model can see the tools and cannot call them. For a tighter agent, list the tools you want, for example mcp__gnesi__gnesi_list_conversations.

The credential is for the SDK. Claude Desktop and Claude.ai use the sign-in on MCP. Claude Code uses CLI.