Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

ng-webmcp

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-webmcp

Angular library for exposing WebMCP tools from browser applications.

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

ng-webmcp

Angular library for the WebMCP (Web Model Context Protocol) browser API. Expose your Angular application as an AI-agent-ready tool provider using idiomatic Angular patterns.

Installation

npm install ng-webmcp

Quick Start

Standalone Application

import { bootstrapApplication } from '@angular/platform-browser';
import { provideWebmcp } from 'ng-webmcp';

bootstrapApplication(AppComponent, {
  providers: [provideWebmcp({ fallbackBehavior: 'warn' })],
});

NgModule Application

import { WebmcpModule } from 'ng-webmcp';

@NgModule({
  imports: [WebmcpModule.forRoot({ fallbackBehavior: 'warn' })],
})
export class AppModule {}

Register a Tool via Decorator

import { inject, Injectable } from '@angular/core';
import {
  WebmcpService,
  WebmcpTool,
  registerDecoratedTools,
} from 'ng-webmcp';

@Injectable({ providedIn: 'root' })
export class ProductService {
  private webmcp = inject(WebmcpService);

  constructor() {
    registerDecoratedTools(this, this.webmcp);
  }

  @WebmcpTool({
    name: 'search-products',
    description: 'Search the product catalog',
    annotations: { readOnlyHint: true, untrustedContentHint: true },
    inputSchema: {
      query: { type: 'string', description: 'Search term' },
    },
  })
  async search(args: { query: string }) {
    const results = await this.api.search(args.query);
    return { content: [{ type: 'text', text: JSON.stringify(results) }] };
  }
}

Development Polyfill

import { installWebMcpPolyfill } from 'ng-webmcp/testing';

installWebMcpPolyfill();

Import this before bootstrapping Angular.

Tool annotations

annotations supports readOnlyHint, destructiveHint, idempotentHint, openWorldHint, and untrustedContentHint.

From Chrome 149.0.7810.0, set untrustedContentHint: true for tools returning data from untrusted/external sources.

Publishing

The GitHub Actions release workflow publishes only when the pushed tag exactly matches the library version in projects/ng-webmcp/package.json.

Configure npm Trusted Publisher for this GitHub repository and workflow file before creating the tag. No NPM_TOKEN secret is required.

npm run build:lib
git tag v0.1.0
git push origin v0.1.0

Keywords

angular

FAQs

Package last updated on 24 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts