Skip to content

feat: Add Permission Control for MCP Tools #2748

Closed

Description

@thuanpham582002

Summary: MCP tools currently bypass OpenCode's permission system while built-in tools require approval.
Add permission control for MCP tools.

Problem

Currently, MCP (Model Context Protocol) tools completely bypass OpenCode's permission system:
Built-in tools (have permission checks):

await Permission.ask({
  type: "bash",
  pattern: patterns,
  sessionID: ctx.sessionID,
   ... approval flow
})

MCP tools (bypass permission system):

In packages/opencode/src/session/prompt.ts

for (const [key, item] of Object.entries(await MCP.tools())) {
  item.execute = async (args, opts) => {
     NO Permission.ask() here!
    await Plugin.trigger("tool.execute.before", ...)
    const result = await execute(args, opts)
    await Plugin.trigger("tool.execute.after", ...)
    return { output }
  }
}

Security Concerns

• No user control: MCP tools can execute without approval
• Inconsistent security: Built-in tools require approval, MCP tools don't
• Potential abuse: Malicious MCP servers could perform harmful actionsl

Activity

  1. self-assigned this
    on Sep 23, 2025
  2. rekram1-node commented on Sep 23, 2025

    @rekram1-node
    Contributor

    totally agree

  3. rekram1-node commented on Sep 23, 2025

    @rekram1-node
    Contributor

    this will be done as part of: #1961

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions