Register and share your invite link to earn from video plays and referrals.

Search results for MCPServer
MCPServer community
One keyword maps to one global community path.
Create community
People
Not Found
Tweets including MCPServer
# Practical and Useful Patterns for OpenAI Agent SDK 🌍 Connect your own MCP servers to agents. Choose from HTTP, SSE, or stdio transports, and manage connections, approvals, and metadata injection at scale. Local MCP servers run on your own infrastructure, giving you low latency, high security, and full freedom for custom tools. 📌 Title: MCP -- Streamable HTTP / SSE / stdio 🔗 URL: 🧩 Overview Local MCP servers let you connect self-hosted MCP servers as agent tools. Choose from three transports: `MCPServerStreamableHttp` (HTTP-based with auth, retry, and timeout support), `MCPServerSse` (Server-Sent Events), and `MCPServerStdio` (local CLI process). Use `MCPServerManager` for bulk connection management across multiple servers, `require_approval` for per-tool approval control, and `tool_meta_resolver` for tenant metadata injection. 🛠 How to Use Import `Agent` and `Runner` from `agents`, and `MCPServerStreamableHttp` and `MCPServerStdio` from `agents.mcp`. For HTTP connections, pass `MCPServerStreamableHttp` to the agent's `mcp_servers`, putting the connection details in the `params` dict: `params={"url": "http://internal-mcp.corp:8080/mcp", "headers": {"Authorization": "Bearer "}, "timeout": 30}`. For stdio connections, use `MCPServerStdio` with `params={"command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]}` to launch a local CLI process. 🏗 Practical Usage Patterns **Authenticated Internal MCP with MCPServerStreamableHttp** Connect to internal services with low latency, auth headers, retry, and timeouts. Create an `MCPServerStreamableHttp` with `params={"url": "http://internal-mcp.corp:8080/mcp", ...}`, set the `Authorization` header inside `params["headers"]` using `os.getenv('MCP_TOKEN')`, and configure `"timeout": 30`. Retries are a top-level keyword outside `params`, e.g. `max_retry_attempts=3`. Pass it to the agent's `mcp_servers` for an authenticated internal MCP connection. **Local CLI Tools with MCPServerStdio** Connect filesystem servers or custom CLI tools via stdio transport. Create an `MCPServerStdio` with `params={"command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]}` for a filesystem server. For custom tools, use `params={"command": "python", "args": ["-m", "my_custom_mcp_server"], "env": {"DB_URL": os.getenv("DB_URL")}}` to pass environment variables. Add both to the agent's `mcp_servers` list to use multiple stdio tools simultaneously. **Bulk Server Management with MCPServerManager** Efficiently manage multiple MCP servers with reconnection control. Import `MCPServerManager` from `agents.mcp` and pass multiple MCP server instances to `servers`. Call `await manager.connect_all()` for bulk connection, check ` for active ones, and use `await manager.reconnect(failed_only=True)` to reconnect only failed servers. **Per-Tool Approval Map + tool_meta_resolver** Set different approval policies per tool and inject tenant metadata at execution time. Define a per-tool approval policy as a dict mapping `"search_docs"` and `"read_file"` to `"never"`, and `"write_file"`, `"delete_file"`, `"execute_query"` to `"always"`. Write a resolver that takes an `MCPToolMetaContext`, reads tenant data from ` and returns a metadata dict such as `{"tenant_id": str(tenant_id), "source": "agents-sdk"}` — it attaches per-call `_meta` rather than rewriting the tool arguments. Pass the approval map to `require_approval` and the resolver to `tool_meta_resolver` on `MCPServerStreamableHttp` for per-tool approval control with automatic tenant metadata. 💡 Use Cases 🏢 Connect to internal MCP servers with auth, timeout, and low latency via MCPServerStreamableHttp 📁 Attach local filesystem servers and custom CLI tools to agents via MCPServerStdio 🔄 Manage multiple servers with MCPServerManager, reconnect only failed ones with failed_only=True 🔐 Per-tool approval maps + tool_meta_resolver for automatic tenant ID injection in multi-tenant setups ⚠️ Caveats - MCPServerStdio launches local processes, so the target command must be installed in your container environment. - MCPServerManager's reconnect handles connection errors only -- you still need separate error handling for tool execution failures. - Do not include secrets in tool_meta_resolver injections, as they may appear in logs. ✨ Master the three transports and MCPServerManager, and you can connect anything from internal services to local tools. Start with stdio for local experimentation, then move to HTTP for production! #OpenAIAgentSDK# #AIAgent#
Show more
# Practical and Useful Patterns for OpenAI Agent SDK 🌍 Don't expose all MCP tools blindly -- use filters, prompts, and caching for smart control. From permission scoping to dynamic filtering, here are patterns for safe and fast MCP usage. Minimize permissions with tool filters, fetch dynamic instructions via prompts, and reduce latency with caching -- three features that take MCP operations to production grade. 📌 Title: MCP -- Tool filtering / Prompts / Caching 🔗 URL: 🧩 Overview Passing all MCP server tools directly to an agent risks unnecessary tool calls and permission overreach. Use `create_static_tool_filter` to statically restrict allowed tools, or dynamic filter functions to conditionally expose tools based on runtime context (role, tenant, etc.). Fetch dynamic instructions from MCP servers with `get_prompt`, improve latency by caching the tool list with `cache_tools_list=True`, and clear the cache with `invalidate_tools_cache()` when tools change. 🛠 How to Use Import `MCPServerStreamableHttp` and `create_static_tool_filter` from `agents.mcp`. Pass `create_static_tool_filter(allowed_tool_names=["read_file", "write_file"])` to the `tool_filter` parameter of `MCPServerStreamableHttp` to restrict the agent to only `read_file` and `write_file` tools. 🏗 Practical Usage Patterns **Permission Scoping with create_static_tool_filter** Restrict available tools to the minimum required for each agent's role. For a read-only agent, create a filter with `create_static_tool_filter(allowed_tool_names=["read_file", "search_docs", "list_files"])` and pass it to `MCPServerStreamableHttp`'s `tool_filter`. For full access, set `allowed_tool_names=["read_file", "write_file", "delete_file", "search_docs"]`. The same MCP server can expose different tool sets depending on the agent's role. **Dynamic Filter to Hide danger_ Tools** Dynamically hide dangerous tools based on agent role. Import `ToolFilterContext` from `agents.mcp` and define a `role_based_filter` function. When ` is `"CodeReviewer"` and `"danger_")`, return `False` to hide the tool; otherwise return `True`. Pass this function to `MCPServerStreamableHttp`'s `tool_filter` for dynamic role-based tool filtering. **Dynamic Instructions from MCP Server with get_prompt** Fetch prompts from the MCP server to dynamically compose agent instructions. Create an `MCPServerStreamableHttp` and use it in an `async with mcp:` context. Call `prompt_result = await mcp.get_prompt("operation_guidelines")` to fetch a prompt from the MCP server (an optional second argument takes a dict of prompt arguments), then embed `prompt_result.messages[0].content.text` into the agent's `instructions` to dynamically compose agent behavior. **Latency Improvement with cache_tools_list** Cache the tool list to reduce unnecessary requests to the MCP server. Set `cache_tools_list=True` on `MCPServerStreamableHttp` to cache the tool list and reduce unnecessary requests to the MCP server. When tools are added or changed, call `await mcp.invalidate_tools_cache()` to clear the cache. 💡 Use Cases 🔒 Enforce least-privilege with create_static_tool_filter allowing only read_file/write_file 🎭 Hide danger_ tools from CodeReviewer with dynamic filters for role-based access control 📜 Fetch latest operational guidelines from MCP server via get_prompt for dynamic agent instructions ⚡ Enable cache_tools_list=True to reduce repeated tool-list fetch latency ⚠️ Caveats - Typos in `allowed_tool_names` won't raise errors -- the non-existent tool name is simply ignored. Double-check your tool names. - Dynamic filters run on every tool list retrieval, so avoid heavy logic that could impact latency. - With `cache_tools_list=True`, changes to tools won't be reflected until you call `invalidate_tools_cache()`. ✨ Combine filters, prompts, and caching to improve MCP tool safety, flexibility, and performance simultaneously. Start with static filters for permission scoping, then add dynamic filters and caching as needed! #OpenAIAgentSDK# #AIAgent#
Show more
# Useful but Little-Known Features of OpenAI Agent SDK 🌍 Is every tool list fetch hitting the network even though your tools rarely change? Caching `list_tools()` lets you skip redundant network calls for stable tool definitions, dramatically reducing latency. 📌 Title: list_tools() Caching 🔗 URL: 🧩 Overview When MCP server tool definitions don't change often, calling `list_tools()` over the network every time is wasteful. Simply set `cache_tools_list=True` to cache the tool list in memory, speeding up all subsequent fetches. When tool definitions do change, call `server.invalidate_tools_cache()` to explicitly clear the cache. 🛠 How to use it ```python from agents.mcp import MCPServerStreamableHttp # Enable tool list caching server = MCPServerStreamableHttp( params={"url": ""}, cache_tools_list=True, ) async with server: # First call hits the network, subsequent calls use cache tools = await server.list_tools() # Clear cache when tool definitions change server.invalidate_tools_cache() tools = await server.list_tools() # Fetches fresh list ``` 🏗 Building it into production ・Always set `cache_tools_list=True` for MCP servers with stable tool definitions ・Call `invalidate_tools_cache()` during deployments or tool updates to refresh the cache ・When multiple agents share the same server, caching improves overall system latency ・Periodically refresh the cache during health checks for added reliability 💡 Use cases ⚡ Improving response times in high-frequency chat applications 🔄 Reducing tool list overhead in multi-turn conversations 🏢 Optimizing internal MCP servers with stable tool sets 📉 Cutting costs by reducing request volume to MCP servers ⚠️ Watch out With caching enabled, tool additions or removals on the MCP server won't be reflected until the cache is invalidated. In environments where tool definitions change dynamically, call `invalidate_tools_cache()` at the right moments or leave caching disabled. ✨ One simple flag to eliminate the overhead of MCP tool fetching. #OpenAIAgentSDK# #AIAgent#
Show more
# Useful but Little-Known Features of OpenAI Agent SDK 🌍 Are you exposing every single tool from your MCP server to the agent? Tool filtering lets you control tool visibility statically or dynamically, improving agent accuracy and security. 📌 Title: Tool Filtering (Static / Dynamic) 🔗 URL: 🧩 Overview When MCP servers expose many tools, showing them all to the agent can cause confusion or unintended tool calls. The `tool_filter` parameter lets you use a static filter (`create_static_tool_filter`) to specify allow/block lists, or a dynamic filter (a sync or async callable) to decide tool availability based on runtime context. When both `allowed_tool_names` and `blocked_tool_names` are supplied, the allow-list is applied first and blocked tools are then removed from the remaining set. 🛠 How to use it ```python from agents.mcp import MCPServerStreamableHttp, create_static_tool_filter # Static filter: explicitly allow specific tools server = MCPServerStreamableHttp( params={"url": ""}, tool_filter=create_static_tool_filter( allowed_tool_names=["search", "summarize"] ), ) # Dynamic filter: decide at runtime using context async def my_filter(context, tool) -> bool: # context.agent, context.server_name available if == "admin": return True # Admins get all tools return in ["search", "read"] server_dynamic = MCPServerStreamableHttp( params={"url": ""}, tool_filter=my_filter, ) ``` 🏗 Building it into production ・Dynamically switch available tools based on user permission levels ・Use static filters to exclude unnecessary tools and improve model tool selection accuracy ・Pass tenant information via ` to isolate tools in multi-tenant environments ・Log dynamic filter decisions for access control audit trails 💡 Use cases 🔒 Role-based tool access control 🎯 Narrowing tools for task-specific agents 🏢 Tool isolation in multi-tenant environments 🛡 Enforcing security policies on tool access ⚠️ Watch out Dynamic filters are called every time the tool list is fetched, so heavy operations (like DB lookups) can impact latency. Keep filter logic simple and use caching when needed. Also verify that filtered-out tools aren't essential for the agent's core functionality. ✨ With tool filtering, give your agent exactly the tools it needs — nothing more, nothing less. #OpenAIAgentSDK# #AIAgent#
Show more
BREAKING: SpaceXAI just released a major Grok Build update, with Grok 4.7 now available in Grok Build. The update improves crash recovery, prompt handling, navigation, configuration reliability and overall subagent performance. It also adds new subagent controls, configurable request limits and long-reasoning reminders. Release Notes Version 1.0.41 — September 22, 2026 Features • Added a new sports_search tool that can look up live NFL scores, standings, schedules, player stats and team records directly from X data. • Added a subagent model inheritance setting to /settings. It persists in config.toml and respects managed and overlay layers. • Per-model request size limits can now be configured to match provider HTTP body caps and control inline image eviction. • A long-reasoning reminder can now be enabled through config to nudge the model after lengthy hidden-reasoning steps. Bug Fixes • Fixed the subagent fullscreen view so it no longer shows a stray [Dashboard] button in the header. • Fixed agent frontmatter mcpServers so headers and URLs from the active agent’s agent.md correctly override config.toml and survive config reloads or agent switches. • Ctrl+P now opens the command palette immediately from the welcome screen. • The Dashboard now focuses the “+ New Agent” row instead of leaving the previous session selected. • Sessions interrupted by a crash now show a clear marker instead of silently dropping the turn. • Pressing Ctrl+Z immediately after stashing a prompt now restores it. • The collapsed edit blocks setting now correctly collapses edits even when expanded_by_default is pinned to true. • Interjections now receive a visible reply before the agent resumes its previous tasks. • Cancelling a turn blocked on spawn_subagent now tells the model that the child moved to the background instead of claiming it was never executed. • Saving a queued-prompt edit now returns focus to the composer so the next keystrokes type the next message. • Subagent activation is now consistent between the TUI and Grok Agent Studio. Tables that only set limits or models no longer disable subagents. • Effort-level selection now accepts menu labels in addition to IDs.
Show more
0
82
1.2K
130
Forward to community
# Useful but Little-Known Features of Claude Agent SDK 🌍 Want to give each subagent its own skills, MCP servers, and memory? AgentDefinition has you covered with rich per-agent configuration! Claude Agent SDK's AgentDefinition supports skills, memory, mcpServers, and many more fields for comprehensive per-agent customization. 📌 Title: Per-Agent Configuration: skills / memory / mcpServers 🔗 URL: 🧩 Overview `AgentDefinition` includes numerous optional fields beyond the required `description` and `prompt`. Use `skills` to preload domain-specific knowledge, `memory` to set the memory source (`user`, `project`, or `local`), and `mcpServers` to connect MCP servers by name or inline config. Additional fields include `tools`, `disallowedTools`, `model` (aliases like `sonnet`/`opus`/`haiku`/`inherit` or a full model ID), `effort`, `permissionMode`, `maxTurns`, `background`, and `initialPrompt` for comprehensive behavior control. 🛠 How to Use ```python # Python - fully configured agent definition from claude_agent_sdk import AgentDefinition agent = AgentDefinition( description="Database migration specialist", prompt="You are a DB migration expert. Propose safe migration strategies.", tools=["Read", "Grep", "Glob", "Bash"], disallowed_tools=["Bash(rm *)"], # Block specific operations model="opus", # Use high-quality model skills=["db-migration"], # Preload skills memory="project", # Use project memory mcpServers=["postgres-server"], # Connect MCP servers effort="high", # Higher reasoning level max_turns=20, # Limit maximum turns permission_mode="acceptEdits", # Auto-approve edits background=False, # Run in foreground ) ``` ```typescript // TypeScript const agent: AgentDefinition = { description: "Database migration specialist", prompt: "You are a DB migration expert. Propose safe migration strategies.", tools: ["Read", "Grep", "Glob", "Bash"], disallowedTools: ["Bash(rm *)"], model: "opus", skills: ["db-migration"], memory: "project", mcpServers: ["postgres-server"], effort: "high", maxTurns: 20, permissionMode: "acceptEdits", background: false, }; ``` 🏗 Integration into Production Systems - Use `skills` to preload domain-specific knowledge for specialized agents (unlisted skills remain invocable via the Skill tool) - Set appropriate `memory` scope to control context sharing between agents - Manage database and external service connections via `mcpServers` by name or inline configuration - Use `maxTurns` for cost control and runaway prevention; set `effort` to match task importance - Enable `background: true` for non-blocking execution to improve parallel task efficiency 💡 Use Cases 🗄 Database migration agents with MCP server connections for direct DB access 📚 Expert agents with domain-specific skills preloaded at startup ⚡ High-speed workflows with background agents running parallel analyses ⚠️ Caveats - Omitting `tools` inherits all tools from the parent; specify explicitly if you want restrictions - Subagent `permissionMode` is forcibly inherited when the parent uses `bypassPermissions`, `acceptEdits`, or `auto` and cannot be overridden - Skills listed in `skills` are preloaded at startup, but unlisted skills can still be invoked via the Skill tool - In the Python SDK, field names use camelCase to match the wire format ✨ With AgentDefinition's rich configuration fields, you can build purpose-built specialist agents instead of generic ones. Tailor every aspect to the task at hand! #ClaudeAgentSDK# #AIAgent#
Show more
# Cursor Features and Practical Usage 🧩 What if you could call Cursor's AI agent from inside your own scripts and CI checks? The `@cursor/sdk` package grants that wish with a scriptable TypeScript interface to the agent. 🏷️ Title: @cursor/sdk (TypeScript) 🔗 URL: 📘 Overview `@cursor/sdk` exposes the same Cursor agent that powers the IDE, CLI, and web app as a scriptable TypeScript interface. It's built for CI automation, embedded products, and orchestrating custom workflows. It's Node-first, and local agent code loads lazily so cloud-only consumers don't pay the startup cost. ⚙️ How It Works The core concepts are Agent (a stateful container holding conversation context and workspace config), Run (a single prompt submission with its own stream, status, and result), and SDKMessage (normalized stream events emitted during a run). ・`Agent.create()`: validates options and returns a handle immediately; you send prompts via `agent.send()`. ・local / cloud keys: choose where execution happens. `local` runs the agent loop inline in your Node process, while `cloud` runs it in a Cursor-hosted isolated VM with the repo cloned in (a self-hosted VM pool is also supported). ・"Local" only describes where the agent loop runs; model inference goes through Cursor's backend in both modes. ・`local.customTools` lets you expose your own functions as tools (local only). `Agent.prompt()` is a one-shot shortcut. 🛠️ Practical Usage Install with the exact, scoped package name via `npm install @cursor/sdk`. For a CI check against your local working tree, call `Agent.create()` with your `apiKey`, a `model` id, and a `local` cwd, then `agent.send()` a prompt, `await run.wait()`, and check `result.status === "finished"`. To run in the cloud, use the `cloud` key and set `autoCreatePR: true` to open a PR on finish. Authenticate via the `CURSOR_API_KEY` env var or an explicit `apiKey`, using either a user key or a service account key. 💡 Use Cases Run `Agent.prompt()` in PR CI to automate a security audit; use the `cloud` key to spin up many parallel agents that open PRs on separate branches for a large refactor; or wire an internal deployment-check API into the agent via `local.customTools` to embed it in your own workflow. ⚠️ Caveats In local mode, the agent runs shell commands and file edits without approval unless you configure sandboxing or hooks, so consider `local.sandboxOptions: { enabled: true }` in CI. There is no Python SDK; for other languages use the SDK Bridge, or call the Cloud Agents REST API directly. `Agent.resume()` drops inline `mcpServers`, so re-pass them, and model IDs can change, so confirm via `Cursor.models.list()`. #Cursor# #SDK#
Show more
MCP meets agent skills MCP already gave agents a standard way to connect to tools, resources, and external systems. Now it also defines a standard way to discover and load Agent Skills directly from MCP servers. The flow is simple: → connect to MCP server → discover available skills → inspect skill metadata → load the relevant 𝗦𝗞𝗜𝗟𝗟.𝗺𝗱 only when needed Under the hood, Skills are served through MCP’s existing Resources primitive. That means 𝗦𝗞𝗜𝗟𝗟.𝗺𝗱, references, scripts, examples, and other supporting files are exposed as resources that the client can read on demand. This is especially useful for context window management. Instead of loading every workflow instruction upfront, the agent can first discover what skills are available and pull in only the one required for the current task. A useful mental model is: tools = what the agent can do resources = what the agent can access skills = how the agent should perform a reusable workflow Previously, that workflow knowledge often lived separately in docs, repos, prompt files, or custom integrations. Now the MCP server can expose the capability and the playbook for using it together. So you get: → standardized skill discovery → on-demand context loading → cleaner distribution and versioning → reusable workflows that travel with the server MCP was already the connection layer. Skills now add a standardized way to ship reusable agent know-how on top of it. The illustration below visually summarizes everything that we discussed so far. Read more: Cheers! :)
Show more
MCP server portals now fully support the 2026-07-28 spec. You can upgrade clients and servers independently for better flexibility.
MCP: new enough to be exciting, old enough to create a sprawl problem. Tell me if this sounds familiar. One team spins up an MCP server. Then five more. All built differently of course! Nobody knows what's out there or who owns what. Yikes. Agents got flooded with tools they don't need and you accidentally spent a months worth of tokens in a day (and you can't even blame Fable). Shadow infra at it's finest! But now it's got AI speed, so it's like supercharged chaos. That's why we built a central gateway for all AI context. One place to enforce authentication and security for all your data and tools. One point of observability to see which tools are being used, by which agents, and at what cost.
Show more